Sha256: e17f44dba5d0b09400ea7f64d8faa8d64c1f870f4e31626d1ab2dae063e4f0d7

Contents?: true

Size: 1.36 KB

Versions: 6

Compression:

Stored size: 1.36 KB

Contents

class EasyPost::Batch < EasyPost::Resource
  def self.create_and_buy(params={}, api_key=nil)
    wrapped_params = {}
    wrapped_params[self.class_name().to_sym] = params
    response = EasyPost.make_request(:post, url + '/create_and_buy', api_key, wrapped_params)

    return EasyPost::Util.convert_to_easypost_object(response, api_key)
  end

  def buy(params={})
    response = EasyPost.make_request(:post, url + '/buy', @api_key, params)
    self.refresh_from(response, @api_key, true)

    return self
  end

  def label(params={})
    response = EasyPost.make_request(:post, url + '/label', @api_key, params)
    self.refresh_from(response, @api_key, true)

    return self
  end

  def remove_shipments(params={})
    response = EasyPost.make_request(:post, url + '/remove_shipments', @api_key, params)
    self.refresh_from(response, @api_key, true)

    return self
  end

  def add_shipments(params={})
    response = EasyPost.make_request(:post, url + '/add_shipments', @api_key, params)
    self.refresh_from(response, @api_key, true)

    return self
  end

  def stamp_and_barcode_by_reference(params={})
    response = EasyPost.make_request(:get, url + '/stamp_and_barcode_by_reference', @api_key, params)

    return response
  end

  def create_scan_form(params={})
    response = EasyPost.make_request(:post, url + '/scan_form', @api_key, params)

    return response
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
easypost-3.5.1 lib/easypost/batch.rb
easypost-3.5.0 lib/easypost/batch.rb
easypost-3.4.0 lib/easypost/batch.rb
easypost-3.3.0 lib/easypost/batch.rb
easypost-3.2.0 lib/easypost/batch.rb
easypost-3.1.5 lib/easypost/batch.rb