Class: Mpp::Methods::Tempo::Schemas::ChargeRequest
- Inherits:
-
Data
- Object
- Data
- Mpp::Methods::Tempo::Schemas::ChargeRequest
- Defined in:
- lib/mpp/methods/tempo/schemas.rb
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#currency ⇒ Object
readonly
Returns the value of attribute currency.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#external_id ⇒ Object
readonly
Returns the value of attribute external_id.
-
#method_details ⇒ Object
readonly
Returns the value of attribute method_details.
-
#recipient ⇒ Object
readonly
Returns the value of attribute recipient.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(amount:, currency:, recipient:, description: nil, external_id: nil, method_details: nil) ⇒ ChargeRequest
constructor
A new instance of ChargeRequest.
Constructor Details
#initialize(amount:, currency:, recipient:, description: nil, external_id: nil, method_details: nil) ⇒ ChargeRequest
Returns a new instance of ChargeRequest.
29 30 31 32 33 34 35 36 |
# File 'lib/mpp/methods/tempo/schemas.rb', line 29 def initialize(amount:, currency:, recipient:, description: nil, external_id: nil, method_details: nil) raise ArgumentError, "currency must be a hex address" unless currency.match?(HEX_PATTERN) raise ArgumentError, "recipient must be a hex address" unless recipient.match?(HEX_PATTERN) method_details ||= MethodDetails.new super end |
Instance Attribute Details
#amount ⇒ Object (readonly)
Returns the value of attribute amount
27 28 29 |
# File 'lib/mpp/methods/tempo/schemas.rb', line 27 def amount @amount end |
#currency ⇒ Object (readonly)
Returns the value of attribute currency
27 28 29 |
# File 'lib/mpp/methods/tempo/schemas.rb', line 27 def currency @currency end |
#description ⇒ Object (readonly)
Returns the value of attribute description
27 28 29 |
# File 'lib/mpp/methods/tempo/schemas.rb', line 27 def description @description end |
#external_id ⇒ Object (readonly)
Returns the value of attribute external_id
27 28 29 |
# File 'lib/mpp/methods/tempo/schemas.rb', line 27 def external_id @external_id end |
#method_details ⇒ Object (readonly)
Returns the value of attribute method_details
27 28 29 |
# File 'lib/mpp/methods/tempo/schemas.rb', line 27 def method_details @method_details end |
#recipient ⇒ Object (readonly)
Returns the value of attribute recipient
27 28 29 |
# File 'lib/mpp/methods/tempo/schemas.rb', line 27 def recipient @recipient end |
Class Method Details
.from_hash(hash) ⇒ Object
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/mpp/methods/tempo/schemas.rb', line 38 def self.from_hash(hash) new( amount: hash["amount"], currency: hash["currency"], recipient: hash["recipient"], description: hash["description"], external_id: hash["externalId"], method_details: MethodDetails.from_hash(hash["methodDetails"]) ) end |