Class: Adcloud::Report
Class Attribute Summary collapse
-
.api_endpoint ⇒ Object
Returns the value of attribute api_endpoint.
-
.connection ⇒ Object
Returns the value of attribute connection.
Class Method Summary collapse
Class Attribute Details
.api_endpoint ⇒ Object
Returns the value of attribute api_endpoint.
9 10 11 |
# File 'lib/adcloud/report.rb', line 9 def api_endpoint @api_endpoint end |
.connection ⇒ Object
Returns the value of attribute connection.
9 10 11 |
# File 'lib/adcloud/report.rb', line 9 def connection @connection end |
Class Method Details
.find_all_by_date(date) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/adcloud/report.rb', line 16 def find_all_by_date(date) paged_items = [] page = 0 total_pages = 1 retry_count = 0 page_result = nil begin begin page += 1 raw_result = connection.get(self.api_endpoint, { filter: { date: date.to_s }, :page => page, :per_page => Entity::MAX_PER_PAGE, new_backend: true }) total_pages = raw_result['_meta']['total_pages'] page_result = self.new(raw_result) paged_items += page_result.items rescue => ex retry if retry_count < 5 end end while page < total_pages page_result.items = paged_items page_result end |
.find_by_date(date) ⇒ Object
11 12 13 14 |
# File 'lib/adcloud/report.rb', line 11 def find_by_date(date) result = connection.get(self.api_endpoint, { filter: { date: date.to_s }, new_backend: true }) return self.new(result) end |