Class: Io::Flow::V0::Models::CardError

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

Overview

Details for why a card was not created

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ CardError



13184
13185
13186
13187
13188
13189
13190
13191
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13184

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:code, :messages], 'CardError')
  @code = (x = opts.delete(:code); x.is_a?(::Io::Flow::V0::Models::CardErrorCode) ? x : ::Io::Flow::V0::Models::CardErrorCode.apply(x))
  @messages = HttpClient::Preconditions.assert_class('messages', opts.delete(:messages), Array).map { |v| HttpClient::Preconditions.assert_class('messages', v, String) }
  @avs = (x = opts.delete(:avs); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Avs) ? x : ::Io::Flow::V0::Models::Avs.new(x)))
  @cvv = (x = opts.delete(:cvv); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Cvv) ? x : ::Io::Flow::V0::Models::Cvv.new(x)))
end

Instance Attribute Details

#avsObject (readonly)

Returns the value of attribute avs.



13182
13183
13184
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13182

def avs
  @avs
end

#codeObject (readonly)

Returns the value of attribute code.



13182
13183
13184
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13182

def code
  @code
end

#cvvObject (readonly)

Returns the value of attribute cvv.



13182
13183
13184
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13182

def cvv
  @cvv
end

#messagesObject (readonly)

Returns the value of attribute messages.



13182
13183
13184
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13182

def messages
  @messages
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



13197
13198
13199
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13197

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

#to_hashObject



13201
13202
13203
13204
13205
13206
13207
13208
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13201

def to_hash
  {
    :code => code.value,
    :messages => messages,
    :avs => avs.nil? ? nil : avs.to_hash,
    :cvv => cvv.nil? ? nil : cvv.to_hash
  }
end

#to_jsonObject



13193
13194
13195
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13193

def to_json
  JSON.dump(to_hash)
end