Class: Sendle::Api::Quote
Instance Method Summary
collapse
included, #index
Methods inherited from Resource
#method_missing, #process_create_response, #process_destroy_response, #process_index_response, #process_show_response, url, #validate_create_request!
#request
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Sendle::Api::Resource
Instance Method Details
#include_credentials? ⇒ Boolean
12
13
14
|
# File 'lib/sendle/api/quote.rb', line 12
def include_credentials?
false
end
|
#url ⇒ Object
8
9
10
|
# File 'lib/sendle/api/quote.rb', line 8
def url
Sendle::Api.base_url + "quote"
end
|
#validate_index_request!(params) ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/sendle/api/quote.rb', line 16
def validate_index_request!(params)
required = %w( pickup_suburb pickup_postcode delivery_suburb delivery_postcode kilogram_weight)
validate_presence_of!(required, params)
if params[:plan_name]
plan_name = params[:plan_name]
raise Sendle::Api::Errors::InvalidPlan.new(plan_name) unless Sendle::Api::PLANS.include?(plan_name)
end
end
|