Class: Io::Flow::V0::Models::AuthorizationError

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

Overview

Details for why an authorization was not created

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ AuthorizationError

Returns a new instance of AuthorizationError.



19108
19109
19110
19111
19112
19113
19114
19115
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19108

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:code, :messages], 'AuthorizationError')
  @code = (x = opts.delete(:code); x.is_a?(::Io::Flow::V0::Models::AuthorizationDeclineCode) ? x : ::Io::Flow::V0::Models::AuthorizationDeclineCode.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.



19106
19107
19108
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19106

def avs
  @avs
end

#codeObject (readonly)

Returns the value of attribute code.



19106
19107
19108
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19106

def code
  @code
end

#cvvObject (readonly)

Returns the value of attribute cvv.



19106
19107
19108
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19106

def cvv
  @cvv
end

#messagesObject (readonly)

Returns the value of attribute messages.



19106
19107
19108
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19106

def messages
  @messages
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



19121
19122
19123
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19121

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

#to_hashObject



19125
19126
19127
19128
19129
19130
19131
19132
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19125

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



19117
19118
19119
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19117

def to_json
  JSON.dump(to_hash)
end