Module: CityboxApi
- Defined in:
- lib/citybox_api.rb,
lib/citybox_api/tariff.rb,
lib/citybox_api/regions.rb,
lib/citybox_api/version.rb,
lib/citybox_api/take_ups.rb,
lib/citybox_api/shipments.rb,
lib/citybox_api/utilities.rb,
lib/citybox_api/configuration.rb,
lib/citybox_api/branch_offices.rb
Defined Under Namespace
Classes: BranchOffices, Configuration, Regions, Shipments, TakeUps, Tariff, Utilities
Constant Summary collapse
- INVALID_CREDENTIALS =
Credentials for API
"Key cant be blank!"- VERSION =
"0.9.0"
Class Attribute Summary collapse
-
.configuration ⇒ Object
Returns the value of attribute configuration.
Class Method Summary collapse
- .catch_error(error) ⇒ Object
- .check_params(params, opts) ⇒ Object
- .configure {|configuration| ... } ⇒ Object
Class Attribute Details
.configuration ⇒ Object
Returns the value of attribute configuration.
12 13 14 |
# File 'lib/citybox_api/configuration.rb', line 12 def configuration @configuration end |
Class Method Details
.catch_error(error) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/citybox_api.rb', line 18 def self.catch_error error puts error json_response = Crack::XML.parse(error.response) fault_code = json_response["soap:Envelope"]["soap:Body"]["soap:Fault"]["faultcode"] fault_string = json_response["soap:Envelope"]["soap:Body"]["soap:Fault"]["faultstring"] fault = {faultCode: fault_code, fault_string: fault_string} puts fault return nil end |
.check_params(params, opts) ⇒ Object
28 29 30 |
# File 'lib/citybox_api.rb', line 28 def self.check_params params, opts params.each{|p| raise "#{p} can't be blank" unless opts[p]} end |
.configure {|configuration| ... } ⇒ Object
15 16 17 18 |
# File 'lib/citybox_api/configuration.rb', line 15 def self.configure self.configuration ||= Configuration.new yield(configuration) if block_given? end |