Sha256: b38dea243cdbbfea2509caa8da1e20963013ee909cc79fbd7e3185e4757e9e77

Contents?: true

Size: 705 Bytes

Versions: 8

Compression:

Stored size: 705 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, :errors) 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

8 entries across 8 versions & 1 rubygems

Version Path
threetaps-client-1.0.14 lib/dto/posting/create_response.rb
threetaps-client-1.0.13 lib/dto/posting/create_response.rb
threetaps-client-1.0.12 lib/dto/posting/create_response.rb
threetaps-client-1.0.11 lib/dto/posting/create_response.rb
threetaps-client-1.0.10 lib/dto/posting/create_response.rb
threetaps-client-1.0.9 lib/dto/posting/create_response.rb
threetaps-client-1.0.8 lib/dto/posting/create_response.rb
threetaps-client-1.0.7 lib/dto/posting/create_response.rb