Class: Postmen::ManifestCollection

Inherits:
Object
  • Object
show all
Includes:
CollectionProxy
Defined in:
lib/postmen/manifest_collection.rb

Overview

This class wraps the array of Manifest models

Class Method Summary collapse

Methods included from CollectionProxy

included, #initialize

Class Method Details

.all(options = {}) ⇒ Object

Fetch all manifests.

Examples:

.all # Returns all manisfests, default query.
.all(status: :failed) # Returns only failed manifests

Parameters:

  • options (Hash) (defaults to: {})

    Options for the query.

See Also:



16
17
18
# File 'lib/postmen/manifest_collection.rb', line 16

def self.all(options = {})
  new(Connection.new.get('/manifests', ManifestQuery.new(options).to_query).parsed_response)
end

.create(params) ⇒ Rate

Creates a Manifest

Parameters:

  • params (Hash)

    Manifest params

Returns:

See Also:



35
36
37
# File 'lib/postmen/manifest_collection.rb', line 35

def self.create(params)
  Manifest.new(Connection.new.post('/manifests', CreateManifestQuery.new(params).to_query).parsed_response[:data])
end

.find(id) ⇒ Manifest

Fetch single manifest

Parameters:

  • id (UUID)

    Manifest UUID

Returns:

Raises:

  • ResourceNotFound if Manifest with given id was not found

See Also:



26
27
28
# File 'lib/postmen/manifest_collection.rb', line 26

def self.find(id)
  get(Connection.new.get("/manifests/#{id}").parsed_response)
end