Class: PBShipping::Carrier
- Inherits:
-
ShippingApiResource
- Object
- ApiObject
- ApiResource
- ShippingApiResource
- PBShipping::Carrier
- Defined in:
- lib/pbshipping/carrier.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#getCountries(auth_obj, originCountryCode) ⇒ Object
COUNTRIES LIST API: GET /countries API signature: get/countries.
Methods inherited from ApiObject
#[], #[]=, #add_accessors, #as_json, convert_to_api_object, #create_accessor, #each, #initialize, #inspect, #key?, #keys, #metaclass, #respond_to?, #to_hash, #to_json, #to_s, #update, #values
Constructor Details
This class inherits a constructor from PBShipping::ApiObject
Class Method Details
Instance Method Details
#getCountries(auth_obj, originCountryCode) ⇒ Object
COUNTRIES LIST API: GET /countries API signature: get/countries
Returns a list of supported destination countries to which the carrier offers international shipping services.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/pbshipping/carrier.rb', line 30 def getCountries(auth_obj, originCountryCode) if self.key?(:name) == false raise MissingResourceAttribute.new(:name) end params = { "carrier" => self[:name], "originCountryCode" => originCountryCode } api_sig = "get/countries" api_version = PBShipping::get_api_version(api_sig) api_path = "/countries" json_resp = PBShipping.api_request(auth_obj, :get, api_version, api_path, {}, params, {}) country_list = [] json_resp.each { |country| country_list << Country.new(country) } return country_list end |