Class: Openpix::RubySdk::Resources::Charge
- Defined in:
- lib/openpix/ruby_sdk/resources/charge.rb
Overview
Make API operations on Charge resource
Constant Summary collapse
- ATTRS =
%w[ correlationID value type comment identifier expiresIn customer daysForDueDate daysAfterDueDate interests fines additionalInfo ].freeze
Instance Method Summary collapse
-
#add_additional_info(key, value) ⇒ Object
add a new additional_info.
-
#create_attributes ⇒ Object
attributes used on POST create method.
- #init_body(params: {}, rest: {}) ⇒ Object
-
#set_fines(value) ⇒ Object
set fines configuration for creating this resource.
-
#set_interests(value) ⇒ Object
set interests configuration for creating this resource.
-
#to_body ⇒ Object
Converts its attributes into a hash.
-
#to_url ⇒ Object
URL for this resource.
Methods inherited from Resource
#destroy, #destroy!, #fetch, #fetch!, #fetch_next_page!, #fetch_previous_page!, #find, #find!, #initialize, #save, #save!, #to_collection_resource, #to_single_resource
Constructor Details
This class inherits a constructor from Openpix::RubySdk::Resources::Resource
Instance Method Details
#add_additional_info(key, value) ⇒ Object
add a new additional_info
63 64 65 66 67 |
# File 'lib/openpix/ruby_sdk/resources/charge.rb', line 63 def add_additional_info(key, value) @additionalInfo = [] if @additionalInfo.nil? @additionalInfo << { 'key' => key, 'value' => value } end |
#create_attributes ⇒ Object
attributes used on POST create method
35 36 37 |
# File 'lib/openpix/ruby_sdk/resources/charge.rb', line 35 def create_attributes ATTRS end |
#init_body(params: {}, rest: {}) ⇒ Object
30 31 32 |
# File 'lib/openpix/ruby_sdk/resources/charge.rb', line 30 def init_body(params: {}, rest: {}) super(base_attrs: ATTRS, params: params, rest: rest) end |
#set_fines(value) ⇒ Object
set fines configuration for creating this resource
77 78 79 |
# File 'lib/openpix/ruby_sdk/resources/charge.rb', line 77 def set_fines(value) @fines = { 'value' => value } end |
#set_interests(value) ⇒ Object
set interests configuration for creating this resource
71 72 73 |
# File 'lib/openpix/ruby_sdk/resources/charge.rb', line 71 def set_interests(value) @interests = { 'value' => value } end |
#to_body ⇒ Object
Converts its attributes into a hash
45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/openpix/ruby_sdk/resources/charge.rb', line 45 def to_body body = super return body if body['customer'].nil? || body['customer'].empty? body['customer'] = Openpix::RubySdk::ApiBodyFormatter.remove_empty_values(body['customer']) return body if body['customer']['address'].nil? || body['customer']['address'].empty? customer_address_parsed = Openpix::RubySdk::ApiBodyFormatter.remove_empty_values(body['customer']['address']) body['customer'] = body['customer'].merge({ 'address' => customer_address_parsed }) body end |
#to_url ⇒ Object
URL for this resource
40 41 42 |
# File 'lib/openpix/ruby_sdk/resources/charge.rb', line 40 def to_url 'charge' end |