Class: Coinsimple::Invoice

Inherits:
Object
  • Object
show all
Defined in:
lib/coinsimple/invoice.rb

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Invoice

Returns a new instance of Invoice.



4
5
6
# File 'lib/coinsimple/invoice.rb', line 4

def initialize opts = {}
  @options = opts
end

Instance Method Details

#add_item(item) ⇒ Object



77
78
79
80
81
# File 'lib/coinsimple/invoice.rb', line 77

def add_item item
  @options[:items] = [] unless @options.has_key?(:items)
  @options[:items] << item
  self
end

#dataObject



83
84
85
# File 'lib/coinsimple/invoice.rb', line 83

def data
  @options
end

#recur_by_date(day_of_month) ⇒ Object



71
72
73
74
75
# File 'lib/coinsimple/invoice.rb', line 71

def recur_by_date day_of_month
  @options[:invoice_type] = 'date'
  @options[:interval] = day_of_month
  self
end

#recur_by_days(num_days) ⇒ Object



65
66
67
68
69
# File 'lib/coinsimple/invoice.rb', line 65

def recur_by_days num_days
  @options[:invoice_type] = 'days'
  @options[:interval] = num_days
  self
end

#set_callback_url(callback_url) ⇒ Object



49
50
51
52
# File 'lib/coinsimple/invoice.rb', line 49

def set_callback_url callback_url
  @options[:callback_url] = callback_url
  self
end

#set_currency(currency) ⇒ Object



28
29
30
31
# File 'lib/coinsimple/invoice.rb', line 28

def set_currency currency
  @options[:currency] = currency
  self
end

#set_custom(custom) ⇒ Object



44
45
46
47
# File 'lib/coinsimple/invoice.rb', line 44

def set_custom custom
  @options[:custom] = custom
  self
end

#set_email(email) ⇒ Object



13
14
15
16
# File 'lib/coinsimple/invoice.rb', line 13

def set_email email
  @options[:email] = email
  self
end

#set_name(recipient) ⇒ Object



8
9
10
11
# File 'lib/coinsimple/invoice.rb', line 8

def set_name recipient
  @options[:name] = recipient
  self
end

#set_notes(notes) ⇒ Object



33
34
35
36
# File 'lib/coinsimple/invoice.rb', line 33

def set_notes notes
  @options[:notes] = notes
  self
end

#set_precent(precent) ⇒ Object Also known as: set_discount



38
39
40
41
# File 'lib/coinsimple/invoice.rb', line 38

def set_precent precent
  @options[:precent] = precent
  self
end

#set_processor(processor) ⇒ Object



18
19
20
21
# File 'lib/coinsimple/invoice.rb', line 18

def set_processor processor
  @options[:processor] = processor
  self
end

#set_rate(rate) ⇒ Object



23
24
25
26
# File 'lib/coinsimple/invoice.rb', line 23

def set_rate rate
  @options[:rate] = rate
  self
end

#set_recurring_times(recurring_times) ⇒ Object Also known as: set_stop_after



59
60
61
62
# File 'lib/coinsimple/invoice.rb', line 59

def set_recurring_times recurring_times
  @options[:recurring_times] = recurring_times
  self
end

#set_redirect_url(redirect_url) ⇒ Object



54
55
56
57
# File 'lib/coinsimple/invoice.rb', line 54

def set_redirect_url redirect_url
  @options[:redirect_url] = redirect_url
  self
end