Class: CreateResponse

Inherits:
Struct
  • Object
show all
Defined in:
lib/dto/posting/create_response.rb

Overview

Class CreateResponse represents server response on create Posting API request. Server response is sent to from_array method which creates objects with attributes postKey, error accessible via getters:

response = RangeResponse.from_array(...)
response.postKey     # => String
response.post_key    # => String
response.error       # => String

Instance Attribute Summary collapse

Class Method Summary collapse

Methods inherited from Struct

from_hash

Instance Attribute Details

#errorObject

Returns the value of attribute error

Returns:

  • (Object)

    the current value of error



10
11
12
# File 'lib/dto/posting/create_response.rb', line 10

def error
  @error
end

#errorsObject

Returns the value of attribute errors

Returns:

  • (Object)

    the current value of errors



10
11
12
# File 'lib/dto/posting/create_response.rb', line 10

def errors
  @errors
end

#postKeyObject

Returns the value of attribute postKey

Returns:

  • (Object)

    the current value of postKey



10
11
12
# File 'lib/dto/posting/create_response.rb', line 10

def postKey
  @postKey
end

Class Method Details

.from_array(array) ⇒ Object

Method from_array creates an array of CreateResponse objects from a given array of JSON hashes.



18
19
20
21
22
# File 'lib/dto/posting/create_response.rb', line 18

def self.from_array(array)
  array.collect do |element|
    CreateResponse.from_hash(element)
  end
end