Class: SuggestGrid::BulkPostError

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/suggestgrid/models/bulk_post_error.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(message = nil, value = nil, error = nil) ⇒ BulkPostError

Returns a new instance of BulkPostError.



28
29
30
31
32
33
34
# File 'lib/suggestgrid/models/bulk_post_error.rb', line 28

def initialize(message = nil,
               value = nil,
               error = nil)
  @message = message
  @value = value
  @error = error
end

Instance Attribute Details

#errorObject

Programatic description of the error.

Returns:

  • (Object)


15
16
17
# File 'lib/suggestgrid/models/bulk_post_error.rb', line 15

def error
  @error
end

#messageString

Message of the response.

Returns:



7
8
9
# File 'lib/suggestgrid/models/bulk_post_error.rb', line 7

def message
  @message
end

#valueObject

The cause of the error.

Returns:

  • (Object)


11
12
13
# File 'lib/suggestgrid/models/bulk_post_error.rb', line 11

def value
  @value
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash



37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/suggestgrid/models/bulk_post_error.rb', line 37

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash

  message = hash['message']
  value = hash['value']
  error = hash['error']

  # Create object from extracted values

  BulkPostError.new(message,
                    value,
                    error)
end

.namesObject

A mapping from model property names to API property names



18
19
20
21
22
23
24
25
26
# File 'lib/suggestgrid/models/bulk_post_error.rb', line 18

def self.names
  if @_hash.nil?
    @_hash = {}
    @_hash["message"] = "message"
    @_hash["value"] = "value"
    @_hash["error"] = "error"
  end
  @_hash
end