Class: VShipping::Ahamove

Inherits:
Object
  • Object
show all
Extended by:
ActiveSupport::Concern
Includes:
HTTParty
Defined in:
lib/v_shipping/ahamove.rb

Instance Method Summary collapse

Constructor Details

#initialize(api_key, config_url) ⇒ Ahamove

Returns a new instance of Ahamove.



8
9
10
11
# File 'lib/v_shipping/ahamove.rb', line 8

def initialize(api_key, config_url)
  @api_key = api_key
  @config = load_yaml(config_url)
end

Instance Method Details

#cancel_order(params) ⇒ Object



42
43
44
# File 'lib/v_shipping/ahamove.rb', line 42

def cancel_order(params)
  get('cancel_order_endpoint', params)
end

#create_order(params) ⇒ Object



22
23
24
# File 'lib/v_shipping/ahamove.rb', line 22

def create_order(params)
  get('create_order_endpoint', params)
end

#notify_supplier(params) ⇒ Object



58
59
60
# File 'lib/v_shipping/ahamove.rb', line 58

def notify_supplier(params)
  get('notify_supplier_endpoint', params)
end

#order_statusesObject



62
63
64
65
66
67
68
69
70
71
# File 'lib/v_shipping/ahamove.rb', line 62

def order_statuses
  [
    mapping_status('IDLE', 'confirmed'),
    mapping_status('ASSIGNING', 'assigning'),
    mapping_status('ACCEPTED', 'accepted'),
    mapping_status('IN PROCESS', 'in_progress'),
    mapping_status('COMPLETED', 'completed'),
    mapping_status('CANCELLED', 'cancelled')
  ]
end

#retrieved_city(params) ⇒ Object



46
47
48
# File 'lib/v_shipping/ahamove.rb', line 46

def retrieved_city(params)
  get('city_endpoint', params)
end

#retrieved_fee(params) ⇒ Object



34
35
36
# File 'lib/v_shipping/ahamove.rb', line 34

def retrieved_fee(params)
  get('order_fee_endpoint', params)
end

#retrieved_fees(body) ⇒ Object



38
39
40
# File 'lib/v_shipping/ahamove.rb', line 38

def retrieved_fees(body)
  post('orders_fee_endpoint', body)
end

#retrieved_order(params) ⇒ Object



30
31
32
# File 'lib/v_shipping/ahamove.rb', line 30

def retrieved_order(params)
  get('order_endpoint', params)
end

#retrieved_orders(params) ⇒ Object



26
27
28
# File 'lib/v_shipping/ahamove.rb', line 26

def retrieved_orders(params)
  get('orders_endpoint', params)
end

#retrieved_services(params) ⇒ Object



50
51
52
# File 'lib/v_shipping/ahamove.rb', line 50

def retrieved_services(params)
  get('services_endpoint', params)
end

#retrieved_token(params) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/v_shipping/ahamove.rb', line 13

def retrieved_token(params)
  get(
    'register_endpoint',
    params.merge({
      api_key: api_key
    })
  )
end


54
55
56
# File 'lib/v_shipping/ahamove.rb', line 54

def retrieved_tracking_link(params)
  get('order_tracking_endpoint', params)
end