Sha256: c62a3b41c30655208c747d1c1e20e9595244c515c08fb2d572c86e300701e9ae

Contents?: true

Size: 593 Bytes

Versions: 7

Compression:

Stored size: 593 Bytes

Contents

# frozen_string_literal: true

class EasyPost::Services::Parcel < EasyPost::Services::Service
  MODEL_CLASS = EasyPost::Models::Parcel

  # Create a Parcel object
  def create(params = {})
    wrapped_params = { parcel: params }
    response = @client.make_request(:post, 'parcels', wrapped_params)

    EasyPost::InternalUtilities::Json.convert_json_to_object(response, MODEL_CLASS)
  end

  # Retrieve a Parcel object
  def retrieve(id)
    response = @client.make_request(:get, "parcels/#{id}")

    EasyPost::InternalUtilities::Json.convert_json_to_object(response, MODEL_CLASS)
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
easypost-6.4.1 lib/easypost/services/parcel.rb
easypost-6.4.0 lib/easypost/services/parcel.rb
easypost-6.3.0 lib/easypost/services/parcel.rb
easypost-6.2.0 lib/easypost/services/parcel.rb
easypost-6.1.1 lib/easypost/services/parcel.rb
easypost-6.1.0 lib/easypost/services/parcel.rb
easypost-6.0.0 lib/easypost/services/parcel.rb