dirigible 0.0.2 → 1.0.3
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.
- checksums.yaml +4 -4
- data/README.md +90 -2
- data/lib/dirigible/error.rb +1 -1
- data/lib/dirigible/push.rb +2 -2
- data/lib/dirigible/utils.rb +11 -9
- data/lib/dirigible/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 05e09bc4727ec81713e662fd36410075bcf8231d
|
4
|
+
data.tar.gz: 3279148e7a9f79081a247c2cf9abbe7632606a8e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6efaec6f18a60ad788a522e7d5b3b51db9ad89baac21429e4babbb2c1df985493c13726a61b70418ff68180ac12b225f5c08be12e2803fa62f8d93e96c021ab1
|
7
|
+
data.tar.gz: eae409dde8ffc469765f98d02e8ec93b6d8ab8a2717d744aff099fbe70a99c08df557902f93e7f3d36c99b8eb9e87664c5fc5e3e87034289b280d40d07668c3d
|
data/README.md
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
A Ruby wrapper for the Urban Airship v3 API
|
4
4
|
|
5
|
+
[](https://gemnasium.com/anthonator/dirigible) [](https://codeclimate.com/github/anthonator/dirigible)
|
6
|
+
|
5
7
|
## Documentation
|
6
8
|
|
7
9
|
You can view detailed documentation of this library at http://rdoc.info/github/anthonator/dirigible/master/frames. We try to make sure that our documentation is up-to-date and thorough. However, we do recommend keeping the Urban Airship v3 API documentation handy.
|
@@ -22,7 +24,7 @@ Or install it yourself as:
|
|
22
24
|
|
23
25
|
$ gem install dirigible
|
24
26
|
|
25
|
-
##
|
27
|
+
## tl;dr
|
26
28
|
|
27
29
|
Configure dirigible...
|
28
30
|
|
@@ -44,10 +46,96 @@ begin
|
|
44
46
|
})
|
45
47
|
puts "YAY!" if response[:ok] == true # All JSON responses are converted to hash's
|
46
48
|
rescue Dirigible::Error => e
|
47
|
-
puts "BUSTED!!!"
|
49
|
+
puts "BUSTED!!! #{e.message}"
|
50
|
+
end
|
51
|
+
```
|
52
|
+
|
53
|
+
## Configuration
|
54
|
+
|
55
|
+
In order to make any requests you must first configure your app key and master secret...
|
56
|
+
|
57
|
+
```ruby
|
58
|
+
Dirigible.configure do |config|
|
59
|
+
config.app_key = YOUR_APP_KEY
|
60
|
+
config.master_secret = YOUR_MASTER_SECRET
|
61
|
+
end
|
62
|
+
```
|
63
|
+
|
64
|
+
Change the HTTP library used for making requests to Urban Airship. Since we use [Faraday](https://github.com/lostisland/faraday) you can use any supported adapter...
|
65
|
+
|
66
|
+
```ruby
|
67
|
+
Dirigible.configure do |config|
|
68
|
+
|
69
|
+
...
|
70
|
+
|
71
|
+
config.http_adapter = :excon
|
48
72
|
end
|
49
73
|
```
|
50
74
|
|
75
|
+
## Supported Endpoints
|
76
|
+
|
77
|
+
### Push
|
78
|
+
|
79
|
+
* [Send a push notification](http://rdoc.info/github/anthonator/dirigible/master/Dirigible/Push.create)
|
80
|
+
* [Validate a push notification](http://rdoc.info/github/anthonator/dirigible/master/Dirigible/Push.validate)
|
81
|
+
|
82
|
+
### Schedule
|
83
|
+
|
84
|
+
* [Schedule a notification](http://rdoc.info/github/anthonator/dirigible/master/Dirigible/Schedule.create)
|
85
|
+
* [List schedules](http://rdoc.info/github/anthonator/dirigible/master/Dirigible/Schedule.list)
|
86
|
+
* [List a specific schedule](http://rdoc.info/github/anthonator/dirigible/master/Dirigible/Schedule.get)
|
87
|
+
* [Update a schedule](http://rdoc.info/github/anthonator/dirigible/master/Dirigible/Schedule.update)
|
88
|
+
* [Delete a schedule](http://rdoc.info/github/anthonator/dirigible/master/Dirigible/Schedule.delete)
|
89
|
+
|
90
|
+
### Tag
|
91
|
+
|
92
|
+
* [List tags](http://rdoc.info/github/anthonator/dirigible/master/Dirigible/Tag.list)
|
93
|
+
* [Create a tag](http://rdoc.info/github/anthonator/dirigible/master/Dirigible/Tag.create)
|
94
|
+
* [Adding and removing devices from a tag](http://rdoc.info/github/anthonator/dirigible/master/Dirigible/Tag.add_or_remove)
|
95
|
+
* [Delete a tag](http://rdoc.info/github/anthonator/dirigible/master/Dirigible/Tag.delete)
|
96
|
+
* [Batch modification of tags](http://rdoc.info/github/anthonator/dirigible/master/Dirigible/Tag.batch)
|
97
|
+
|
98
|
+
### Feed
|
99
|
+
|
100
|
+
* [Create a feed](http://rdoc.info/github/anthonator/dirigible/master/Dirigible/Feed.create)
|
101
|
+
* [Get feed details](http://rdoc.info/github/anthonator/dirigible/master/Dirigible/Feed.get)
|
102
|
+
* [Update a feed](http://rdoc.info/github/anthonator/dirigible/master/Dirigible/Feed.update)
|
103
|
+
* [Delete a feed](http://rdoc.info/github/anthonator/dirigible/master/Dirigible/Feed.delete)
|
104
|
+
|
105
|
+
### Device Information
|
106
|
+
|
107
|
+
* [Get Android APID device information](http://rdoc.info/github/anthonator/dirigible/master/Dirigible/DeviceInformation.get_apid)
|
108
|
+
* [Get Backberry PIN device information](http://rdoc.info/github/anthonator/dirigible/master/Dirigible/DeviceInformation.get_device_pin)
|
109
|
+
* [Get iOS device token information](http://rdoc.info/github/anthonator/dirigible/master/Dirigible/DeviceInformation.get_device_token)
|
110
|
+
* [List Android APID's registered to an application](http://rdoc.info/github/anthonator/dirigible/master/Dirigible/DeviceInformation.list_apids)
|
111
|
+
* [List Blackberry PIN's registered to an application](http://rdoc.info/github/anthonator/dirigible/master/Dirigible/DeviceInformation.list_device_pin)
|
112
|
+
* [List iOS device tokens registered to an application](http://rdoc.info/github/anthonator/dirigible/master/Dirigible/DeviceInformation.list_device_token)
|
113
|
+
* [List device tokens that can't recieve messages](http://rdoc.info/github/anthonator/dirigible/master/Dirigible/DeviceInformation.device_token_feedback)
|
114
|
+
|
115
|
+
### Device Registration
|
116
|
+
|
117
|
+
* [Register an Android APID](http://rdoc.info/github/anthonator/dirigible/master/Dirigible/DeviceRegistration.register_apid)
|
118
|
+
* [Register a Blackberry PIN device](http://rdoc.info/github/anthonator/dirigible/master/Dirigible/DeviceRegistration.register_device_pin)
|
119
|
+
* [Register an iOS device token](http://rdoc.info/github/anthonator/dirigible/master/Dirigible/DeviceRegistration.register_device_token)
|
120
|
+
* [Delete a Blackberry PIN device](http://rdoc.info/github/anthonator/dirigible/master/Dirigible/DeviceRegistration.delete_device_pin)
|
121
|
+
* [Delete an iOS device token](http://rdoc.info/github/anthonator/dirigible/master/Dirigible/DeviceRegistration.delete_device_token)
|
122
|
+
|
123
|
+
### Segment
|
124
|
+
|
125
|
+
* [List all segments for an application](http://rdoc.info/github/anthonator/dirigible/master/Dirigible/Segment.list)
|
126
|
+
* [Create a segment](http://rdoc.info/github/anthonator/dirigible/master/Dirigible/Segment.create)
|
127
|
+
* [Get a specific segment](http://rdoc.info/github/anthonator/dirigible/master/Dirigible/Segment.get)
|
128
|
+
* [Update a segment](http://rdoc.info/github/anthonator/dirigible/master/Dirigible/Segment.update)
|
129
|
+
* [Delete a segment](http://rdoc.info/github/anthonator/dirigible/master/Dirigible/Segment.delete)
|
130
|
+
|
131
|
+
### Location
|
132
|
+
|
133
|
+
* [Retrieve cutoff dates](http://rdoc.info/github/anthonator/dirigible/master/Dirigible/Location.cutoff_dates)
|
134
|
+
* [Look up location boundary information](http://rdoc.info/github/anthonator/dirigible/master/Dirigible/Location.from_alias)
|
135
|
+
* [Search for locations using a bounding box](http://rdoc.info/github/anthonator/dirigible/master/Dirigible/Location.search_by_bounding_box)
|
136
|
+
* [Search for a location by latitude and longitude](http://rdoc.info/github/anthonator/dirigible/master/Dirigible/Location.search_by_latlng)
|
137
|
+
* [Search for a location boundary by name](http://rdoc.info/github/anthonator/dirigible/master/Dirigible/Location.search_by_name)
|
138
|
+
|
51
139
|
## Contributing
|
52
140
|
|
53
141
|
1. Fork it
|
data/lib/dirigible/error.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Dirigible
|
2
2
|
# Custom error class for rescuing from all known Urban Airship errors
|
3
|
-
class Error < StandardError;
|
3
|
+
class Error < StandardError; alias_method :error, :message end
|
4
4
|
|
5
5
|
# Raised when Urban Airship returns HTTP status code 400
|
6
6
|
class BadRequest < Error; end
|
data/lib/dirigible/push.rb
CHANGED
@@ -3,8 +3,8 @@ class Dirigible::Push
|
|
3
3
|
# Send a push notification to a specified device or list
|
4
4
|
# of devices. Must be one of:
|
5
5
|
#
|
6
|
-
# * A single
|
7
|
-
# * An array of one or more
|
6
|
+
# * A single {http://docs.urbanairship.com/reference/api/v3/push.html#push-object Push Object}
|
7
|
+
# * An array of one or more {http://docs.urbanairship.com/reference/api/v3/push.html#push-object Push Object}
|
8
8
|
#
|
9
9
|
# @example Example request:
|
10
10
|
# Dirigible::Push.create({
|
data/lib/dirigible/utils.rb
CHANGED
@@ -2,16 +2,18 @@ module Dirigible
|
|
2
2
|
# @private
|
3
3
|
module Utils
|
4
4
|
def self.handle_api_error(response)
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
5
|
+
message = parse_json(response.body)
|
6
|
+
|
7
|
+
klass = case response.status
|
8
|
+
when 400 then BadRequest
|
9
|
+
when 401 then Unauthorized
|
10
|
+
when 404 then NotFound
|
11
|
+
when 405 then MethodNotAllowed
|
12
|
+
when 406 then NotAcceptable
|
13
|
+
else Error
|
12
14
|
end
|
13
|
-
|
14
|
-
raise
|
15
|
+
|
16
|
+
raise klass.new(message)
|
15
17
|
end
|
16
18
|
|
17
19
|
def self.parse_json(json)
|
data/lib/dirigible/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dirigible
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anthony Smith
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-11-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|