Class: Buzz::Resources::Reporting
- Inherits:
-
Object
- Object
- Buzz::Resources::Reporting
- Defined in:
- lib/buzz/resources/reporting.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
- #create(attributes = {}) ⇒ Object
- #delete(id) ⇒ Object
- #find(id) ⇒ Object
-
#initialize(client) ⇒ Reporting
constructor
A new instance of Reporting.
-
#list(params = {}) ⇒ Object
CRUD on saved report definitions.
-
#query(dimensions: [], metrics: [], **params) ⇒ Object
Query performance data (spend, impressions, clicks, etc.).
Constructor Details
#initialize(client) ⇒ Reporting
Returns a new instance of Reporting.
8 9 10 |
# File 'lib/buzz/resources/reporting.rb', line 8 def initialize(client) @client = client end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
6 7 8 |
# File 'lib/buzz/resources/reporting.rb', line 6 def client @client end |
Instance Method Details
#create(attributes = {}) ⇒ Object
28 29 30 |
# File 'lib/buzz/resources/reporting.rb', line 28 def create(attributes = {}) client.post("/rest/v2/reports", attributes).data end |
#delete(id) ⇒ Object
32 33 34 |
# File 'lib/buzz/resources/reporting.rb', line 32 def delete(id) client.delete("/rest/v2/reports/#{id}").data end |
#find(id) ⇒ Object
24 25 26 |
# File 'lib/buzz/resources/reporting.rb', line 24 def find(id) client.get("/rest/v2/reports/#{id}").data end |
#list(params = {}) ⇒ Object
CRUD on saved report definitions
20 21 22 |
# File 'lib/buzz/resources/reporting.rb', line 20 def list(params = {}) Paginator.new(client, "/rest/v2/reports", params) end |
#query(dimensions: [], metrics: [], **params) ⇒ Object
Query performance data (spend, impressions, clicks, etc.)
13 14 15 16 17 |
# File 'lib/buzz/resources/reporting.rb', line 13 def query(dimensions: [], metrics: [], **params) body = { dimensions: dimensions, metrics: metrics }.merge(params) response = client.post("/rest/v2/report-data", body) response.data["results"] end |