Sha256: a8af8a710d7ee18d74530b5a592f8de555a8ad73375c1e73daea058ac84d38b6

Contents?: true

Size: 796 Bytes

Versions: 6

Compression:

Stored size: 796 Bytes

Contents

class EasyPost::Report < EasyPost::Resource
  def self.create(params={}, api_key=nil)
    url = "#{self.url}/#{params[:type]}"
    wrapped_params = {}
    wrapped_params[class_name.to_sym] = params

    response = EasyPost.make_request(:post, url, api_key, params)
    return EasyPost::Util.convert_to_easypost_object(response, api_key)
  end

  def self.retrieve(params, api_key=nil)
    id = if params.is_a?(String)
      params
    else
      params[:id]
    end

    instance = self.new(id, api_key)
    instance.refresh
    return instance
  end

  def self.all(filters={}, api_key=nil)
    url = "#{self.url}/#{filters[:type]}"

    response = EasyPost.make_request(:get, url, api_key, filters)
    return EasyPost::Util::convert_to_easypost_object(response, api_key) if response
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

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