Class: Io::Flow::V0::Models::CreditPaymentError

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 = {}) ⇒ CreditPaymentError

Returns a new instance of CreditPaymentError.



15115
15116
15117
15118
15119
15120
15121
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15115

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:code, :messages, :codes], 'CreditPaymentError')
  @code = (x = opts.delete(:code); x.is_a?(::Io::Flow::V0::Models::CreditPaymentErrorCode) ? x : ::Io::Flow::V0::Models::CreditPaymentErrorCode.apply(x))
  @messages = HttpClient::Preconditions.assert_class('messages', opts.delete(:messages), Array).map { |v| HttpClient::Preconditions.assert_class('messages', v, String) }
  @codes = HttpClient::Preconditions.assert_class('codes', opts.delete(:codes), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::CreditPaymentErrorCode) ? x : ::Io::Flow::V0::Models::CreditPaymentErrorCode.apply(x)) }
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



15113
15114
15115
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15113

def code
  @code
end

#codesObject (readonly)

Returns the value of attribute codes.



15113
15114
15115
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15113

def codes
  @codes
end

#messagesObject (readonly)

Returns the value of attribute messages.



15113
15114
15115
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15113

def messages
  @messages
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



15127
15128
15129
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15127

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

#to_hashObject



15131
15132
15133
15134
15135
15136
15137
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15131

def to_hash
  {
    :code => code.value,
    :messages => messages,
    :codes => codes.map { |o| o.value }
  }
end

#to_jsonObject



15123
15124
15125
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15123

def to_json
  JSON.dump(to_hash)
end