Sha256: 0656266bf7de8a8619afcf8b60a19130900a6954e312519ced053d870e7e07c3

Contents?: true

Size: 690 Bytes

Versions: 2

Compression:

Stored size: 690 Bytes

Contents

# 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
#
class CreateResponse < Struct.new(:postKey, :error) do
    def post_key
      postKey
    end
  end

  # Method +from_array+ creates an array of CreateResponse objects from a given
  # array of JSON hashes.
  def self.from_array(array)
    array.collect do |element|
      CreateResponse.new(element)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
threetaps-client-1.0.0 lib/dto/posting/create_response.rb
threetaps-client-0.5.1 lib/dto/posting/create_response.rb