urbanairship 5.6.1 → 7.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +30 -0
  3. data/README.rst +91 -34
  4. data/docs/ab_tests.rst +162 -0
  5. data/docs/attributes.rst +52 -0
  6. data/docs/automations.rst +212 -0
  7. data/docs/index.rst +3 -0
  8. data/docs/push.rst +24 -0
  9. data/docs/sms.rst +19 -0
  10. data/docs/static_lists.rst +2 -2
  11. data/lib/urbanairship.rb +12 -0
  12. data/lib/urbanairship/ab_tests/ab_test.rb +88 -0
  13. data/lib/urbanairship/ab_tests/experiment.rb +45 -0
  14. data/lib/urbanairship/ab_tests/variant.rb +34 -0
  15. data/lib/urbanairship/automations/automation.rb +105 -0
  16. data/lib/urbanairship/automations/pipeline.rb +52 -0
  17. data/lib/urbanairship/client.rb +32 -10
  18. data/lib/urbanairship/common.rb +108 -42
  19. data/lib/urbanairship/configuration.rb +2 -1
  20. data/lib/urbanairship/custom_events/custom_event.rb +60 -0
  21. data/lib/urbanairship/custom_events/payload.rb +89 -0
  22. data/lib/urbanairship/devices/attribute.rb +54 -0
  23. data/lib/urbanairship/devices/channel_tags.rb +2 -2
  24. data/lib/urbanairship/devices/channel_uninstall.rb +10 -10
  25. data/lib/urbanairship/devices/create_and_send.rb +4 -4
  26. data/lib/urbanairship/devices/devicelist.rb +28 -7
  27. data/lib/urbanairship/devices/email.rb +5 -5
  28. data/lib/urbanairship/devices/named_user.rb +6 -6
  29. data/lib/urbanairship/devices/open_channel.rb +22 -23
  30. data/lib/urbanairship/devices/segment.rb +6 -8
  31. data/lib/urbanairship/devices/sms.rb +40 -9
  32. data/lib/urbanairship/devices/static_lists.rb +12 -12
  33. data/lib/urbanairship/push/location.rb +18 -18
  34. data/lib/urbanairship/push/push.rb +23 -13
  35. data/lib/urbanairship/push/schedule.rb +9 -0
  36. data/lib/urbanairship/reports/response_statistics.rb +42 -31
  37. data/lib/urbanairship/version.rb +1 -1
  38. metadata +16 -5
@@ -5,7 +5,14 @@ module Urbanairship
5
5
  class Sms
6
6
  include Urbanairship::Common
7
7
  include Urbanairship::Loggable
8
- attr_accessor :msisdn, :sender, :opted_in, :sender
8
+ attr_accessor :msisdn,
9
+ :sender,
10
+ :opted_in,
11
+ :sender,
12
+ :locale_country,
13
+ :locale_language,
14
+ :timezone,
15
+ :channel_id
9
16
 
10
17
  def initialize(client: required('client'))
11
18
  @client = client
@@ -24,16 +31,40 @@ module Urbanairship
24
31
  response = @client.send_request(
25
32
  method: 'POST',
26
33
  body: JSON.dump(payload),
27
- url: CHANNEL_URL + 'sms',
34
+ path: channel_path('sms'),
28
35
  content_type: 'application/json'
29
36
  )
30
37
  logger.info("Registering SMS channel with msisdn #{@msisdn}")
31
38
  response
32
39
  end
33
40
 
41
+ def update
42
+ fail ArgumentError, 'sender must be set to update sms channel' if sender.nil?
43
+ fail ArgumentError, 'msisdn must be set to update sms channel' if msisdn.nil?
44
+ fail ArgumentError, 'channel_id must be set to update sms channel' if channel_id.nil?
45
+
46
+ payload = {
47
+ 'msisdn': msisdn,
48
+ 'sender': sender,
49
+ 'opted_in': opted_in,
50
+ 'locale_country': locale_country,
51
+ 'locale_language': locale_language,
52
+ 'timezone': timezone
53
+ }.delete_if {|key, value| value.nil?} #this removes the nil key value pairs
54
+
55
+ response = @client.send_request(
56
+ method: 'PUT',
57
+ body: JSON.dump(payload),
58
+ path: channel_path('sms/' + channel_id),
59
+ content_type: 'application/json'
60
+ )
61
+ logger.info("Updating SMS channel with msisdn #{@channel_id}")
62
+ response
63
+ end
64
+
34
65
  def opt_out
