Class: Io::Flow::V0::Models::AuthorizationCode

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

Overview

Contains the result code from the psp related to this authorization.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ AuthorizationCode

Returns a new instance of AuthorizationCode.



31029
31030
31031
31032
31033
31034
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31029

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:result_code, :code], 'AuthorizationCode')
  @result_code = HttpClient::Preconditions.assert_class('result_code', opts.delete(:result_code), String)
  @code = HttpClient::Preconditions.assert_class('code', opts.delete(:code), String)
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



31027
31028
31029
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31027

def code
  @code
end

#result_codeObject (readonly)

Returns the value of attribute result_code.



31027
31028
31029
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31027

def result_code
  @result_code
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



31040
31041
31042
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31040

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

#to_hashObject



31044
31045
31046
31047
31048
31049
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31044

def to_hash
  {
    :result_code => result_code,
    :code => code
  }
end

#to_jsonObject



31036
31037
31038
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31036

def to_json
  JSON.dump(to_hash)
end