Class: Postmen::RateCollection
- Inherits:
-
Object
- Object
- Postmen::RateCollection
- Includes:
- CollectionProxy
- Defined in:
- lib/postmen/rate_collection.rb
Overview
This class wraps the array of Rate models
Class Method Summary collapse
-
.all(options = {}) ⇒ Object
Fetch all rates.
-
.create(params) ⇒ Rate
Creates a Rate.
-
.find(id) ⇒ Rate
Fetch single rate.
Methods included from CollectionProxy
Class Method Details
.all(options = {}) ⇒ Object
Fetch all rates.
16 17 18 |
# File 'lib/postmen/rate_collection.rb', line 16 def self.all( = {}) new(Connection.new.get('/rates', RateQuery.new().to_query).parsed_response) end |
.create(params) ⇒ Rate
Creates a Rate
35 36 37 |
# File 'lib/postmen/rate_collection.rb', line 35 def self.create(params) Rate.new(Connection.new.post('/rates', CreateRateQuery.new(params).to_query).parsed_response[:data]) end |
.find(id) ⇒ Rate
Fetch single rate
26 27 28 |
# File 'lib/postmen/rate_collection.rb', line 26 def self.find(id) get(Connection.new.get("/rates/#{id}").parsed_response) end |