Class: Io::Flow::V0::Models::PayoutStatusFailed

Inherits:
PayoutStatus
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Attribute Summary collapse

Attributes inherited from PayoutStatus

#code

Instance Method Summary collapse

Methods inherited from PayoutStatus

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ PayoutStatusFailed

Returns a new instance of PayoutStatusFailed.



59218
59219
59220
59221
59222
59223
59224
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59218

def initialize(incoming={})
  super(:code => PayoutStatus::Types::PAYOUT_STATUS_FAILED)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:timestamp, :reason], 'PayoutStatusFailed')
  @timestamp = HttpClient::Preconditions.assert_class('timestamp', HttpClient::Helper.to_date_time_iso8601(opts.delete(:timestamp)), DateTime)
  @reason = (x = opts.delete(:reason); x.is_a?(::Io::Flow::V0::Models::PayoutStatusFailureCode) ? x : ::Io::Flow::V0::Models::PayoutStatusFailureCode.apply(x))
end

Instance Attribute Details

#reasonObject (readonly)

Returns the value of attribute reason.



59216
59217
59218
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59216

def reason
  @reason
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



59216
59217
59218
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59216

def timestamp
  @timestamp
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



59230
59231
59232
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59230

def copy(incoming={})
  PayoutStatusFailed.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#subtype_to_hashObject



59234
59235
59236
59237
59238
59239
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59234

def subtype_to_hash
  {
    :timestamp => timestamp,
    :reason => reason.value
  }
end

#to_jsonObject



59226
59227
59228
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59226

def to_json
  JSON.dump(to_hash)
end