Class: ShipEngine::Domain::PackageTypes

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

Instance Method Summary collapse

Constructor Details

#initializePackageTypes

Returns a new instance of PackageTypes.



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

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

Instance Method Details

#create_custom_package_types(params: {}) ⇒ Object



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

def create_custom_package_types(params: {})
  response = @client.post(
    path: ShipEngine::Constants::PATHS.v1.package_types.root,
    options: params
  )

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

#custom_package_types_by_id(package_id:, params: {}) ⇒ Object



30
31
32
33
34
35
36
37
# File 'lib/shipengine/domains/package_types.rb', line 30

def custom_package_types_by_id(package_id:, params: {})
  response = @client.get(
    path: "#{ShipEngine::Constants::PATHS.v1.package_types.root}/#{package_id}",
    options: params
  )

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

#delete_custom_package_types_by_id(package_id:, params: {}) ⇒ Object



48
49
50
51
52
53
54
55
# File 'lib/shipengine/domains/package_types.rb', line 48

def delete_custom_package_types_by_id(package_id:, params: {})
  response = @client.delete(
    path: "#{ShipEngine::Constants::PATHS.v1.package_types.root}/#{package_id}",
    options: params
  )

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

#list_custom_package_types(params: {}) ⇒ Object



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

def list_custom_package_types(params: {})
  response = @client.get(
    path: ShipEngine::Constants::PATHS.v1.package_types.root,
    options: params
  )

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

#update_custom_package_types_by_id(package_id:, params: {}) ⇒ Object



39
40
41
42
43
44
45
46
# File 'lib/shipengine/domains/package_types.rb', line 39

def update_custom_package_types_by_id(package_id:, params: {})
  response = @client.put(
    path: "#{ShipEngine::Constants::PATHS.v1.package_types.root}/#{package_id}",
    options: params
  )

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