Class: Shirtsio::Quote
Overview
Provides an exact quote before placing an order.
Class Method Summary collapse
-
.create(&block) ⇒ Object
Get a quote for specified garments.
Methods inherited from Endpoint
#initialize, #method_missing, #respond_to?
Constructor Details
This class inherits a constructor from Shirtsio::Endpoint
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Shirtsio::Endpoint
Class Method Details
.create(&block) ⇒ Object
Note:
See documentation provided by shirts.io for a thorough description of all parameters supported by this endpoint.
Get a quote for specified garments.
This method specifies a DSL for building the parameters necessary for retrieving a quote.
Example:
Shirtsio::Quote.create do |quote|
quote.garment do |garment|
garment.product_id 1
garment.color 'Grey'
garment.sizes do |size|
size.med 1
end
end
quote.print do |print|
print.front do |front|
front.color_count 1
front.colors ['Black']
end
end
quote.ship_type 'Rush'
end
30 31 32 33 |
# File 'lib/shirtsio/quote.rb', line 30 def self.create(&block) query = Shirtsio::DSL::QueryBuilder.new(Shirtsio::DSL::QUOTE, :garment, &block).to_hash new(Shirtsio.get('/quote/', query)) end |