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.



52599
52600
52601
52602
52603
52604
52605
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52599

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.



52597
52598
52599
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52597

def authorization_id
  @authorization_id
end

#failure_codeObject (readonly)

Returns the value of attribute failure_code.



52597
52598
52599
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52597

def failure_code
  @failure_code
end

#failure_messageObject (readonly)

Returns the value of attribute failure_message.



52597
52598
52599
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52597

def failure_message
  @failure_message
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



52611
52612
52613
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52611

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

#to_hashObject



52615
52616
52617
52618
52619
52620
52621
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52615

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

#to_jsonObject



52607
52608
52609
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52607

def to_json
  JSON.dump(to_hash)
end