Class: ShipEngine::Domain::ServicePoints

Inherits:
Object
  • Object
show all
Defined in:
lib/shipengine/domains/service_points.rb

Instance Method Summary collapse

Constructor Details

#initializeServicePoints

Returns a new instance of ServicePoints.



8
9
10
# File 'lib/shipengine/domains/service_points.rb', line 8

def initialize
  @client = ShipEngine::Client.new
end

Instance Method Details

#list_service_points(params: {}) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/shipengine/domains/service_points.rb', line 12

def list_service_points(params: {})
  response = @client.post(
    path: "#{ShipEngine::Constants::PATHS.v1.service_points.root}/list",
    options: params
  )

  Hashie::Mash.new(response.body)
end

#service_point_by_id(carrier_code:, country_code:, service_point_id:, params: {}) ⇒ Object



21
22
23
24
25
26
27
28
# File 'lib/shipengine/domains/service_points.rb', line 21

def service_point_by_id(carrier_code:, country_code:, service_point_id:, params: {})
  response = @client.get(
    path: "#{ShipEngine::Constants::PATHS.v1.service_points.root}/#{carrier_code}/#{country_code}/#{service_point_id}",
    options: params
  )

  Hashie::Mash.new(response.body)
end