Class: Io::Flow::V0::Models::CaptureError

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

Returns a new instance of CaptureError.



32790
32791
32792
32793
32794
32795
32796
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32790

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

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



32788
32789
32790
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32788

def code
  @code
end

#decline_codeObject (readonly)

Returns the value of attribute decline_code.



32788
32789
32790
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32788

def decline_code
  @decline_code
end

#messagesObject (readonly)

Returns the value of attribute messages.



32788
32789
32790
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32788

def messages
  @messages
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



32802
32803
32804
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32802

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

#to_hashObject



32806
32807
32808
32809
32810
32811
32812
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32806

def to_hash
  {
    :code => code.value,
    :messages => messages,
    :decline_code => decline_code.value
  }
end

#to_jsonObject



32798
32799
32800
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32798

def to_json
  JSON.dump(to_hash)
end