Class: BillForward::Account

Inherits:
MutableEntity show all
Defined in:
lib/bill_forward/entities/account.rb

Overview

This entity exposes the following child entities via method_missing:

Role[] .roles PaymentMethod[] .paymentMethods Profile .profile

Instance Attribute Summary

Attributes inherited from BillingEntity

#_client

Class Method Summary collapse

Methods inherited from MutableEntity

#delete, #initialize, #save

Methods inherited from InsertableEntity

create, #initialize

Methods inherited from BillingEntity

#[], #[]=, #_dump, _load, build_entity, build_entity_array, #camel_case_lower, get_all, get_by_id, #initialize, #method_missing, request_ambiguous, request_first_heterotyped, request_many_heterotyped, #serialize, #serialize_field, singleton_client, #state_params, #to_json, #to_ordered_hash, #to_s, #to_unordered_hash

Constructor Details

This class inherits a constructor from BillForward::MutableEntity

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class BillForward::BillingEntity

Class Method Details

.credit(id, request_object = {}, custom_client = nil) ⇒ Object

Raises:

  • (ArgumentError)


11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/bill_forward/entities/account.rb', line 11

def credit(id, request_object = {}, custom_client = nil)
  raise ArgumentError.new("id cannot be nil") if id.nil?

  endpoint = sprintf('%s/credit',
                     ERB::Util.url_encode(id)
  )

  request_entity = BillForward::GenericEntity.new(
      request_object
  )

  self.request_first_heterotyped(BillForward::CreditNote, 'post', endpoint, request_entity, nil, custom_client)
end