Class: Io::Flow::V0::Models::PayoutStatus
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::PayoutStatus
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Direct Known Subclasses
PayoutStatusFailed, PayoutStatusScheduled, PayoutStatusSent, PayoutStatusUndefinedType
Defined Under Namespace
Modules: Types
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(incoming = {}) ⇒ PayoutStatus
constructor
A new instance of PayoutStatus.
- #subtype_to_hash ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ PayoutStatus
Returns a new instance of PayoutStatus.
14408 14409 14410 14411 14412 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14408 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:code], 'PayoutStatus') @code = HttpClient::Preconditions.assert_class('code', opts.delete(:code), String) end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
14406 14407 14408 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14406 def code @code end |
Class Method Details
.from_json(hash) ⇒ Object
14422 14423 14424 14425 14426 14427 14428 14429 14430 14431 14432 14433 14434 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14422 def PayoutStatus.from_json(hash) HttpClient::Preconditions.assert_class('hash', hash, Hash) discriminator = HttpClient::Helper.symbolize_keys(hash)[:code].to_s.strip if discriminator.empty? raise "Union type[payout_status] requires a field named 'code'" end case discriminator when Types::PAYOUT_STATUS_SCHEDULED; PayoutStatusScheduled.new(hash) when Types::PAYOUT_STATUS_SENT; PayoutStatusSent.new(hash) when Types::PAYOUT_STATUS_FAILED; PayoutStatusFailed.new(hash) else PayoutStatusUndefinedType.new(:code => discriminator) end end |
Instance Method Details
#subtype_to_hash ⇒ Object
14414 14415 14416 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14414 def subtype_to_hash raise 'Cannot serialize an instance of payout_status directly - must use one of the specific types: payout_status_scheduled, payout_status_sent, payout_status_failed' end |
#to_hash ⇒ Object
14418 14419 14420 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14418 def to_hash subtype_to_hash.merge(:code => @code) end |