Class: Io::Flow::V0::Models::GenericError

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

Overview

An error of some type has occured. The most common error will be validation on input. See messages for details.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from OrderError

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ GenericError

Returns a new instance of GenericError.



10360
10361
10362
10363
10364
10365
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10360

def initialize(incoming={})
  super(:name => OrderError::Types::GENERIC_ERROR)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:messages], 'GenericError')
  @messages = HttpClient::Preconditions.assert_class('messages', opts.delete(:messages), Array).map { |v| HttpClient::Preconditions.assert_class('messages', v, String) }
end

Instance Attribute Details

#messagesObject (readonly)

Returns the value of attribute messages.



10358
10359
10360
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10358

def messages
  @messages
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



10371
10372
10373
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10371

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

#subtype_to_hashObject



10375
10376
10377
10378
10379
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10375

def subtype_to_hash
  {
    :messages => messages
  }
end

#to_jsonObject



10367
10368
10369
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10367

def to_json
  JSON.dump(to_hash)
end