urbanairship-ruby 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.markdown +26 -0
  3. data/lib/urbanairship.rb +11 -9
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 634851e82146e4d7774e3d7d353650b5eb8170d3
4
- data.tar.gz: e1ccd545450475e9250172ddb12c8aa43b74cc56
3
+ metadata.gz: 0ec5b67f213f0935a81652ddc26849188688760f
4
+ data.tar.gz: b41051a185adedcf17de6bd6b2dde41a678be199
5
5
  SHA512:
6
- metadata.gz: d47927b532355e361f8ec17d16ee1f6565253952978fbefebe407ff5ffa82fd8070e56ec37f7771556774851bc1ce955366eff48a0670c5828da7c1eec5a3d3e
7
- data.tar.gz: 349b8e0cc64ae48f5da928a51bdfc467fdc337f1e95a22996ab7158234284ae5d51f779c0a75eff5e33a7390980db382787d14def68343538fedbbaef0e87a8e
6
+ metadata.gz: 15310819d23af8a7ef0244186d7f9b27cd5e7ed51cefb41d5b99a9dab3bed8b24a57c5f40251ded3f73cb41782004cdc88f82b26a145862ee8c26fa7ab19f5e2
7
+ data.tar.gz: 3d37ccc69208e673d4677ba8760387a0773f315042c90d945bc21fd398eddc3e5c0941b88b3ac9eefda9e4049081cb34e4e61bf5e6d4549725c18081a8f5b5b5
@@ -1,9 +1,24 @@
1
1
  Urbanairship is a Ruby library for interacting with the [Urban Airship API](http://urbanairship.com).
2
2
 
3
+ This gem supports Urbanairship API v3 with Ruby 1.8.6 or above. As the official gem from UA requires Ruby 2.0.0 or above, we build this gem for old Ruby versions.
4
+
5
+ http://docs.urbanairship.com/api/api-v3-migration-guide.html
6
+
3
7
  Installation
4
8
  ============
9
+
5
10
  gem install urbanairship-ruby
6
11
 
12
+ Then require `urbanairship` in your code
13
+
14
+ ```ruby
15
+ require 'urbanairship'
16
+ ```
17
+
18
+ or add to Gemfile
19
+
20
+ gem 'urbanairship-ruby', require: 'urbanairship'
21
+
7
22
  Configuration
8
23
  =============
9
24
  ```ruby
@@ -395,3 +410,14 @@ client.register_device('DEVICE-TOKEN')
395
410
  ```
396
411
 
397
412
  This can be used to use clients for different Urbanairship applications in a thread-safe manner.
413
+
414
+ Contributing to urbanairship-ruby
415
+ =================================
416
+
417
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
418
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
419
+ * Fork the project.
420
+ * Start a feature/bugfix branch.
421
+ * Commit and push until you are happy with your contribution.
422
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
423
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
@@ -18,7 +18,7 @@ module Urbanairship
18
18
  VERSION = 3
19
19
 
20
20
  def register_device(device_token, options = {})
21
- body = parse_register_options(options).to_json
21
+ body = JSON.dump(parse_register_options(options))
22
22
 
23
23
  path = device_tokens_end_point(options[:provider] || @provider)
24
24
  do_request(:put, "/api/#{path}/#{device_token}", :body => body, :authenticate_with => :application_secret)
@@ -36,11 +36,11 @@ module Urbanairship
36
36
 
37
37
  # Schedules API
38
38
  def create_schedule(schedule)
39
- do_request(:post, "/api/schedules/", :body => schedule.to_json, :authenticate_with => :master_secret)
39
+ do_request(:post, "/api/schedules/", :body => JSON.dump(schedule), :authenticate_with => :master_secret)
40
40
  end
41
41
 
42
42
  def schedules
43
- do_request(:get, "/api/schedules/", :authenticate_with => :master_secret)
43
+ quest(:get, "/api/schedules/", :authenticate_with => :master_secret)
44
44
  end
45
45
 
46
46
  def schedule(id)
@@ -48,7 +48,7 @@ module Urbanairship
48
48
  end
49
49
 
50
50
  def update_schedule(id, schedule)
51
- do_request(:put, "/api/schedules/#{id}", :body => schedule.to_json, :authenticate_with => :master_secret)
51
+ do_request(:put, "/api/schedules/#{id}", :body => JSON.dump(schedule), :authenticate_with => :master_secret)
52
52
  end
53
53
 
54
54
  def delete_schedule(id)
@@ -57,7 +57,7 @@ module Urbanairship
57
57
 
58
58
  # Push API
59
59
  def push(options = {})
60
- body = parse_push_options(options.dup).to_json
60
+ body = JSON.dump(parse_push_options(options.dup))
61
61
  do_request(:post, "/api/push/", :body => body, :authenticate_with => :master_secret)
62
62
  end
63
63
 
@@ -76,12 +76,14 @@ module Urbanairship
76
76
 
77
77
  def tag_device(params)
78
78
  provider_field = device_tokens_end_point(params[:provider] || @provider).to_sym
79
- do_request(:post, "/api/tags/#{params[:tag]}", :body => {provider_field => {:add => [params[:device_token]]}}.to_json, :authenticate_with => :master_secret)
79
+ body = JSON.dump({provider_field => {:add => [params[:device_token]]}})
80
+ do_request(:post, "/api/tags/#{params[:tag]}", :body => body, :authenticate_with => :master_secret)
80
81
  end
81
82
 
82
83
  def untag_device(params)
83
84
  provider_field = device_tokens_end_point(params[:provider] || @provider).to_sym
84
- do_request(:post, "/api/tags/#{params[:tag]}", :body => {provider_field => {:remove => [params[:device_token]]}}.to_json, :authenticate_with => :master_secret)
85
+ body = JSON.dump({provider_field => {:remove => [params[:device_token]]}})
86
+ do_request(:post, "/api/tags/#{params[:tag]}", :body => body, :authenticate_with => :master_secret)
85
87
  end
86
88
 
87
89
  # Device Tokens API
@@ -107,7 +109,7 @@ module Urbanairship
107
109
  end
108
110
 
109
111
  def create_segment(segment)
110
- do_request(:post, "/api/segments", :body => segment.to_json, :authenticate_with => :master_secret)
112
+ do_request(:post, "/api/segments", :body => JSON.dump(segment), :authenticate_with => :master_secret)
111
113
  end
112
114
 
113
115
  def segment(id)
@@ -115,7 +117,7 @@ module Urbanairship
115
117
  end
116
118
 
117
119
  def update_segment(id, segment)
118
- do_request(:put, "/api/segments/#{id}", :body => segment.to_json, :authenticate_with => :master_secret)
120
+ do_request(:put, "/api/segments/#{id}", :body => JSON.dump(segment), :authenticate_with => :master_secret)
119
121
  end
120
122
 
121
123
  def delete_segment(id)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: urbanairship-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - HuyHa
@@ -88,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
88
88
  version: '0'
89
89
  requirements: []
90
90
  rubyforge_project:
91
- rubygems_version: 2.4.1
91
+ rubygems_version: 2.4.5.1
92
92
  signing_key:
93
93
  specification_version: 4
94
94
  summary: A Ruby wrapper for the Urban Airship API