urbanairship 6.0.0 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -23,7 +23,7 @@ module Urbanairship
23
23
  body: JSON.dump(events),
24
24
  content_type: 'application/json',
25
25
  method: 'POST',
26
- url: custom_events_url
26
+ path: custom_events_path
27
27
  )
28
28
  cer = CustomEventResponse.new(body: response['body'], code: response['code'])
29
29
  logger.info { cer.format }
@@ -15,7 +15,7 @@ module Urbanairship
15
15
  @add_group = {}
16
16
  @remove_group = {}
17
17
  @set_group = {}
18
- @url = channel_url('tags/')
18
+ @path = channel_path('tags/')
19
19
  end
20
20
 
21
21
  def set_audience(ios: nil, android: nil, amazon: nil)
@@ -62,7 +62,7 @@ module Urbanairship
62
62
  response = @client.send_request(
63
63
  method: 'POST',
64
64
  body: JSON.dump(payload),
65
- url: @url,
65
+ path: @path,
66
66
  content_type: 'application/json'
67
67
  )
68
68
  logger.info("Set tags for audience: #{@audience}")
@@ -23,7 +23,7 @@ module Urbanairship
23
23
  response = @client.send_request(
24
24
  method: 'POST',
25
25
  body: JSON.dump(channels),
26
- url: channel_url('uninstall/'),
26
+ path: channel_path('uninstall/'),
27
27
  content_type: 'application/json'
28
28
  )
29
29
 
@@ -53,7 +53,7 @@ module Urbanairship
53
53
  response = @client.send_request(
54
54
  method: 'POST',
55
55
  body: JSON.dump(body),
56
- url: open_channel_url('uninstall/'),
56
+ path: open_channel_path('uninstall/'),
57
57
  content_type: 'application/json'
58
58
  )
59
59
 
@@ -52,7 +52,7 @@ module Urbanairship
52
52
  response = @client.send_request(
53
53
  method: 'POST',
54
54
  body: JSON.dump(payload),
55
- url: create_and_send_url,
55
+ path: create_and_send_path,
56
56
  content_type: 'application/json'
57
57
  )
58
58
  logger.info("Running create and send for addresses #{@addresses}")
@@ -63,7 +63,7 @@ module Urbanairship
63
63
  response = @client.send_request(
64
64
  method: 'POST',
65
65
  body: JSON.dump(payload),
66
- url: create_and_send_url('validate'),
66
+ path: create_and_send_path('validate'),
67
67
  content_type: 'application/json'
68
68
  )
69
69
  logger.info("Validating payload for create and send")
@@ -84,7 +84,7 @@ module Urbanairship
84
84
  response = @client.send_request(
85
85
  method: 'POST',
86
86
  body: JSON.dump(scheduled_payload),
87
- url: schedules_url('create-and-send'),
87
+ path: schedules_path('create-and-send'),
88
88
  content_type: 'application/json'
89
89
  )
90
90
  logger.info("Scheduling create and send operation with name #{@name}")
@@ -17,7 +17,7 @@ module Urbanairship
17
17
  def lookup(uuid: required('uuid'))
18
18
  response = @client.send_request(
19
19
  method: 'GET',
20
- url: channel_url(uuid)
20
+ path: channel_path(uuid)
21
21
  )
22
22
  logger.info("Retrieved channel information for #{uuid}")
23
23
  response['body']['channel']
@@ -36,7 +36,7 @@ module Urbanairship
36
36
  response = @client.send_request(
37
37
  method: 'POST',
38
38
  body: JSON.dump(payload),
39
- url: channel_url('attributes'),
39
+ path: channel_path('attributes'),
40
40
  content_type: 'application/json'
41
41
  )
42
42
  response
@@ -46,7 +46,7 @@ module Urbanairship
46
46
  class ChannelList < Urbanairship::Common::PageIterator
47
47
  def initialize(client: required('client'))
48
48
  super(client: client)
49
- @next_page = channel_url
49
+ @next_page_path = channel_path
50
50
  @data_attribute = 'channels'
51
51
  end
52
52
  end
@@ -64,7 +64,7 @@ module Urbanairship
64
64
 
65
65
  resp = @client.send_request(
66
66
  method: 'GET',
67
- url: device_token_url(token)
67
+ path: device_token_path(token)
68
68
  )
69
69
  logger.info("Looking up info on device token #{token}")
70
70
  resp
@@ -77,7 +77,7 @@ module Urbanairship
77
77
 
78
78
  def initialize(client: required('client'))
79
79
  super(client: client)
80
- @next_page = device_token_url
80
+ @next_page_path = device_token_path
81
81
  @data_attribute = 'device_tokens'
82
82
  end
83
83
  end
@@ -95,7 +95,7 @@ module Urbanairship
95
95
 
96
96
  resp = @client.send_request(
97
97
  method: 'GET',
98
- url: apid_url(apid)
98
+ path: apid_path(apid)
99
99
  )
