Class: CDEKApiClient::Entities::Payment
- Inherits:
-
Object
- Object
- CDEKApiClient::Entities::Payment
- Includes:
- Validatable
- Defined in:
- lib/cdek_api_client/entities/payment.rb
Overview
Represents a payment entity in the CDEK API. Each payment includes attributes such as value and currency.
Instance Attribute Summary collapse
-
#currency ⇒ Object
Returns the value of attribute currency.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(value:, currency:) ⇒ Payment
constructor
Initializes a new Payment object.
-
#to_json(*_args) ⇒ String
Converts the Payment object to a JSON representation.
Methods included from Validatable
Constructor Details
#initialize(value:, currency:) ⇒ Payment
Initializes a new Payment object.
23 24 25 26 27 |
# File 'lib/cdek_api_client/entities/payment.rb', line 23 def initialize(value:, currency:) @value = value @currency = CurrencyMapper.to_code(currency) validate! end |
Instance Attribute Details
#currency ⇒ Object
Returns the value of attribute currency.
13 14 15 |
# File 'lib/cdek_api_client/entities/payment.rb', line 13 def currency @currency end |
#value ⇒ Object
Returns the value of attribute value.
13 14 15 |
# File 'lib/cdek_api_client/entities/payment.rb', line 13 def value @value end |
Instance Method Details
#to_json(*_args) ⇒ String
Converts the Payment object to a JSON representation.
32 33 34 35 36 37 |
# File 'lib/cdek_api_client/entities/payment.rb', line 32 def to_json(*_args) { value: @value, currency: @currency }.to_json end |