urbanairship 8.0.0 → 9.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8c91f31ef623a57075fe0acde9fe467d17dc2b0bbb634070c8da11cad54b08f5
4
- data.tar.gz: eefb6b294cd953148c27fa91bae207888cbb163c6ec620301aa41b243046b46a
3
+ metadata.gz: 4271dd0c7f5cc4da7c6438cfec017d10be9ddb8c28145f541cf026ec1c179258
4
+ data.tar.gz: 609aa096ad24c679a32ab69fca8487ebe7e939150505d9f91c506937ce8e8ac0
5
5
  SHA512:
6
- metadata.gz: 1c19a821551da7ad1593c91ef7dd0c922dd2f4637ee74a2f29a1fcecce0db4185b09e0fa908fedcc6b124897c3bcd9a41c1070d841b6cef45436ac26a5ba3382
7
- data.tar.gz: 15bd6f34bf76d038d359b79443f7c12464345ea1cf3cc959254a2350b597a5a91be89940713d3de4a5caba50495cd66ea3cb39cbb6e91ad067d511f8c69af4f8
6
+ metadata.gz: d743974f8312e3d42f890873a3bd78f44483be14a4593c169f6587be560358771667127b1dabc30286cf3577161f573f9f73a13a9b6eb25840a686bf7d917e4f
7
+ data.tar.gz: 1abaa92b5fa0fea9afd3274ffac2bcc44a91280c514e05e11aab3612d0b886bfa11d4a9c1fa42ea887dd3638cdf6d336c187f6e8518f2618175e6b59f46fd3c2
@@ -16,7 +16,7 @@ Please include link to open issue if applicable.
16
16
  * I've tested for Ruby versions:
17
17
 
18
18
  - [ ] 2.6.7
19
- - [ ] 2.7.2
19
+ - [ ] 2.7.3
20
20
 
21
21
  ### Airship Contribution Agreement
