Class: ShipHero::Services::OrderService

Inherits:
BaseService show all
Defined in:
lib/ship_hero/services/order_service.rb

Instance Attribute Summary

Attributes inherited from BaseService

#api_key

Instance Method Summary collapse

Methods inherited from BaseService

#initialize

Constructor Details

This class inherits a constructor from ShipHero::Services::BaseService

Instance Method Details

#create_order(request) ⇒ Object



20
21
22
23
# File 'lib/ship_hero/services/order_service.rb', line 20

def create_order(request)
  raise Exceptions::ServiceException, "Must be a ShipHero::Order" unless request.is_a?(ShipHero::Order)
  post(Util::Config.get('endpoints.create_order'), request, nil, ShipHero::Responses::CreateOrder)
end

#create_order_history(request) ⇒ Object



30
31
32
33
# File 'lib/ship_hero/services/order_service.rb', line 30

def create_order_history(request)
  raise Exceptions::ServiceException, "Must be a ShipHero::OrderHistory" unless request.is_a?(ShipHero::OrderHistory)
  post(Util::Config.get('endpoints.create_order_history'), request)
end

#get_order(request = ShipHero::Requests::GetOrder.new) ⇒ Object



15
16
17
18
# File 'lib/ship_hero/services/order_service.rb', line 15

def get_order(request = ShipHero::Requests::GetOrder.new)
  raise Exceptions::ServiceException, "Must be a ShipHero::Requests::GetOrder" unless request.is_a?(ShipHero::Requests::GetOrder)
  get(Util::Config.get('endpoints.get_order'), request, ShipHero::Responses::GetOrder)
end

#get_orders(request = ShipHero::Requests::GetOrders.new) ⇒ Object



10
11
12
13
# File 'lib/ship_hero/services/order_service.rb', line 10

def get_orders(request = ShipHero::Requests::GetOrders.new)
  raise Exceptions::ServiceException, "Must be a ShipHero::Requests::GetOrders" unless request.is_a?(ShipHero::Requests::GetOrders)
  get(Util::Config.get('endpoints.get_orders'), request, ShipHero::Responses::GetOrder)
end

#update_order(request) ⇒ Object



25
26
27
28
# File 'lib/ship_hero/services/order_service.rb', line 25

def update_order(request)
  raise Exceptions::ServiceException, "Must be a ShipHero::Order" unless request.is_a?(ShipHero::Order)
  post(Util::Config.get('endpoints.update_order'), request)
end