100
100
  logger.info("Retrieved info on apid #{apid}")
101
101
  resp
@@ -105,7 +105,7 @@ module Urbanairship
105
105
  class APIDList < Urbanairship::Common::PageIterator
106
106
  def initialize(client: required('client'))
107
107
  super(client: client)
108
- @next_page = apid_url
108
+ @next_page_path = apid_path
109
109
  @data_attribute = 'apids'
110
110
  end
111
111
  end
@@ -41,7 +41,7 @@ module Urbanairship
41
41
  response = @client.send_request(
42
42
  method: 'POST',
43
43
  body: JSON.dump(payload),
44
- url: channel_url('email'),
44
+ path: channel_path('email'),
45
45
  content_type: 'application/json'
46
46
  )
47
47
  logger.info("Registering email channel with address #{address}")
@@ -58,7 +58,7 @@ module Urbanairship
58
58
  response = @client.send_request(
59
59
  method: 'POST',
60
60
  body: JSON.dump(payload),
61
- url: channel_url('email/uninstall'),
61
+ path: channel_path('email/uninstall'),
62
62
  content_type: 'application/json'
63
63
  )
64
64
  logger.info("Uninstalling email channel with address #{address}")
@@ -70,7 +70,7 @@ module Urbanairship
70
70
 
71
71
  response = @client.send_request(
72
72
  method: 'GET',
73
- url: channel_url('email/' + address)
73
+ path: channel_path('email/' + address)
74
74
  )
75
75
  logger.info("Looking up email channel with address #{address}")
76
76
  response
@@ -95,7 +95,7 @@ module Urbanairship
95
95
 
96
96
  response = @client.send_request(
97
97
  method: 'PUT',
98
- url: channel_url('email/' + channel_id),
98
+ path: channel_path('email/' + channel_id),
99
99
  body: JSON.dump(payload),
100
100
  content_type: 'application/json'
101
101
  )
@@ -109,7 +109,7 @@ module Urbanairship
109
109
 
110
110
  def initialize(client: required('client'))
111
111
  super(client: client)
112
- @url = channel_url('email/tags')
112
+ @path = channel_path('email/tags')
113
113
  end
114
114
 
115
115
  def set_audience(email_address: required('email_address'))
@@ -25,7 +25,7 @@ module Urbanairship
25
25
  response = @client.send_request(
26
26
  method: 'POST',
27
27
  body: JSON.dump(payload),
28
- url: named_users_url('/associate'),
28
+ path: named_users_path('/associate'),
29
29
  content_type: 'application/json'
30
30
  )
31
31
  logger.info { "Associated channel_id #{channel_id} with named_user #{@named_user_id}" }
@@ -40,7 +40,7 @@ module Urbanairship
40
40
  response = @client.send_request(
41
41
  method: 'POST',
42
42
  body: JSON.dump(payload),
43
- url: named_users_url('/disassociate'),
43
+ path: named_users_path('/disassociate'),
44
44
  content_type: 'application/json'
45
45
  )
46
46
  logger.info { "Dissociated channel_id #{channel_id}" }
@@ -52,7 +52,7 @@ module Urbanairship
52
52
  'named_user_id is required for lookup' if @named_user_id.nil?
53
53
  response = @client.send_request(
54
54
  method: 'GET',
55
- url: named_users_url('?id=' + @named_user_id),
55
+ path: named_users_path('?id=' + @named_user_id),
56
56
  )
57
57
  logger.info { "Retrieved information on named_user_id #{@named_user_id}" }
58
58
  response
@@ -65,7 +65,7 @@ module Urbanairship
65
65
 
66
66
  def initialize(client: required('client'))
67
67
  super(client: client)
68
- @url = named_users_url('tags/')
68
+ @path = named_users_path('tags/')
69
69
  end
70
70
 
71
71
  def set_audience(user_ids: required('user_ids'))
@@ -79,7 +79,7 @@ module Urbanairship
79
79
 
80
80
  def initialize(client: required('client'))
81
81
  super(client: client)
82
- @next_page = named_users_url
82
+ @next_page_path = named_users_path
83
83
  @data_attribute = 'named_users'
84
84
  end
85
85
  end
@@ -101,7 +101,7 @@ module Urbanairship
101
101
  response = @client.send_request(
102
102
  method: 'POST',
103
103
  body: JSON.dump(payload),
104
- url: named_users_url('/uninstall'),
104
+ path: named_users_path('/uninstall'),
105
105
  content_type: 'application/json'
106
106
  )
107
107
  logger.info { "Uninstalled named_user_ids #{@named_user_ids} " }
@@ -45,7 +45,7 @@ module Urbanairship
45
45
 
46
46
  response = @client.send_request(
47
47
  method: 'POST',
48
- url: open_channel_url,
48
+ path: open_channel_path,
49
49
  body: JSON.dump(body),
50
50
  content_type: 'application/json'
51
51
  )
