Class: Io::Flow::V0::Models::RefundError

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

Returns a new instance of RefundError.



63102
63103
63104
63105
63106
63107
63108
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63102

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:messages, :decline_code], 'RefundError')
  @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::RefundDeclineCode) ? x : ::Io::Flow::V0::Models::RefundDeclineCode.apply(x))
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



63100
63101
63102
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63100

def code
  @code
end

#decline_codeObject (readonly)

Returns the value of attribute decline_code.



63100
63101
63102
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63100

def decline_code
  @decline_code
end

#messagesObject (readonly)

Returns the value of attribute messages.



63100
63101
63102
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63100

def messages
  @messages
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



63114
63115
63116
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63114

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

#to_hashObject



63118
63119
63120
63121
63122
63123
63124
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63118

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

#to_jsonObject



63110
63111
63112
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63110

def to_json
  JSON.dump(to_hash)
end