Sha256: 2e7855a77a7aca434b0c1119e744a9f2f05641763e4277f80e6c5e8e70067c90

Contents?: true

Size: 696 Bytes

Versions: 6

Compression:

Stored size: 696 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.from_hash(element)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
threetaps-client-1.0.6 lib/dto/posting/create_response.rb
threetaps-client-1.0.5 lib/dto/posting/create_response.rb
threetaps-client-1.0.4 lib/dto/posting/create_response.rb
threetaps-client-1.0.3 lib/dto/posting/create_response.rb
threetaps-client-1.0.2 lib/dto/posting/create_response.rb
threetaps-client-1.0.1 lib/dto/posting/create_response.rb