Class: FreshBooks::Payment
- Inherits:
-
Object
- Object
- FreshBooks::Payment
- Defined in:
- lib/freshbooks.rb
Constant Summary collapse
- TYPE_MAPPINGS =
{ 'client_id' => Fixnum, 'invoice_id' => Fixnum, 'amount' => Float }
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.get(payment) ⇒ Object
411 412 413 414 415 |
# File 'lib/freshbooks.rb', line 411 def self.get(payment) resp = FreshBooks::call_api('payment.get', 'payment_id' => payment_id) resp.success? ? self.new_from_xml(resp.elements[1]) : nil end |
.list(options = {}) ⇒ Object
417 418 419 420 421 422 423 424 |
# File 'lib/freshbooks.rb', line 417 def self.list( = {}) resp = FreshBooks::call_api('payment.list', ) return nil unless resp.success? payment_elems = resp.elements[1].elements payment_elems.map { |elem| self.new_from_xml(elem) } end |
Instance Method Details
#create ⇒ Object
396 397 398 399 400 401 402 403 |
# File 'lib/freshbooks.rb', line 396 def create resp = FreshBooks::call_api('payment.create', 'payment' => self) if resp.success? self.payment_id = resp.elements[1].text.to_i end resp.success? ? self.payment_id : nil end |
#update ⇒ Object
405 406 407 408 409 |
# File 'lib/freshbooks.rb', line 405 def update resp = FreshBooks::call_api('payment.update', 'payment' => self) resp.success? end |