class EasyPost::Report

Public Class Methods

all(filters={}, api_key=nil) click to toggle source
# File lib/easypost/report.rb, line 23
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
create(params={}, api_key=nil) click to toggle source
# File lib/easypost/report.rb, line 2
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
retrieve(params, api_key=nil) click to toggle source
# File lib/easypost/report.rb, line 11
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