Class: EasyPost::Report
- Inherits:
-
Resource
- Object
- EasyPostObject
- Resource
- EasyPost::Report
- Defined in:
- lib/easypost/report.rb
Overview
A Report contains a csv that is a log of all the objects created within a certain time frame.
Instance Attribute Summary
Attributes inherited from EasyPostObject
#api_key, #name, #parent, #unsaved_values
Class Method Summary collapse
-
.all(filters = {}, api_key = nil) ⇒ Object
Retrieve a list of Report objects.
-
.create(params = {}, api_key = nil) ⇒ Object
Create a Report.
Methods inherited from Resource
class_name, #delete, each, #refresh, retrieve, #save, url, #url
Methods inherited from EasyPostObject
#[], #[]=, #as_json, construct_from, #deconstruct_keys, #each, #id, #id=, #initialize, #inspect, #keys, #refresh_from, #to_hash, #to_json, #to_s, #values
Constructor Details
This class inherits a constructor from EasyPost::EasyPostObject
Class Method Details
.all(filters = {}, api_key = nil) ⇒ Object
Retrieve a list of Report objects.
17 18 19 20 21 22 |
# File 'lib/easypost/report.rb', line 17 def self.all(filters = {}, api_key = nil) url = "#{self.url}/#{filters[:type]}" response = EasyPost.make_request(:get, url, api_key, filters) EasyPost::Util.convert_to_easypost_object(response, api_key) end |
.create(params = {}, api_key = nil) ⇒ Object
Create a Report.
6 7 8 9 10 11 12 13 14 |
# File 'lib/easypost/report.rb', line 6 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) EasyPost::Util.convert_to_easypost_object(response, api_key) end |