Class: SuggestGrid::BulkPostResponse
- Defined in:
- lib/suggestgrid/models/bulk_post_response.rb
Overview
Bulk error response. Returned on all bulk post requests regardless of the number of erroneous or successful posts.
Instance Attribute Summary collapse
-
#errors ⇒ List of BulkPostError
Message of the response.
-
#message ⇒ String
Message of the response.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
Instance Method Summary collapse
-
#initialize(message = nil, errors = nil) ⇒ BulkPostResponse
constructor
A new instance of BulkPostResponse.
Methods inherited from BaseModel
Constructor Details
#initialize(message = nil, errors = nil) ⇒ BulkPostResponse
Returns a new instance of BulkPostResponse.
24 25 26 27 28 |
# File 'lib/suggestgrid/models/bulk_post_response.rb', line 24 def initialize( = nil, errors = nil) = @errors = errors end |
Instance Attribute Details
#errors ⇒ List of BulkPostError
Message of the response.
14 15 16 |
# File 'lib/suggestgrid/models/bulk_post_response.rb', line 14 def errors @errors end |
#message ⇒ String
Message of the response.
10 11 12 |
# File 'lib/suggestgrid/models/bulk_post_response.rb', line 10 def end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/suggestgrid/models/bulk_post_response.rb', line 31 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. = hash['message'] # Parameter is an array, so we need to iterate through it errors = nil unless hash['errors'].nil? errors = [] hash['errors'].each do |structure| errors << (BulkPostError.from_hash(structure) if structure) end end # Create object from extracted values. BulkPostResponse.new(, errors) end |
.names ⇒ Object
A mapping from model property names to API property names.
17 18 19 20 21 22 |
# File 'lib/suggestgrid/models/bulk_post_response.rb', line 17 def self.names @_hash = {} if @_hash.nil? @_hash['message'] = 'message' @_hash['errors'] = 'errors' @_hash end |