@@ -77,7 +77,7 @@ module Urbanairship
77
77
 
78
78
  response = @client.send_request(
79
79
  method: 'POST',
80
- url: open_channel_url,
80
+ path: open_channel_path,
81
81
  body: JSON.dump(body),
82
82
  content_type: 'application/json'
83
83
  )
@@ -90,7 +90,7 @@ module Urbanairship
90
90
 
91
91
  response = @client.send_request(
92
92
  method: 'GET',
93
- url: channel_url(channel_id)
93
+ path: channel_path(channel_id)
94
94
  )
95
95
  logger.info("Looking up info on device token #{channel_id}")
96
96
  response
@@ -28,7 +28,7 @@ module Urbanairship
28
28
  response = @client.send_request(
29
29
  method: 'POST',
30
30
  body: JSON.dump(payload),
31
- url: segments_url,
31
+ path: segments_path,
32
32
  content_type: 'application/json'
33
33
  )
34
34
  logger.info { "Successful segment creation: #{@display_name}" }
@@ -45,7 +45,7 @@ module Urbanairship
45
45
  'id must be set to a valid string' if id.nil?
46
46
  response = @client.send_request(
47
47
  method: 'GET',
48
- url: segments_url(id)
48
+ path: segments_path(id)
49
49
  )
50
50
  logger.info("Retrieved segment information for #{id}")
51
51
  @id = id
@@ -69,7 +69,7 @@ module Urbanairship
69
69
  response = @client.send_request(
70
70
  method: 'PUT',
71
71
  body: JSON.dump(data),
72
- url: segments_url(@id),
72
+ path: segments_path(@id),
73
73
  content_type: 'application/json'
74
74
  )
75
75
  logger.info { "Successful segment update: #{@display_name}" }
@@ -80,13 +80,11 @@ module Urbanairship
80
80
  #
81
81
  # @ returns [Object] response HTTP response
82
82
  def delete
83
- fail ArgumentError,
84
- 'id cannot be nil' if id.nil?
83
+ fail ArgumentError, 'id cannot be nil' if id.nil?
85
84
 
86
- url = segments_url(id)
87
85
  response = @client.send_request(
88
86
  method: 'DELETE',
89
- url: url
87
+ path: segments_path(id)
90
88
  )
91
89
  logger.info { "Successful segment deletion: #{@display_name}" }
92
90
  response
@@ -98,7 +96,7 @@ module Urbanairship
98
96
 
99
97
  def initialize(client: required('client'))
100
98
  super(client: client)
101
- @next_page = segments_url
99
+ @next_page_path = segments_path
102
100
  @data_attribute = 'segments'
103
101
  end
104
102
  end
@@ -31,7 +31,7 @@ module Urbanairship
31
31
  response = @client.send_request(
32
32
  method: 'POST',
33
33
  body: JSON.dump(payload),
34
- url: channel_url('sms'),
34
+ path: channel_path('sms'),
35
35
  content_type: 'application/json'
36
36
  )
37
37
  logger.info("Registering SMS channel with msisdn #{@msisdn}")
@@ -55,7 +55,7 @@ module Urbanairship
55
55
  response = @client.send_request(
56
56
  method: 'PUT',
57
57
  body: JSON.dump(payload),
58
- url: channel_url('sms/' + channel_id),
58
+ path: channel_path('sms/' + channel_id),
59
59
  content_type: 'application/json'
60
60
  )
61
61
  logger.info("Updating SMS channel with msisdn #{@channel_id}")
@@ -74,7 +74,7 @@ module Urbanairship
74
74
  response = @client.send_request(
75
75
  method: 'POST',
76
76
  body: JSON.dump(payload),
77
- url: channel_url('sms/opt-out'),
77
+ path: channel_path('sms/opt-out'),
78
78
  content_type: 'application/json'
79
79
  )
80
80
  logger.info("Opting Out of SMS messages for #{@msisdn}")
@@ -93,7 +93,7 @@ module Urbanairship
93
93
  response = @client.send_request(
94
94
  method: 'POST',
95
95
  body: JSON.dump(payload),
96
- url: channel_url('sms/uninstall'),
96
+ path: channel_path('sms/uninstall'),
97
97
  content_type: 'application/json'
98
98
  )
99
99
  logger.info("Uninstalling SMS channel for #{@msisdn}")
@@ -106,7 +106,7 @@ module Urbanairship
106
106
 
107
107
  response = @client.send_request(
108
108
  method: 'GET',
109
- url: channel_url('sms/' + @msisdn + '/' + @sender)
109
+ path: channel_path('sms/' + @msisdn + '/' + @sender)
110
110
  )
111
111
  logger.info { "Retrieved information for msisdn #{@msisdn}" }
112
112
  response
@@ -22,7 +22,7 @@ module Urbanairship
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
@@ -61,7 +61,7 @@ module Urbanairship
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,7 +93,7 @@ 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