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.



37594
37595
37596
37597
37598
37599
37600
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37594

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.



37592
37593
37594
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37592

def code
  @code
end

#codesObject (readonly)

Returns the value of attribute codes.



37592
37593
37594
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37592

def codes
  @codes
end

#messagesObject (readonly)

Returns the value of attribute messages.



37592
37593
37594
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37592

def messages
  @messages
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



37606
37607
37608
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37606

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

#to_hashObject



37610
37611
37612
37613
37614
37615
37616
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37610

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

#to_jsonObject



37602
37603
37604
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37602

def to_json
  JSON.dump(to_hash)
end