Class: Spaceship::Tunes::AppAnalytics

Inherits:
TunesBase show all
Defined in:
spaceship/lib/spaceship/tunes/app_analytics.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#client, #raw_data

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from TunesBase

client

Methods inherited from Base

attr_accessor, attr_mapping, attributes, #attributes, #initialize, #inspect, mapping_module, method_missing, set_client, #setup, #to_s

Constructor Details

This class inherits a constructor from Spaceship::Base

Instance Attribute Details

#apple_idInteger

Returns The app ID to grab analytics for.

Returns:

  • (Integer)

    The app ID to grab analytics for


7
8
9
# File 'spaceship/lib/spaceship/tunes/app_analytics.rb', line 7

def apple_id
  @apple_id
end

Class Method Details

.factory(attrs) ⇒ Object


10
11
12
# File 'spaceship/lib/spaceship/tunes/app_analytics.rb', line 10

def factory(attrs)
  return self.new(attrs)
end

Instance Method Details

#app_active_devicesObject


57
58
59
60
61
# File 'spaceship/lib/spaceship/tunes/app_analytics.rb', line 57

def app_active_devices
  start_t, end_t = time_last_7_days

  app_active_devices_interval(start_t, end_t)
end

#app_active_devices_interval(start_t, end_t, view_by = nil) ⇒ Object


107
108
109
# File 'spaceship/lib/spaceship/tunes/app_analytics.rb', line 107

def app_active_devices_interval(start_t, end_t, view_by = nil)
  client.time_series_analytics([apple_id], ['activeDevices'], start_t, end_t, "DAY", view_by)
end

#app_active_last_30_daysObject


63
64
65
66
67
# File 'spaceship/lib/spaceship/tunes/app_analytics.rb', line 63

def app_active_last_30_days
  start_t, end_t = time_last_7_days

  app_active_last_30_days_interval(start_t, end_t)
end

#app_active_last_30_days_interval(start_t, end_t, view_by = nil) ⇒ Object


111
112
113
# File 'spaceship/lib/spaceship/tunes/app_analytics.rb', line 111

def app_active_last_30_days_interval(start_t, end_t, view_by = nil)
  client.time_series_analytics([apple_id], ['rollingActiveDevices'], start_t, end_t, "DAY", view_by)
end

#app_crashesObject


69
70
71
72
73
# File 'spaceship/lib/spaceship/tunes/app_analytics.rb', line 69

def app_crashes
  start_t, end_t = time_last_7_days

  app_crashes_interval(start_t, end_t)
end

#app_crashes_interval(start_t, end_t, view_by = nil) ⇒ Object


115
116
117
# File 'spaceship/lib/spaceship/tunes/app_analytics.rb', line 115

def app_crashes_interval(start_t, end_t, view_by = nil)
  client.time_series_analytics([apple_id], ['crashes'], start_t, end_t, "DAY", view_by)
end

#app_in_app_purchasesObject


27
28
29
30
31
# File 'spaceship/lib/spaceship/tunes/app_analytics.rb', line 27

def app_in_app_purchases
  start_t, end_t = time_last_7_days

  app_in_app_purchases_interval(start_t, end_t)
end

#app_in_app_purchases_interval(start_t, end_t, view_by = nil) ⇒ Object


87
88
89
# File 'spaceship/lib/spaceship/tunes/app_analytics.rb', line 87

def app_in_app_purchases_interval(start_t, end_t, view_by = nil)
  client.time_series_analytics([apple_id], ['iap'], start_t, end_t, "DAY", view_by)
end

#app_installsObject


45
46
47
48
49
# File 'spaceship/lib/spaceship/tunes/app_analytics.rb', line 45

def app_installs
  start_t, end_t = time_last_7_days

  app_installs_interval(start_t, end_t)
end

#app_installs_interval(start_t, end_t, view_by = nil) ⇒ Object


99
100
101
# File 'spaceship/lib/spaceship/tunes/app_analytics.rb', line 99

def app_installs_interval(start_t, end_t, view_by = nil)
  client.time_series_analytics([apple_id], ['installs'], start_t, end_t, "DAY", view_by)
end

#app_measure_interval(start_t, end_t, measure, view_by = nil) ⇒ Object


75
76
77
# File 'spaceship/lib/spaceship/tunes/app_analytics.rb', line 75

