Method: AmznSpApi::TokensApiModel::Error#initialize

Defined in:
lib/tokens_api_model/models/error.rb

#initialize(attributes = {}) ⇒ Error

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash

Raises:

  • (ArgumentError)


49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/tokens_api_model/models/error.rb', line 49

def initialize(attributes = {})
  raise ArgumentError, 'The input argument (attributes) must be a hash in `AmznSpApi::TokensApiModel::Error` initialize method' unless attributes.is_a?(Hash)

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) do |(k, v), h|
    raise ArgumentError, "`#{k}` is not a valid attribute in `AmznSpApi::TokensApiModel::Error`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect unless self.class.attribute_map.key?(k.to_sym)

    h[k.to_sym] = v
  end

  self.code = attributes[:code] if attributes.key?(:code)

  self.message = attributes[:message] if attributes.key?(:message)

  return unless attributes.key?(:details)

  self.details = attributes[:details]
end