Class: NovaPoshtaApi::Request
- Defined in:
- lib/nova_poshta_api/request.rb
Constant Summary collapse
- AVAILABLE_API_CALLS =
{ cities: {model: 'Address', method: 'getCities'}, find_city: {model: 'Address', method: 'getCities', args: ['FindByString']}, settlements: {model: 'AddressGeneral', method: 'getSettlements', args: ['Page']}, areas: {model: 'Address', method: 'getAreas'}, warehouses: {model: 'Address', method: 'getWarehouses'}, warehouse_types: {model: 'Address', method: 'getWarehouseTypes'}, street: {model: 'Address', method: 'getStreet', args: ['CityRef']}, find_street: {model: 'Address', method: 'getStreet', args: ['CityRef', 'FindByString']}, service_types: {model: 'Common', method: 'getServiceTypes'} }
Class Method Summary collapse
Methods inherited from Base
class_attr_accessor, make_body, post_request
Class Method Details
.method_missing(meth, *args) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/nova_poshta_api/request.rb', line 15 def self.method_missing meth, *args super unless AVAILABLE_API_CALLS.key?(meth) params = AVAILABLE_API_CALLS[meth] arguments = (params[:args] || []).zip(args).to_h body_of_query = make_body params[:model], params[:method], arguments post_request body_of_query end |