35
- fail ArgumentError, 'sender must be set to register sms channel' if sender.nil?
36
- fail ArgumentError, 'msisdn must be set to register sms channel' if msisdn.nil?
66
+ fail ArgumentError, 'sender must be set to opt out sms channel' if sender.nil?
67
+ fail ArgumentError, 'msisdn must be set to opt out sms channel' if msisdn.nil?
37
68
 
38
69
  payload = {
39
70
  'msisdn': msisdn,
@@ -43,7 +74,7 @@ module Urbanairship
43
74
  response = @client.send_request(
44
75
  method: 'POST',
45
76
  body: JSON.dump(payload),
46
- url: CHANNEL_URL + 'sms/opt-out',
77
+ path: channel_path('sms/opt-out'),
47
78
  content_type: 'application/json'
48
79
  )
49
80
  logger.info("Opting Out of SMS messages for #{@msisdn}")
@@ -51,8 +82,8 @@ module Urbanairship
51
82
  end
52
83
 
53
84
  def uninstall
54
- fail ArgumentError, 'sender must be set to register sms channel' if sender.nil?
55
- fail ArgumentError, 'msisdn must be set to register sms channel' if msisdn.nil?
85
+ fail ArgumentError, 'sender must be set to uninstall sms channel' if sender.nil?
86
+ fail ArgumentError, 'msisdn must be set to uninstall sms channel' if msisdn.nil?
56
87
 
57
88
  payload = {
58
89
  'msisdn': msisdn,
@@ -62,7 +93,7 @@ module Urbanairship
62
93
  response = @client.send_request(
63
94
  method: 'POST',
64
95
  body: JSON.dump(payload),
65
- url: CHANNEL_URL + 'sms/uninstall',
96
+ path: channel_path('sms/uninstall'),
66
97
  content_type: 'application/json'
67
98
  )
68
99
  logger.info("Uninstalling SMS channel for #{@msisdn}")
@@ -75,7 +106,7 @@ module Urbanairship
75
106
 
76
107
  response = @client.send_request(
77
108
  method: 'GET',
78
- url: CHANNEL_URL + 'sms/' + @msisdn + '/' + @sender
109
+ path: channel_path('sms/' + @msisdn + '/' + @sender)
79
110
  )
80
111
  logger.info { "Retrieved information for msisdn #{@msisdn}" }
81
112
  response
@@ -13,16 +13,16 @@ module Urbanairship
13
13
  @client = client
14
14
  end
15
15
 
16
- def create(description: nil, extras: nil)
16
+ def create(description: nil, extra: nil)
17
17
  fail ArgumentError, 'Name must be set' if name.nil?
18
18
  payload = {'name': name}
19
19
  payload['description'] = description unless description.nil?
20
- payload['extras'] = extras unless extras.nil?
20
+ payload['extra'] = extra unless extra.nil?
21
21
 
22
22
  response = @client.send_request(
23
23
  method: 'POST',
24
24
  body: JSON.dump(payload),
25
- url: LISTS_URL,
25
+ path: lists_path,
26
26
  content_type: 'application/json'
27
27
  )
28
28
  logger.info("Created static list for #{@name}")
@@ -35,7 +35,7 @@ module Urbanairship
35
35
  response = @client.send_request(
36
36
  method: 'PUT',
37
37
  body: csv_file,
38
- url: LISTS_URL + @name + '/csv/',
38
+ path: lists_path(@name + '/csv/'),
39
39
  content_type: 'text/csv',
40
40
  encoding: gzip
41
41
  )
@@ -43,7 +43,7 @@ module Urbanairship
43
43
  response = @client.send_request(
44
44
  method: 'PUT',
45
45
  body: csv_file,
46
- url: LISTS_URL + @name + '/csv/',
46
+ path: lists_path(@name + '/csv/'),
47
47
  content_type: 'text/csv'
48
48
  )
49
49
  end
@@ -51,17 +51,17 @@ module Urbanairship
51
51
  response
52
52
  end
53
53
 
54
- def update(description: nil, extras: nil)
54
+ def update(description: nil, extra: nil)
55
55
  fail ArgumentError, 'Name must be set' if name.nil?
56
56
  fail ArgumentError,
57
- 'Either description or extras must be set to a value' if description.nil? and extras.nil?
57
+ 'Either description or extras must be set to a value' if description.nil? and extra.nil?
58
58
  payload = {}
59
59
  payload['description'] = description unless description.nil?
60
- payload['extras'] = extras unless extras.nil?
60
+ payload['extra'] = extra unless extra.nil?
61
61
  response = @client.send_request(
62
62
  method: 'PUT',
63
63
  body: JSON.dump(payload),
64
- url: LISTS_URL + @name,
64
+ path: lists_path(@name),
65
65
  content_type: 'application/json'
66
66
  )
67
67
  logger.info("Updating the metadata for list #{@name}")
@@ -72,7 +72,7 @@ module Urbanairship
72
72
  fail ArgumentError, 'Name must be set' if name.nil?
73
73
  response = @client.send_request(
74
74
  method: 'GET',
75
- url: LISTS_URL + @name
75
+ path: lists_path(@name)
76
76
  )
77
77
  logger.info("Retrieving info for list #{@name}")
78
78
  response
@@ -82,7 +82,7 @@ module Urbanairship
82
82
  fail ArgumentError, 'Name must be set' if name.nil?
83
83
  response = @client.send_request(
84
84
  method: 'DELETE',
85
- url: LISTS_URL + @name
85
+ path: lists_path(@name)
86
86
  )
87
87
  logger.info("Deleted list #{@name}")
88
88
  response
@@ -92,7 +92,7 @@ module Urbanairship
92
92
  class StaticLists < Urbanairship::Common::PageIterator
93
93
  def initialize(client: required('client'))
94
94
  super(client: client)
95
- @next_page = LISTS_URL
95
+ @next_page_path = lists_path
96
96
  @data_attribute = 'lists'
97
97
  end
98
98
  end
@@ -14,11 +14,11 @@ module Urbanairship
14
14
  def name_lookup(name: required('name'), type: nil)
15
15
  fail ArgumentError, 'name needs to be a string' unless name.is_a? String
16
16
  fail ArgumentError, 'type needs to be a string' unless type.nil? or type.is_a? String
17
- url = LOCATION_URL + '?q=' + name
18
- url += '&type=' + type unless type.nil?
17
+ path = location_path('?q=' + name)
18
+ path += '&type=' + type unless type.nil?
19
19
  resp = @client.send_request(
20
20
  method: 'GET',
21
- url: url
21
+ path: path
22
22
  )
23
23
  logger.info("Retrieved location information for #{name}")
24
24
  resp
@@ -28,11 +28,11 @@ module Urbanairship
28
28
  fail ArgumentError,
29
29
  'latitude and longitude need to be numbers' unless latitude.is_a? Numeric and longitude.is_a? Numeric
30
30
  fail ArgumentError, 'type needs to be a string' unless type.nil? or type.is_a? String
31
- url = LOCATION_URL + latitude.to_s + ',' + longitude.to_s
32
- url += '?type=' + type unless type.nil?
31
+ path = location_path(latitude.to_s + ',' + longitude.to_s)
32
+ path += '?type=' + type unless type.nil?
33
33
  resp = @client.send_request(
34
34
  method: 'GET',
35
- url: url
35
+ path: path
36
36
  )
37
37
  logger.info("Retrieved location information for latitude #{latitude} and longitude #{longitude}")
38
38
  resp
@@ -45,11 +45,11 @@ module Urbanairship
45
45
  'lat1, long1, lat2, and long2 need to be numbers' unless lat1.is_a? Numeric and long2.is_a? Numeric\
46
46
  and lat2.is_a? Numeric and long2.is_a? Numeric
47
47
  fail ArgumentError, 'type needs to be a string' unless type.nil? or type.is_a? String
48
- url = LOCATION_URL + lat1.to_s + ',' + long1.to_s + ',' + lat2.to_s + ',' + long2.to_s
49
- url += '?type=' + type unless type.nil?
48
+ path = location_path(lat1.to_s + ',' + long1.to_s + ',' + lat2.to_s + ',' + long2.to_s)
49
+ path += '?type=' + type unless type.nil?
50
50
  resp = @client.send_request(
51
51
  method: 'GET',
52
- url: url
52
+ path: path
53
53
  )
54
54
  logger.info("Retrieved location information for bounding box with lat1 #{lat1}, long1 #{long1}," +
55
55
  " lat2 #{lat2}, and long2 #{long2}")
@@ -58,20 +58,20 @@ module Urbanairship
58
58
 
59
59
  def alias_lookup(from_alias: required('from_alias'))
60
60
  fail ArgumentError, 'from_alias needs to be a string or an array of strings' unless from_alias.is_a? String or from_alias.is_a? Array
61
- url = LOCATION_URL + 'from-alias?'
61
+ path = location_path('from-alias?')
62
62
  if from_alias.is_a? Array
63
63
  from_alias.each do |a|
64
64
  fail ArgumentError, 'from_alias needs to be a string or an array of strings' unless a.is_a? String
65
- url += a + '&'
65
+ path += a + '&'
66
66
  end
67
- url = url.chop
67
+ path = path.chop
68
68
  else
69
- url += from_alias
69
+ path += from_alias
70
70
  end
71
71
 
72
72
  resp = @client.send_request(
73
73
  method: 'GET',
74
- url: url
74
+ path: path
75
75
  )
76
76
  logger.info("Retrieved location info from alias #{from_alias}")
77
77
  resp
@@ -81,10 +81,10 @@ module Urbanairship
81
81
  fail ArgumentError, 'polygon_id needs to be a string' unless polygon_id.is_a? String
82
82
  fail ArgumentError, 'zoom needs to be an integer' unless zoom.is_a? Integer
83
83
 
84
- url = LOCATION_URL + polygon_id + '?zoom=' + zoom.to_s
84
+ path = location_path(polygon_id + '?zoom=' + zoom.to_s)
85
85
  resp = @client.send_request(
86
86
  method: 'GET',
87
- url: url
87
+ path: path
88
88
  )
89
89
  logger.info("Retrieved location info for polygon #{polygon_id} and zoom level #{zoom}")
90
90
  resp
@@ -93,11 +93,11 @@ module Urbanairship
93
93
  def date_ranges
94
94
  resp = @client.send_request(
95
95
  method: 'GET',
96
- url: SEGMENTS_URL + 'dates/'
96
+ path: segments_path('dates/')
97
97
  )
98
98
  logger.info('Retrieved location date ranges')
99
99
  resp
100
100
  end
101
101
  end
102
102
  end
103
- end
103
+ end
@@ -8,9 +8,17 @@ module Urbanairship
8
8
 
9
9
  # A Push Notification.
10
10
  class Push
11
- attr_writer :client, :audience, :notification, :options,
12
- :device_types, :message, :in_app
13
- attr_reader :device_types, :audience
11
+ attr_writer :client
12
+
13
+ attr_accessor :device_types,
14
+ :audience,
15
+ :notification,
16
+ :options,
17
+ :message,
18
+ :in_app,
19
+ :campaigns,
20
+ :localizations
21
+
14
22
  include Urbanairship::Common
15
23
  include Urbanairship::Loggable
16
24
 
@@ -23,12 +31,14 @@ module Urbanairship
23
31
 
24
32
  def payload
25
33
  compact_helper({
26
- audience: @audience,
27
- notification: @notification,
28
- options: @options,
29
- device_types: @device_types,
30
- message: @message,
31
- in_app: @in_app
34
+ audience: audience,
35
+ notification: notification,
36
+ options: options,
37
+ device_types: device_types,
38
+ message: message,
39
+ in_app: in_app,
40
+ campaigns: campaigns,
41
+ localizations: localizations
32
42
  })
33
43
  end
34
44
 
@@ -42,7 +52,7 @@ module Urbanairship
42
52
  response = @client.send_request(
43
53
  method: 'POST',
44
54
  body: JSON.dump(payload),
45
- url: PUSH_URL,
55
+ path: push_path,
46
56
  content_type: 'application/json'
47
57
  )
48
58
  pr = PushResponse.new(http_response_body: response['body'], http_response_code: response['code'].to_s)
@@ -83,7 +93,7 @@ module Urbanairship
83
93
  response = @client.send_request(
84
94
  method: 'POST',
85
95
  body: JSON.dump(payload),
86
- url: SCHEDULES_URL,
96
+ path: schedules_path,
87
97
  content_type: 'application/json'
88
98
  )
89
99
  pr = PushResponse.new(http_response_body: response['body'], http_response_code: response['code'].to_s)
@@ -160,7 +170,7 @@ module Urbanairship
160
170
  'schedule_id must be a string' unless schedule_id.is_a? String
161
171
  resp = @client.send_request(
162
172
  method: 'GET',
163
- url: SCHEDULES_URL + schedule_id
173
+ path: schedules_path(schedule_id)
164
174
  )
165
175
  logger.info("Retrieved info for schedule_id #{schedule_id}")
166
176
  resp
@@ -171,7 +181,7 @@ module Urbanairship
171
181
  class ScheduledPushList < Urbanairship::Common::PageIterator
172
182
  def initialize(client: required('client'))
173
183
  super(client: client)
174
- @next_page = SCHEDULES_URL
184
+ @next_page_path = schedules_path
175
185
  @data_attribute = 'schedules'
176
186
  end
177
187
  end
@@ -14,6 +14,15 @@ module Urbanairship
14
14
  payload(:local_scheduled_time, datetime)
15
15
  end
16
16
 
17
+ # Uses predictive analysis to send push at optimal time
18
+ def optimal_scheduled_time(date)
19
+ {
20
+ 'best_time': {
21
+ 'send_date': date
22
+ }
23
+ }
24
+ end
25
+
17
26
  private
18
27
 
19
28
  def payload(name, time)
@@ -4,22 +4,33 @@ require 'time'
4
4
  module Urbanairship
5
5
  module Reports
6
6
  class Helper
7
- def get_url(start_date, end_date, precision)
8
- fail ArgumentError,
9
- 'the parameters cannot be set to nil' if start_date.nil? or end_date.nil? or precision.nil?
10
- precision_array = %w(HOURLY DAILY MONTHLY)
11
- fail ArgumentError,
12
- "Precision must be 'HOURLY', 'DAILY', or 'MONTHLY'" unless precision_array.include?(precision)
7
+ def get_period_params(start_date, end_date, precision)
8
+ validates_parameters_presence!(start_date, end_date, precision)
9
+ validates_precision_format!(precision)
13
10
 
14
11
  begin
15
- start_parsed = Time.parse(start_date)
16
- end_parsed = Time.parse(end_date)
12
+ start_parsed = Time.parse(start_date).iso8601
13
+ end_parsed = Time.parse(end_date).iso8601
14
+
15
+ "?start=#{start_parsed}&end=#{end_parsed}&precision=#{precision}"
17
16
  rescue ArgumentError
18
- fail ArgumentError,
19
- 'start_date and end_date must be valid date strings'
17
+ fail ArgumentError, 'start_date and end_date must be valid date strings'
20
18
  end
21
- url = '?start=' + start_parsed.iso8601 + '&end=' + end_parsed.iso8601
22
- url += '&precision=' + precision
19
+ end
20
+
21
+ private
22
+
23
+ def validates_parameters_presence!(start_date, end_date, precision)
24
+ return unless [start_date, end_date, precision].any?(&:nil?)
25
+
26
+ fail ArgumentError, 'the parameters cannot be set to nil'
27
+ end
28
+
29
+ AUTHORIZED_PRECISIONS = %w(HOURLY DAILY MONTHLY)
30
+ def validates_precision_format!(precision)
31
+ return if AUTHORIZED_PRECISIONS.include?(precision)
32
+
33
+ fail ArgumentError, 'Precision must be "HOURLY", "DAILY", or "MONTHLY"'
23
34
  end
24
35
  end
25
36
 
@@ -35,8 +46,8 @@ module Urbanairship
35
46
  fail ArgumentError,
36
47
  'push_id cannot be nil' if push_id.nil?
37
48
 
38
- url = REPORTS_URL + 'responses/' + push_id
39
- response = @client.send_request(method: 'GET', url: url)
49
+ path = reports_path('responses/' + push_id)
50
+ response = @client.send_request(method: 'GET', path: path)
40
51
  logger.info("Retrieved info on push_id: #{push_id}")
41
52
  response
42
53
  end
@@ -60,10 +71,10 @@ module Urbanairship
60
71
  fail ArgumentError,
61
72
  'start_date and end_date must be valid date strings'
62
73
  end
63
- url = REPORTS_URL + 'responses/list?start=' + start_parsed.iso8601 + '&end=' + end_parsed.iso8601
64
- url += '&limit' + limit.to_s unless limit.nil?
65
- url += '&push_id_start&' + push_id_start unless push_id_start.nil?
66
- @next_page = url
74
+ path = reports_path('responses/list?start=' + start_parsed.iso8601 + '&end=' + end_parsed.iso8601)
75
+ path += '&limit' + limit.to_s unless limit.nil?
76
+ path += '&push_id_start&' + push_id_start unless push_id_start.nil?
77
+ @next_page_path = path
67
78
  @data_attribute = 'pushes'
68
79
  end
69
80
  end
@@ -87,7 +98,7 @@ module Urbanairship
87
98
  end
88
99
  response = @client.send_request(
89
100
  method: 'GET',
90
- url: REPORTS_URL + 'devices/?date=' + date_parsed.iso8601
101
+ path: reports_path('devices/?date=' + date_parsed.iso8601)
91
102
  )
92
103
  logger.info("Retrieved device report for date #{date}")
93
104
  response
@@ -98,8 +109,8 @@ module Urbanairship
98
109
  def initialize(client: required('client'), start_date: required('start_date'),
99
110
  end_date: required('end_date'), precision: required('precision'))
100
111
  super(client: client)
101
- url = Helper.new.get_url(start_date, end_date, precision)
102
- @next_page = REPORTS_URL + 'optins/' + url
112
+ period_params = Helper.new.get_period_params(start_date, end_date, precision)
113
+ @next_page_path = reports_path('optins/' + period_params)
103
114
  @data_attribute = 'optins'
104
115
  end
105
116
  end
@@ -108,8 +119,8 @@ module Urbanairship
108
119
  def initialize(client: required('client'), start_date: required('start_date'),
109
120
  end_date: required('end_date'), precision: required('precision'))
110
121
  super(client: client)
111
- url = Helper.new.get_url(start_date, end_date, precision)
112
- @next_page = REPORTS_URL + 'optouts/' + url
122
+ period_params = Helper.new.get_period_params(start_date, end_date, precision)
123
+ @next_page_path = reports_path('optouts/' + period_params)
113
124
  @data_attribute = 'optouts'
114
125
  end
115
126
  end
@@ -118,8 +129,8 @@ module Urbanairship
118
129
  def initialize(client: required('client'), start_date: required('start_date'),
119
130
  end_date: required('end_date'), precision: required('precision'))
120
131
  super(client: client)
121
- url = Helper.new.get_url(start_date, end_date, precision)
122
- @next_page = REPORTS_URL + 'sends/' + url
132
+ period_params = Helper.new.get_period_params(start_date, end_date, precision)
133
+ @next_page_path = reports_path('sends/' + period_params)
123
134
  @data_attribute = 'sends'
124
135
  end
125
136
  end
@@ -128,8 +139,8 @@ module Urbanairship
128
139
  def initialize(client: required('client'), start_date: required('start_date'),
129
140
  end_date: required('end_date'), precision: required('precision'))
130
141
  super(client: client)
131
- url = Helper.new.get_url(start_date, end_date, precision)
132
- @next_page = REPORTS_URL + 'responses/' + url
142
+ period_params = Helper.new.get_period_params(start_date, end_date, precision)
143
+ @next_page_path = reports_path('responses/' + period_params)
133
144
  @data_attribute = 'responses'
134
145
  end
135
146
  end
@@ -138,8 +149,8 @@ module Urbanairship
138
149
  def initialize(client: required('client'), start_date: required('start_date'),
139
150
  end_date: required('end_date'), precision: required('precision'))
140
151
  super(client: client)
141
- url = Helper.new.get_url(start_date, end_date, precision)
142
- @next_page = REPORTS_URL + 'opens/' + url
152
+ period_params = Helper.new.get_period_params(start_date, end_date, precision)
153
+ @next_page_path = reports_path('opens/' + period_params)
143
154
  @data_attribute = 'opens'
144
155
  end
145
156
  end
@@ -148,8 +159,8 @@ module Urbanairship
148
159
  def initialize(client: required('client'), start_date: required('start_date'),
149
160
  end_date: required('end_date'), precision: required('precision'))
150
161
  super(client: client)
151
- url = Helper.new.get_url(start_date, end_date, precision)
152
- @next_page = REPORTS_URL + 'timeinapp/' + url
162
+ period_params = Helper.new.get_period_params(start_date, end_date, precision)
163
+ @next_page_path = reports_path('timeinapp/' + period_params)
153
164
  @data_attribute = 'timeinapp'
154
165
  end
155
166
  end