22
22
  [Link here](https://docs.google.com/forms/d/e/1FAIpQLScErfiz-fXSPpVZ9r8Di2Tr2xDFxt5MgzUel0__9vqUgvko7Q/viewform)
@@ -0,0 +1,23 @@
1
+ name: Ruby Build
2
+
3
+ on: [ push ]
4
+
5
+ jobs:
6
+ test:
7
+
8
+ runs-on: ubuntu-latest
9
+
10
+ strategy:
11
+ matrix:
12
+ ruby-version: [2.7.3, 2.6.7]
13
+
14
+ steps:
15
+ - uses: actions/checkout@v2
16
+ - name: Set up Ruby ${{ matrix.ruby-version }}
17
+ uses: ruby/setup-ruby@477b21f02be01bcb8030d50f37cfec92bfa615b6
18
+ with:
19
+ ruby-version: ${{ matrix.ruby-version }}
20
+ - name: Install dependencies
21
+ run: bundle install
22
+ - name: Run tests
23
+ run: bundle exec rake
@@ -0,0 +1,31 @@
1
+ name: Ruby Release
2
+
3
+ on:
4
+ release:
5
+ types: [released]
6
+
7
+ jobs:
8
+ test:
9
+
10
+ runs-on: ubuntu-latest
11
+
12
+ strategy:
13
+ matrix:
14
+ ruby-version: [2.7.3, 2.6.7]
15
+
16
+ steps:
17
+ - uses: actions/checkout@v2
18
+ - name: Set up Ruby ${{ matrix.ruby-version }}
19
+ uses: ruby/setup-ruby@477b21f02be01bcb8030d50f37cfec92bfa615b6
20
+ with:
21
+ ruby-version: ${{ matrix.ruby-version }}
22
+ - name: Install dependencies
23
+ run: bundle install
24
+ - name: Run tests
25
+ run: bundle exec rake
26
+ - name: Publish to RubyGems
27
+ uses: cadwallion/publish-rubygems-action@master
28
+ env:
29
+ RUBYGEMS_API_KEY: ${{secrets.RUBYGEMS_API_KEY}}
30
+ GUTHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
31
+ RELEASE_COMMAND: rake release
data/.gitignore CHANGED
@@ -10,6 +10,7 @@
10
10
  /spec/reports/
11
11
  /tmp/
12
12
  /csv_file
13
+ .vscode/
13
14
 
14
15
  # App
15
16
  urbanairship.log
data/CHANGELOG CHANGED
@@ -1,3 +1,25 @@
1
+ --------------------
2
+ 9.1.0
3
+ --------------------
4
+ - All requests will now automatically attempt to authenticate with bearer token auth if a
5
+ token is included in the instantiation of the client. Previously, only custom events requests
6
+ could use bearer token auth in this library. You can find more information about how to use
7
+ bearer token auth in the README.
8
+ - Also fixes an issue where a secret was required even when bearer token auth was being used
9
+ (it is no longer required).
10
+
11
+ --------------------
12
+ 9.0.0
13
+ --------------------
14
+ - Adds Tag List API Support
15
+ - Removes location lookup endpoints
16
+ - Removes location-based audience selectors
17
+
18
+ --------------------
19
+ 8.0.1
20
+ --------------------
21
+ - Adds app key to user agent string on request
22
+
1
23
  --------------------
2
24
  8.0.0
3
25
  --------------------
data/README.rst CHANGED
@@ -1,6 +1,5 @@
1
- .. image:: https://travis-ci.org/urbanairship/ruby-library.svg?branch=master
2
- :target: https://travis-ci.org/urbanairship/ruby-library
3
-
1
+ .. image:: https://github.com/urbanairship/ruby-library/actions/workflows/ci.yaml/badge.svg
2
+ :target: https://github.com/urbanairship/ruby-library/
4
3
  About
5
4
  =====
6
5
 
@@ -120,7 +119,7 @@ Broadcast to All Devices
120
119
  p = airship.create_push
121
120
  p.audience = UA.all
122
121
  p.notification = UA.notification(alert: 'Hello')
123
- p.device_types = UA.all
122
+ p.device_types = UA.device_types(['ios','android'])
124
123
  p.send_push
125
124
 
126
125
  Simple Tag Push
@@ -136,7 +135,7 @@ Simple Tag Push
136
135
  p = airship.create_push
137
136
  p.audience = UA.tag('some_tag')
138
137
  p.notification = UA.notification(alert: 'Hello')
139
- p.device_types = UA.all
138
+ p.device_types = UA.device_types(['ios','android'])
140
139
  p.send_push
141
140
 
142
141
  Specify the Airship server used to make your requests
@@ -176,6 +175,22 @@ Finally, you can change the targeted server on a request basis:
176
175
  # The Urbanairship configuration is overridden by the client and the
177
176
  # request will be sent to the 'go.urbanairship.com' server
178
177
 
178
+ Using Bearer Token Auth
179
+ -----------------------
180
+
181
+ .. code-block:: ruby
182
+
183
+ require 'urbanairship'
184
+
185
+ UA = Urbanairship
186
+ airship = UA::Client.new(key:'application_key', token:'token')
187
+ # Then continue as you would otherwise
188
+
189
+ **Note**: If you include a token in your instantiation, the request
190
+ will use bearer token auth. Bearer token auth is required for some
191
+ endpoints, but not supported by others. Please check `the Airship
192
+ docs site <https://docs.airship.com/>`_ to see where it is supported.
193
+
179
194
  Contributing
180
195
  ============
181
196
 
data/docs/examples.rst CHANGED
@@ -18,7 +18,7 @@ Simple broadcast to all devices
18
18
  push = airship.create_push
19
19
  push.audience = UA.all
20
20
  push.notification = UA.notification(alert: "Hello, world!")
21
- push.device_types = UA.all
21
+ push.device_types = UA.device_types(['ios','android'])
22
22
  push.send_push
23
23
 
24
24
 
@@ -92,7 +92,7 @@ Rich Push with extra and without notification
92
92
 
93
93
  push = airship.create_push
94
94
  push.audience = UA.all
95
- push.device_types = UA.all
95
+ push.device_types = UA.device_types(['ios','android'])
96
96
  push.message = UA.message(
97
97
  title: "Your package is on its way!",
98
98
  body: "<h1>Would you please complete our customer survey?</h1>",
data/docs/index.rst CHANGED
@@ -1,9 +1,8 @@
1
1
  Airship Ruby Library
2
- ==========================
2
+ ====================
3
3
 
4
4
  ``urbanairship`` is a Ruby library for using the `Airship
5
- <http://airship.com/>`_ web service API for push notifications and
6
- rich app pages.
5
+ <http://airship.com/>`_ web service API for messaging.
7
6
 
8
7
 
9
8
  Installation
@@ -27,10 +26,9 @@ Using the library
27
26
 
28
27
  The library is intended to be used with the small footprint of a single
29
28
  import. To get started, import the package, and create an
30
- :rb:class:`Airship` object representing a single UA application.
29
+ :rb:class:`Airship` object representing a single Airship project.
31
30
 
32
- Note that channels are preferred over ``device_token`` and ``apid``. See:
33
- `documentation on channels <channels>`_.
31
+ The library uses `rest-client <https://github.com/rest-client/rest-client>`_ for communication with the Airship API.
34
32
 
35
33
  .. code-block:: ruby
36
34
 
@@ -40,18 +38,23 @@ Note that channels are preferred over ``device_token`` and ``apid``. See:
40
38
  p = airship.create_push
41
39
  p.audience = UA.all
42
40
  p.notification = UA.notification(alert: 'Hello')
43
- p.device_types = UA.all
41
+ p.device_types = UA.device_types(['ios','android'])
44
42
  p.send_push
45
43
 
46
- The library uses `unirest`_ for communication with the UA API.
44
+ We in the process of migrating code examples away from these docs and into the
45
+ regular `Airship API reference <https://docs.airship.com/api/ua/>`_
46
+ (select "Ruby Library"), so please check there for more examples.
47
+
48
+ Please also see `the README <https://github.com/urbanairship/ruby-library/blob/main/README.rst>`_
49
+ for detailed instructions on how to use bearer token auth and alternative servers.
47
50
 
48
51
 
49
52
  Development
50
53
  -----------
51
54
 
52
- The library source code is `available on GitHub <github>`_.
55
+ The library source code is `available on GitHub <https://github.com/urbanairship/ruby-library>`_.
53
56
 
54
- Tests can be run with rspec_:
57
+ Tests can be run with `rspec <https://rspec.info/>`_.
55
58
 
56
59
  Contents:
57
60
 
@@ -66,7 +69,7 @@ Contents:
66
69
  named_user.rst
67
70
  reports.rst
68
71
  static_lists.rst
69
- location.rst
72
+ tag_lists.rst
70
73
  exceptions.rst
71
74
  examples.rst
72
75
  create_and_send.rst
@@ -84,9 +87,3 @@ Indices and tables
84
87
  * :ref:`genindex`
85
88
  * :ref:`modindex`
86
89
  * :ref:`search`
87
-
88
-
89
- .. _channels: http://docs.airship.com/topic-guides/channels.html
90
- .. _unirest: http://unirest.io/ruby.html
91
- .. _github: https://github.com/urbanairship/ruby-library
92
- .. _rspec: https://nose.readthedocs.org/en/latest/
data/docs/push.rst CHANGED
@@ -22,7 +22,7 @@ and device types:
22
22
  push = airship.create_push
23
23
  push.audience = UA.all
24
24
  push.notification = UA.notification(alert: 'Hello')
25
- push.device_types = UA.all
25
+ push.device_types = UA.device_types(['ios','android'])
26
26
  push.send_push
27
27
 
28
28
 
@@ -443,12 +443,6 @@ types you wish to target with a list of strings:
443
443
 
444
444
  push.device_types = UA.device_types(['ios', 'android', 'web', 'open::example'])
445
445
 
446
- or with the ``all`` shortcut.
447
-
448
- .. code-block:: ruby
449
-
450
- push.device_types = UA.all
451
-
452
446
 
453
447
  Delivery
454
448
  --------
@@ -0,0 +1,76 @@
1
+ Tag Lists
2
+ =========
3
+
4
+ Bulk add and/or remove tags by uploading a CSV file of Airship users. For more
5
+ information about the use of this endpoint, incluiding CSV file formatting requirements
6
+ please see `the Airship Tag Lists API documentation
7
+ <https://docs.airship.com/api/ua/#tag-tag-lists>`__
8
+
9
+
10
+ Create List
11
+ -----------
12
+
13
+ Add tags to your contacts by creating a list and uploading CSV file with user identifiers.
14
+ The body of the request contains the name, description, and optional metadata for the
15
+ list. After you define a list, you populate it with a call to the Upload Tag List method.
16
+
17
+ .. code-block:: ruby
18
+
19
+ require 'urbanairship'
20
+ UA = Urbanairship
21
+ airship = UA::Client.new(key: 'app_key', secret: 'master_secret')
22
+ tags = {'tag_group_name': ['tag1', 'tag2']}
23
+
24
+ tag_list = UA::TagList.new(client: airship)
25
+ tag_list.name = 'ua_tags_list_name'
26
+ tag_list.create(description: 'description', extra: {'key': 'value'}, add: tags)
27
+
28
+
29
+ Upload List
30
+ -----------
31
+
32
+ Upload a CSV that will set tag values on the specified channels or named users. See `the
33
+ Airship API documentation <https://docs.airship.com/api/ua/#operation-api-tag-lists-list_name-csv-put>`__ for CSV formatting requirements. Set
34
+ the optional `gzip` parameter to `true` if your file is gzip compressed.
35
+
36
+ .. code-block:: ruby
37
+
38
+ require 'urbanairship'
39
+ UA = Urbanairship
40
+ airship = UA::Client.new(key: 'app_key', secret: 'master_secret')
41
+
42
+ tag_list = UA::TagList.new(client: airship)
43
+ tag_list.name = 'ua_tags_list_name'
44
+ tag_list.upload(csv_file: 'file_content', gzip: true)
45
+
46
+
47
+ Dowload List Errors
48
+ -------------------
49
+
50
+ During processing, after a list is uploaded, errors can occur. Depending on the type
51
+ of list processing, an error file may be created, showing a user exactly what went wrong.
52
+
53
+ .. code-block:: ruby
54
+
55
+ require 'urbanairship'
56
+ UA = Urbanairship
57
+ airship = UA::Client.new(key: 'app_key', secret: 'master_secret')
58
+
59
+ tag_list = UA::TagList.new(client: airship)
60
+ error_csv = tag_list.errors
61
+
62
+
63
+ Retrieve All Tag Lists
64
+ ----------------------
65
+
66
+ Retrieve information about all tag lists. This call returns a list of metadata that
67
+ will not contain the actual lists of users.
68
+
69
+ .. code-block:: ruby
70
+
71
+ require 'urbanairship'
72
+ UA = Urbanairship
73
+ airship = UA::Client.new(key: 'app_key', secret: 'master_secret')
74
+
75
+ tag_list = UA::TagList.new(client: airship)
76
+ list_response = tag_list.list
data/example/pusher.rb CHANGED
@@ -3,19 +3,15 @@ class Pusher
3
3
  require 'urbanairship'
4
4
  UA = Urbanairship
5
5
 
6
- def send_message
6
+ def send_broadcast_message
7
7
  airship = UA::Client.new(key:'app_key', secret:'master_secret')
8
8
  p = airship.create_push
9
9
  p.audience = UA.all
10
10
  p.notification = UA.notification(alert: 'Hello')
11
- p.device_types = UA.all
12
- p.in_app = UA.in_app(
13
- alert: 'This is a test message!',
14
- display_type: 'banner'
15
- )
11
+ p.device_types = UA.device_types(['ios','android'])
16
12
  p.send_push
17
13
  end
18
14
 
19
15
  end
20
16
 
21
- Pusher.new.send_message
17
+ Pusher.new.send_broadcast_message
@@ -15,10 +15,9 @@ module Urbanairship
15
15
  # @param [Object] secret Application Secret
16
16
  # @param [String] server Airship server to use ("go.airship.eu" or "go.urbanairship.com").
17
17
  # Used only when the request is sent with a "path", not an "url".
18
- # @param [String] token Application Auth Token (for custom events endpoint)
18
+ # @param [String] token Application Auth Token
19
19
  # @return [Object] Client
20
- def initialize(key: required('key'), secret: required('secret'),
21
- server: Urbanairship.configuration.server, token: nil)
20
+ def initialize(key: required('key'), secret: nil, server: Urbanairship.configuration.server, token: nil)
22
21
  @key = key
23
22
  @secret = secret
24
23
  @server = server
@@ -52,11 +51,15 @@ module Urbanairship
52
51
 
53
52
  raise ArgumentError.new("path and url can't be both nil") if path.nil? && url.nil?
54
53
 
55
- headers = {'User-Agent' => 'UARubyLib/' + Urbanairship::VERSION}
54
+ headers = {'User-Agent' => 'UARubyLib/' + Urbanairship::VERSION + ' ' + @key}
56
55
  headers['Accept'] = 'application/vnd.urbanairship+json; version=3'
57
56
  headers['Content-Type'] = content_type unless content_type.nil?
58
57
  headers['Content-Encoding'] = encoding unless encoding.nil?
59
58
 
59
+ if @token != nil
60
+ auth_type = :bearer
61
+ end
62
+
60
63
  if auth_type == :bearer
61
64
  raise ArgumentError.new('token must be provided as argument if auth_type=bearer') if @token.nil?
62
65
  headers['X-UA-Appkey'] = @key
@@ -82,6 +85,7 @@ module Urbanairship
82
85
  }
83
86
 
84
87
  if auth_type == :basic
88
+ raise ArgumentError.new('secret must be provided as argument if auth_type=basic') if @secret.nil?
85
89
  params[:user] = @key
86
90
  params[:password] = @secret
87
91
  end
@@ -34,10 +34,6 @@ module Urbanairship
34
34
  "/lists/#{path}"
35
35
  end
36
36
 
37
- def location_path(path='')
38
- "/location/#{path}"
39
- end
40
-
41
37
  def named_users_path(path='')
42
38
  "/named_users/#{path}"
43
39
  end
@@ -66,6 +62,10 @@ module Urbanairship
66
62
  "/segments/#{path}"
67
63
  end
68
64
 
65
+ def tag_lists_path(path='')
66
+ "/tag-lists/#{path}"
67
+ end
68
+
69
69
  # Helper method for required keyword args in Ruby 2.0 that is compatible with 2.1+
70
70
  # @example
71
71
  # def say(greeting: required('greeting'))
@@ -0,0 +1,82 @@
1
+ require 'urbanairship'
2
+ require 'tempfile'
3
+
4
+ module Urbanairship
5
+ module Devices
6
+ class TagList
7
+ include Urbanairship::Common
8
+ include Urbanairship::Loggable
9
+ attr_accessor :name
10
+
11
+ def initialize(client: required('client'))
12
+ fail ArgumentError, 'Client cannot be set to nil' if client.nil?
13
+ @client = client
14
+ end
15
+
16
+ def create(description: nil, extra: nil, add:nil, remove: nil, set: nil)
17
+ fail ArgumentError, 'Name must be set' if name.nil?
18
+ payload = {'name': name}
19
+ payload['description'] = description unless description.nil?
20
+ payload['extra'] = extra unless extra.nil?
21
+ payload['add'] = add unless add.nil?
22
+ payload['remove'] = remove unless remove.nil?
23
+ payload['set'] = set unless set.nil?
24
+
25
+ response = @client.send_request(
26
+ method: 'POST',
27
+ body: JSON.dump(payload),
28
+ path: tag_lists_path,
29
+ content_type: 'application/json'
30
+ )
31
+ logger.info("Created Tag List for #{@name}")
32
+ response
33
+ end
34
+
35
+ def upload(csv_file: required('csv_file'), gzip: false)
36
+ fail ArgumentError, 'Name must be set' if name.nil?
37
+
38
+ if gzip
39
+ response = @client.send_request(
40
+ method: 'PUT',
41
+ body: csv_file,
42
+ path: tag_lists_path(@name + '/csv/'),
43
+ content_type: 'text/csv',
44
+ encoding: gzip
45
+ )
46
+ else
47
+ response = @client.send_request(
48
+ method: 'PUT',
49
+ body: csv_file,
50
+ path: tag_lists_path(@name + '/csv/'),
51
+ content_type: 'text/csv'
52
+ )
53
+ end
54
+
55
+ logger.info("Uploaded a tag list for #{@name}")
56
+ response
57
+ end
58
+
59
+ def errors
60
+ fail ArgumentError, 'Name must be set' if name.nil?
61
+
62
+ response = @client.send_request(
63
+ method: 'GET',
64
+ path: tag_lists_path(@name + '/errors/')
65
+ )
66
+ logger.info("Got error CSV for tag list #{@name}")
67
+ response
68
+ end
69
+
70
+ def list
71
+ fail ArgumentError, 'Name must be set' if name.nil?
72
+
73
+ response = @client.send_request(
74
+ method: 'GET',
75
+ path: tag_lists_path
76
+ )
77
+ logger.info("Got tag lists listing")
78
+ response
79
+ end
80
+ end
81
+ end
82
+ end
@@ -78,67 +78,6 @@ module Urbanairship
78
78
  { not: child }
79
79
  end
80
80
 
81
- # Select a recent date range for a location selector.
82
- # Valid selectors are:
83
- # :minutes :hours :days :weeks :months :years
84
- #
85
- # @example
86
- # recent_date(months: 6) # => { recent: { months: 6 }}
87
- # recent_date(weeks: 3) # => { recent: { weeks: 3 }}
88
- def recent_date(**params)
89
- fail ArgumentError, 'Only one range allowed' if params.size != 1
90
- k, v = params.first
91
- unless DATE_TERMS.include?(k)
92
- fail ArgumentError, "#{k} not in #{DATE_TERMS}"
93
- end
94
- { recent: { k => v } }
95
- end
96
-
97
- # Select an absolute date range for a location selector.
98
- #
99
- # @param resolution [Symbol] Time resolution specifier, one of
100
- # :minutes :hours :days :weeks :months :years
101
- # @param start [String] UTC start time in ISO 8601 format.
102
- # @param the_end [String] UTC end time in ISO 8601 format.
103
- #
104
- # @example
105
- # absolute_date(resolution: :months, start: '2013-01', the_end: '2013-06')
106
- # #=> {months: {end: '2013-06', start: '2013-01'}}
107
- #
108
- # absolute_date(resolution: :minutes, start: '2012-01-01 12:00',
109
- # the_end: '2012-01-01 12:45')
110
- # #=> {minutes: {end: '2012-01-01 12:45', start: '2012-01-01 12:00'}}
111
- def absolute_date(resolution: required('resolution'), start: required('start'), the_end: required('the_end'))
112
- unless DATE_TERMS.include?(resolution)
113
- fail ArgumentError, "#{resolution} not in #{DATE_TERMS}"
114
- end
115
- { resolution => { start: start, end: the_end } }
116
- end
117
-
118
- # Select a location expression.
119
- #
120
- # Location selectors are made up of either an id or an alias and a date
121
- # period specifier. Use a date specification function to generate the time
122
- # period specifier.
123
- #
124
- # @example ID location
125
- # location(id: '4oFkxX7RcUdirjtaenEQIV', date: recent_date(days: 4))
126
- # #=> {location: {date: {recent: {days: 4}},
127
- # id: '4oFkxX7RcUdirjtaenEQIV'}}
128
- #
129
- # @example Alias location
130
- # location(us_zip: '94103', date: absolute_date(
131
- # resolution: 'days', start: '2012-01-01', end: '2012-01-15'))
132
- # #=> {location: {date: {days: {end: '2012-01-15',
133
- # start: '2012-01-01'}}, us_zip: '94103'}}
134
- def location(date: required('date'), **params)
135
- unless params.size == 1
136
- fail ArgumentError, 'One location specifier required'
137
- end
138
- params[:date] = date
139
- { location: params }
140
- end
141
-
142
81
  private
143
82
 
144
83
  # Clean up a UUID for use in the library
@@ -1,3 +1,3 @@
1
1
  module Urbanairship
2
- VERSION = '8.0.0'
2
+ VERSION = '9.1.0'
3
3
  end
data/lib/urbanairship.rb CHANGED
@@ -26,7 +26,7 @@ require 'urbanairship/devices/named_user'
26
26
  require 'urbanairship/devices/open_channel'
27
27
  require 'urbanairship/reports/response_statistics'
28
28
  require 'urbanairship/devices/static_lists'
29
- require 'urbanairship/push/location'
29
+ require 'urbanairship/devices/tag_lists'
30
30
  require 'urbanairship/automations/pipeline'
31
31
  require 'urbanairship/automations/automation'
32
32
  require 'urbanairship/ab_tests/variant'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: urbanairship
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.0.0
4
+ version: 9.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Airship
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-07-02 00:00:00.000000000 Z
11
+ date: 2022-06-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -140,9 +140,10 @@ files:
140
140
  - ".github/ISSUE_TEMPLATE.md"
141
141
  - ".github/PULL_REQUEST_TEMPLATE.md"
142
142
  - ".github/SUPPORT.md"
143
+ - ".github/workflows/ci.yaml"
144
+ - ".github/workflows/release.yaml"
143
145
  - ".gitignore"
144
146
  - ".rspec"
145
- - ".travis.yml"
146
147
  - CHANGELOG
147
148
  - Gemfile
148
149
  - Guardfile
@@ -163,7 +164,6 @@ files:
163
164
  - docs/examples.rst
164
165
  - docs/exceptions.rst
165
166
  - docs/index.rst
166
- - docs/location.rst
167
167
  - docs/named_user.rst
168
168
  - docs/open_channels.rst
169
169
  - docs/push.rst
@@ -171,6 +171,7 @@ files:
171
171
  - docs/segment.rst
172
172
  - docs/sms.rst
173
173
  - docs/static_lists.rst
174
+ - docs/tag_lists.rst
174
175
  - docs/tags.rst
175
176
  - example/pusher.rb
176
177
  - lib/urbanairship.rb
@@ -199,9 +200,9 @@ files:
199
200
  - lib/urbanairship/devices/sms.rb
200
201
  - lib/urbanairship/devices/sms_notification.rb
201
202
  - lib/urbanairship/devices/static_lists.rb
203
+ - lib/urbanairship/devices/tag_lists.rb
202
204
  - lib/urbanairship/loggable.rb
203
205
  - lib/urbanairship/push/audience.rb
204
- - lib/urbanairship/push/location.rb
205
206
  - lib/urbanairship/push/payload.rb
206
207
  - lib/urbanairship/push/push.rb
207
208
  - lib/urbanairship/push/schedule.rb
@@ -229,7 +230,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
229
230
  - !ruby/object:Gem::Version
230
231
  version: '0'
231
232
  requirements: []
232
- rubygems_version: 3.1.4
233
+ rubygems_version: 3.0.3.1
233
234
  signing_key:
234
235
  specification_version: 4
235
236
  summary: Ruby Gem for using the Airship API
data/.travis.yml DELETED
@@ -1,4 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.6.7
4
- - 2.7.2
data/docs/location.rst DELETED
@@ -1,127 +0,0 @@
1
- Locations
2
- =========
3
-
4
- This class allows you to search for location information in
5
- various ways.
6
-
7
-
8
- Name Lookup
9
- -----------
10
-
11
- Search for a location boundary by name. The search primarily
12
- uses the location names, but you can also filter the results
13
- by boundary type. See `the API documentation on location
14
- <http://docs.airship.com/api/ua.html#location>`_
15
- for more information.
16
-
17
- .. code-block:: ruby
18
-
19
- require 'urbanairship'
20
- UA = Urbanairship
21
- airship = UA::Client.new(key:'application_key', secret:'master_secret')
22
- location = UA::Location.new(client: airship)
23
- location.name_lookup(name: 'name', type: 'type')
24
-
25
- .. note::
26
-
27
- ``name`` is a required parameter, but ``type`` is optional
28
-
29
-
30
- Coordinates Lookup
31
- ------------------
32
-
33
- Search for a location by latitude and longitude coordinates. Type is
34
- an optional parameter. See `the API documentation on coordinates lookup
35
- <http://docs.airship.com/api/ua.html#lat-long-lookup>`_
36
- for more information.
37
-
38
- .. code-block:: ruby
39
-
40
- require 'urbanairship'
41
- UA = Urbanairship
42
- airship = UA::Client.new(key:'application_key', secret:'master_secret')
43
- location = UA::Location.new(client: airship)
44
- location.coordinates_lookup(latitude: 123.45, longitude: 123.45, type: 'type')
45
-
46
- .. note::
47
-
48
- ``longitude`` and ``latitude`` are required parameters that must be numbers.
49
- ``Type`` is an optional parameter.
50
-
51
-
52
- Bounding Box Lookup
53
- -------------------
54
-
55
- Search for location using a bounding box. See `the documentation on
56
- bounding box lookup
57
- <http://docs.airship.com/api/ua.html#bounding-box-lookup>`_
58
- for more information.
59
-
60
- .. code-block:: ruby
61
-
62
- require 'urbanairship'
63
- UA = Urbanairship
64
- airship = UA::Client.new(key:'application_key', secret:'master_secret')
65
- location = UA::Location.new(client: airship)
66
- location.bounding_box_lookup(lat1: 123.45, long1: 123.45,
67
- lat2: 321.45, long2: 321.45, type: 'type')
68
-
69
- .. note::
70
-
71
- ``lat1``, ``long1``, ``lat2``, and ``long2`` and are required parameters that must be numbers.
72
- ``Type`` is an optional parameter.
73
-
74
-
75
- Alias Lookup
76
- ------------
77
-
78
- Search for location by alias. See `the documentation on alias lookup
79
- <http://docs.airship.com/api/ua.html#alias-lookup>`_
80
-
81
- .. code-block:: ruby
82
-
83
- require 'urbanairship'
84
- UA = Urbanairship
85
- airship = UA::Client.new(key:'application_key', secret:'master_secret')
86
- location = UA::Location.new(client: airship)
87
- location.alias_lookup(from_alias: 'us_state=CA')
88
-
89
- .. note::
90
-
91
- ``from_alias`` can either be a single alias or an array of aliases.
92
-
93
-
94
- Polygon Lookup
95
- --------------
96
-
97
- Search for location by polygon id. See `the documentation on polygon
98
- lookup <http://docs.airship.com/api/ua.html#polygon-lookup>`_
99
- for more information.
100
-
101
- .. code-block:: ruby
102
-
103
- require 'urbanairship'
104
- UA = Urbanairship
105
- airship = UA::Client.new(key:'application_key', secret:'master_secret')
106
- location = UA::Location.new(client: airship)
107
- location.polygon_lookup(polygon_id: 'id', zoom: 1)
108
-
109
- .. note::
110
-
111
- ``polygon_id`` needs to be a string. ``Zoom`` is a number ranging from 1-20.
112
-
113
-
114
- Location Date Ranges
115
- --------------------
116
-
117
- Get the possible date ranges that can be used with location endpoints. See `the documentation
118
- on location date ranges <http://docs.airship.com/api/ua.html#location-date-ranges>`__
119
- for more information.
120
-
121
- .. code-block:: ruby
122
-
123
- require 'urbanairship'
124
- UA = Urbanairship
125
- airship = UA::Client.new(key:'application_key', secret:'master_secret')
126
- l = UA::Location.new(client: airship)
127
- l.date_ranges
@@ -1,103 +0,0 @@
1
- require 'urbanairship'
2
-
3
-
4
- module Urbanairship
5
- module Push
6
- class Location
7
- include Urbanairship::Common
8
- include Urbanairship::Loggable
9
-
10
- def initialize(client: required('client'))
11
- @client = client
12
- end
13
-
14
- def name_lookup(name: required('name'), type: nil)
15
- fail ArgumentError, 'name needs to be a string' unless name.is_a? String
16
- fail ArgumentError, 'type needs to be a string' unless type.nil? or type.is_a? String
17
- path = location_path('?q=' + name)
18
- path += '&type=' + type unless type.nil?
19
- resp = @client.send_request(
20
- method: 'GET',
21
- path: path
22
- )
23
- logger.info("Retrieved location information for #{name}")
24
- resp
25
- end
26
-
27
- def coordinates_lookup(latitude: required('latitude'), longitude: required('longitude'), type: nil)
28
- fail ArgumentError,
29
- 'latitude and longitude need to be numbers' unless latitude.is_a? Numeric and longitude.is_a? Numeric
30
- fail ArgumentError, 'type needs to be a string' unless type.nil? or type.is_a? String
31
- path = location_path(latitude.to_s + ',' + longitude.to_s)
32
- path += '?type=' + type unless type.nil?
33
- resp = @client.send_request(
34
- method: 'GET',
35
- path: path
36
- )
37
- logger.info("Retrieved location information for latitude #{latitude} and longitude #{longitude}")
38
- resp
39
- end
40
-
41
- def bounding_box_lookup(lat1: required('lat1'), long1: required('long1'),
42
- lat2: required('lat2'), long2: required('long2'), type: nil)
43
-
44
- fail ArgumentError,
45
- 'lat1, long1, lat2, and long2 need to be numbers' unless lat1.is_a? Numeric and long2.is_a? Numeric\
46
- and lat2.is_a? Numeric and long2.is_a? Numeric
47
- fail ArgumentError, 'type needs to be a string' unless type.nil? or type.is_a? String
48
- path = location_path(lat1.to_s + ',' + long1.to_s + ',' + lat2.to_s + ',' + long2.to_s)
49
- path += '?type=' + type unless type.nil?
50
- resp = @client.send_request(
51
- method: 'GET',
52
- path: path
53
- )
54
- logger.info("Retrieved location information for bounding box with lat1 #{lat1}, long1 #{long1}," +
55
- " lat2 #{lat2}, and long2 #{long2}")
56
- resp
57
- end
58
-
59
- def alias_lookup(from_alias: required('from_alias'))
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
- path = location_path('from-alias?')
62
- if from_alias.is_a? Array
63
- from_alias.each do |a|
64
- fail ArgumentError, 'from_alias needs to be a string or an array of strings' unless a.is_a? String
65
- path += a + '&'
66
- end
67
- path = path.chop
68
- else
69
- path += from_alias
70
- end
71
-
72
- resp = @client.send_request(
73
- method: 'GET',
74
- path: path
75
- )
76
- logger.info("Retrieved location info from alias #{from_alias}")
77
- resp
78
- end
79
-
80
- def polygon_lookup(polygon_id: required('polygon_id'), zoom: required('zoom'))
81
- fail ArgumentError, 'polygon_id needs to be a string' unless polygon_id.is_a? String
82
- fail ArgumentError, 'zoom needs to be an integer' unless zoom.is_a? Integer
83
-
84
- path = location_path(polygon_id + '?zoom=' + zoom.to_s)
85
- resp = @client.send_request(
86
- method: 'GET',
87
- path: path
88
- )
89
- logger.info("Retrieved location info for polygon #{polygon_id} and zoom level #{zoom}")
90
- resp
91
- end
92
-
93
- def date_ranges
94
- resp = @client.send_request(
95
- method: 'GET',
96
- path: segments_path('dates/')
97
- )
98
- logger.info('Retrieved location date ranges')
99
- resp
100
- end
101
- end
102
- end
103
- end