Class: Spaceship::AnalyticsClient
- Inherits:
-
Client
- Object
- Client
- Spaceship::AnalyticsClient
- Defined in:
- lib/analytics/client.rb
Overview
This class is used to upload Digital files (Images, Videos, JSON files) onto the du-itc service.
Its implementation is tied to the tunes module (in particular using AppVersion instances)
Init and Login collapse
- .hostname ⇒ Object
- #get_data(id, start_time = Date.today - 30.day, end_time = Date.today) ⇒ Object
- #send_login_request(user, password) ⇒ Object
Class Method Details
.hostname ⇒ Object
9 10 11 |
# File 'lib/analytics/client.rb', line 9 def self.hostname "https://analytics.itunes.apple.com/" end |
Instance Method Details
#get_data(id, start_time = Date.today - 30.day, end_time = Date.today) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/analytics/client.rb', line 13 def get_data(id, start_time = Date.today - 30.day, end_time = Date.today) start_time = start_time.strftime('%Y-%m-%dT%H:%M:%SZ') end_time = end_time.strftime('%Y-%m-%dT%H:%M:%SZ') ids = [id] body = { "adamId": ids, "frequency": "DAY", "measures": ["pageViewCount"], "group": nil, "dimensionFilters": [], "startTime": start_time, "endTime": end_time } response = request(:post) do |req| req.url "analytics/api/v1/data/time-series" req.body = body.to_json req.headers['Content-Type'] = 'application/json' req.headers['Cookie'] = req.headers['Host'] = 'analytics.itunes.apple.com' req.headers['Origin'] = 'https://analytics.itunes.apple.com' req.headers['Referer'] = 'https://analytics.itunes.apple.com/' req.headers['X-Requested-By'] = 'analytics.itunes.apple.com' end response.body end |
#send_login_request(user, password) ⇒ Object
43 44 45 |
# File 'lib/analytics/client.rb', line 43 def send_login_request(user, password) send_shared_login_request(user, password) end |