Sha256: 219005618f78cb9d20cc2074d7764ed7896456d5239bad351a82acff3163f651

Contents?: true

Size: 1.45 KB

Versions: 27

Compression:

Stored size: 1.45 KB

Contents

module EasyPost
  class Batch < Resource

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

      return Util.convert_to_easypost_object(response, api_key)
    end

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

      return self
    end

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

      return self
    end

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

      return self
    end

    def add_shipments(params={})
      response, api_key = EasyPost.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, api_key = EasyPost.request(:get, url + '/stamp_and_barcode_by_reference', @api_key, params)

      return response
    end

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

      return response
    end

  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
easypost-3.0.1 lib/easypost/batch.rb
easypost-3.0.0 lib/easypost/batch.rb
easypost-2.7.3 lib/easypost/batch.rb
easypost-2.7.2 lib/easypost/batch.rb
easypost-2.7.1 lib/easypost/batch.rb
easypost-2.7.0 lib/easypost/batch.rb
easypost-2.6.2 lib/easypost/batch.rb
easypost-2.6.1 lib/easypost/batch.rb
easypost-2.6.0 lib/easypost/batch.rb
easypost-2.5.0 lib/easypost/batch.rb
easypost-2.4.0 lib/easypost/batch.rb
easypost-2.3.0 lib/easypost/batch.rb
easypost-2.2.0 lib/easypost/batch.rb
easypost-2.1.11 lib/easypost/batch.rb
easypost-2.1.10 lib/easypost/batch.rb
easypost-2.1.9 lib/easypost/batch.rb
easypost-2.1.8 lib/easypost/batch.rb
easypost-2.1.7 lib/easypost/batch.rb
easypost-2.1.6 lib/easypost/batch.rb
easypost-2.1.5 lib/easypost/batch.rb