def app_measure_interval(start_t, end_t, measure, view_by = nil)
  client.time_series_analytics([apple_id], [measure], start_t, end_t, "DAY", view_by)
end

#app_paying_usersObject


39
40
41
42
43
# File 'spaceship/lib/spaceship/tunes/app_analytics.rb', line 39

def app_paying_users
  start_t, end_t = time_last_7_days

  app_paying_users_interval(start_t, end_t)
end

#app_paying_users_interval(start_t, end_t, view_by = nil) ⇒ Object


95
96
97
# File 'spaceship/lib/spaceship/tunes/app_analytics.rb', line 95

def app_paying_users_interval(start_t, end_t, view_by = nil)
  client.time_series_analytics([apple_id], ['payingUsers'], start_t, end_t, "DAY", view_by)
end

#app_salesObject


33
34
35
36
37
# File 'spaceship/lib/spaceship/tunes/app_analytics.rb', line 33

def app_sales
  start_t, end_t = time_last_7_days

  app_sales_interval(start_t, end_t)
end

#app_sales_interval(start_t, end_t, view_by = nil) ⇒ Object


91
92
93
# File 'spaceship/lib/spaceship/tunes/app_analytics.rb', line 91

def app_sales_interval(start_t, end_t, view_by = nil)
  client.time_series_analytics([apple_id], ['sales'], start_t, end_t, "DAY", view_by)
end

#app_sessionsObject


51
52
53
54
55
# File 'spaceship/lib/spaceship/tunes/app_analytics.rb', line 51

def app_sessions
  start_t, end_t = time_last_7_days

  app_sessions_interval(start_t, end_t)
end

#app_sessions_interval(start_t, end_t, view_by = nil) ⇒ Object


103
104
105
# File 'spaceship/lib/spaceship/tunes/app_analytics.rb', line 103

def app_sessions_interval(start_t, end_t, view_by = nil)
  client.time_series_analytics([apple_id], ['sessions'], start_t, end_t, "DAY", view_by)
end

#app_unitsObject


15
16
17
18
19
# File 'spaceship/lib/spaceship/tunes/app_analytics.rb', line 15

def app_units
  start_t, end_t = time_last_7_days

  app_units_interval(start_t, end_t)
end

#app_units_interval(start_t, end_t, view_by = nil) ⇒ Object


79
80
81
# File 'spaceship/lib/spaceship/tunes/app_analytics.rb', line 79

def app_units_interval(start_t, end_t, view_by = nil)
  client.time_series_analytics([apple_id], ['units'], start_t, end_t, "DAY", view_by)
end

#app_viewsObject


21
22
23
24
25
# File 'spaceship/lib/spaceship/tunes/app_analytics.rb', line 21

def app_views
  start_t, end_t = time_last_7_days

  app_views_interval(start_t, end_t)
end

#app_views_interval(start_t, end_t, view_by = nil) ⇒ Object


83
84
85
# File 'spaceship/lib/spaceship/tunes/app_analytics.rb', line 83

def app_views_interval(start_t, end_t, view_by = nil)
  client.time_series_analytics([apple_id], ['pageViewCount'], start_t, end_t, "DAY", view_by)
end

#time_last_30_daysObject


128
129
130
131
132
133
134
135
# File 'spaceship/lib/spaceship/tunes/app_analytics.rb', line 128

def time_last_30_days
  time = Time.now
  past = time - (60 * 60 * 24 * 30)
  end_t   = time.strftime("%Y-%m-%dT00:00:00Z")
  start_t = past.strftime("%Y-%m-%dT00:00:00Z")

  return start_t, end_t
end

#time_last_7_daysObject


119
120
121
122
123
124
125
126
# File 'spaceship/lib/spaceship/tunes/app_analytics.rb', line 119

def time_last_7_days
  time = Time.now
  past = time - (60 * 60 * 24 * 7)
  end_t   = time.strftime("%Y-%m-%dT00:00:00Z")
  start_t = past.strftime("%Y-%m-%dT00:00:00Z")

  return start_t, end_t
end

#time_last_90_daysObject


137
138
139
140
141
142
143
144
# File 'spaceship/lib/spaceship/tunes/app_analytics.rb', line 137

def time_last_90_days
  time = Time.now
  past = time - (60 * 60 * 24 * 90)
  end_t   = time.strftime("%Y-%m-%dT00:00:00Z")
  start_t = past.strftime("%Y-%m-%dT00:00:00Z")

  return start_t, end_t
end