Class: Io::Flow::V0::Models::PaymentFailure

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ PaymentFailure

Returns a new instance of PaymentFailure.



56836
56837
56838
56839
56840
56841
56842
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56836

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:failure_code, :failure_message], 'PaymentFailure')
  @authorization_id = (x = opts.delete(:authorization_id); x.nil? ? nil : HttpClient::Preconditions.assert_class('authorization_id', x, String))
  @failure_code = (x = opts.delete(:failure_code); x.is_a?(::Io::Flow::V0::Models::PaymentFailureCode) ? x : ::Io::Flow::V0::Models::PaymentFailureCode.apply(x))
  @failure_message = HttpClient::Preconditions.assert_class('failure_message', opts.delete(:failure_message), String)
end

Instance Attribute Details

#authorization_idObject (readonly)

Returns the value of attribute authorization_id.



56834
56835
56836
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56834

def authorization_id
  @authorization_id
end

#failure_codeObject (readonly)

Returns the value of attribute failure_code.



56834
56835
56836
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56834

def failure_code
  @failure_code
end

#failure_messageObject (readonly)

Returns the value of attribute failure_message.



56834
56835
56836
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56834

def failure_message
  @failure_message
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



56848
56849
56850
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56848

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

#to_hashObject



56852
56853
56854
56855
56856
56857
56858
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56852

def to_hash
  {
    :authorization_id => authorization_id,
    :failure_code => failure_code.value,
    :failure_message => failure_message
  }
end

#to_jsonObject



56844
56845
56846
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 56844

def to_json
  JSON.dump(to_hash)
end