Class: Apruve::InvoiceReturn
- Inherits:
-
ApruveObject
- Object
- ApruveObject
- Apruve::InvoiceReturn
- Defined in:
- lib/apruve/resources/invoice_return.rb
Instance Attribute Summary collapse
-
#amount_cents ⇒ Object
Returns the value of attribute amount_cents.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#created_by_id ⇒ Object
Returns the value of attribute created_by_id.
-
#currency ⇒ Object
Returns the value of attribute currency.
-
#id ⇒ Object
Returns the value of attribute id.
-
#invoice_id ⇒ Object
Returns the value of attribute invoice_id.
-
#merchant_notes ⇒ Object
Returns the value of attribute merchant_notes.
-
#reason ⇒ Object
Returns the value of attribute reason.
-
#updated_at ⇒ Object
Returns the value of attribute updated_at.
-
#uuid ⇒ Object
Returns the value of attribute uuid.
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from ApruveObject
#initialize, #logger, logger, #to_hash, #to_json
Constructor Details
This class inherits a constructor from Apruve::ApruveObject
Instance Attribute Details
#amount_cents ⇒ Object
Returns the value of attribute amount_cents.
3 4 5 |
# File 'lib/apruve/resources/invoice_return.rb', line 3 def amount_cents @amount_cents end |
#created_at ⇒ Object
Returns the value of attribute created_at.
3 4 5 |
# File 'lib/apruve/resources/invoice_return.rb', line 3 def created_at @created_at end |
#created_by_id ⇒ Object
Returns the value of attribute created_by_id.
3 4 5 |
# File 'lib/apruve/resources/invoice_return.rb', line 3 def created_by_id @created_by_id end |
#currency ⇒ Object
Returns the value of attribute currency.
3 4 5 |
# File 'lib/apruve/resources/invoice_return.rb', line 3 def currency @currency end |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/apruve/resources/invoice_return.rb', line 3 def id @id end |
#invoice_id ⇒ Object
Returns the value of attribute invoice_id.
3 4 5 |
# File 'lib/apruve/resources/invoice_return.rb', line 3 def invoice_id @invoice_id end |
#merchant_notes ⇒ Object
Returns the value of attribute merchant_notes.
3 4 5 |
# File 'lib/apruve/resources/invoice_return.rb', line 3 def merchant_notes @merchant_notes end |
#reason ⇒ Object
Returns the value of attribute reason.
3 4 5 |
# File 'lib/apruve/resources/invoice_return.rb', line 3 def reason @reason end |
#updated_at ⇒ Object
Returns the value of attribute updated_at.
3 4 5 |
# File 'lib/apruve/resources/invoice_return.rb', line 3 def updated_at @updated_at end |
#uuid ⇒ Object
Returns the value of attribute uuid.
3 4 5 |
# File 'lib/apruve/resources/invoice_return.rb', line 3 def uuid @uuid end |
Class Method Details
.find(invoice_id, id) ⇒ Object
6 7 8 9 10 |
# File 'lib/apruve/resources/invoice_return.rb', line 6 def self.find(invoice_id, id) response = Apruve.get("invoices/#{invoice_id}/invoice_returns/#{id}") logger.debug response.body InvoiceReturn.new(response.body) end |
.find_all(invoice_id) ⇒ Object
19 20 21 22 |
# File 'lib/apruve/resources/invoice_return.rb', line 19 def self.find_all(invoice_id) response = Apruve.get("invoices/#{invoice_id}/invoice_returns") response.body.map { |invoice_return| InvoiceReturn.new(invoice_return) } end |
Instance Method Details
#save! ⇒ Object
30 31 32 33 34 35 |
# File 'lib/apruve/resources/invoice_return.rb', line 30 def save! validate response = Apruve.post("invoices/#{self.invoice_id}/invoice_returns", self.to_json) logger.debug response.body self.id = response.body['id'] end |
#update! ⇒ Object
24 25 26 27 28 |
# File 'lib/apruve/resources/invoice_return.rb', line 24 def update! validate response = Apruve.put("invoices/#{self.invoice_id}/invoice_returns/#{self.id}", self.to_json) logger.debug response.body end |
#validate ⇒ Object
12 13 14 15 16 17 |
# File 'lib/apruve/resources/invoice_return.rb', line 12 def validate errors = [] errors << 'amount_cents must be set' if amount_cents.nil? errors << 'reason must be set' if reason.nil? raise Apruve::ValidationError.new(errors) if errors.length > 0 end |