parse-ruby-client 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -1,11 +1,7 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 1.8.7
4
3
  - 1.9.2
5
4
  - 1.9.3
6
- - jruby-18mode # JRuby in 1.8 mode
7
- - jruby-19mode # JRuby in 1.9 mode
8
- - rbx-18mode
9
- # - rbx-19mode # currently in active development, may or may not work for your project
10
- # uncomment this line if your project needs to run something other than `rake`:
11
- # script: bundle exec rspec spec
5
+
6
+ env:
7
+ - PARSE_APPLICATION_ID=Slw1ACyMSVguo79pWvfIq15pkUjfwTLNPpL4984b PARSE_REST_API_KEY=qJKM8CGOAn70WOyR16f16YbyKWM0nBJCEbbtAMOm
data/Gemfile CHANGED
@@ -12,4 +12,4 @@ group :development do
12
12
  gem "rcov", ">= 0"
13
13
  end
14
14
 
15
- gem "patron"
15
+ gem "patron"
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ [![Build Status](https://secure.travis-ci.org/adelevie/parse-ruby-client.png?branch=master)](http://travis-ci.org/adelevie/parse-ruby-client)
2
+
1
3
  The original creator of parse-ruby-client, [aalpern](http://github.com/aalpern), has decided to stop work on the project. I'm going to give the project new life, first by maintaining the project as a gem, and second by eventually making it power [parse_resource](http://github.com/adelevie/parse_resource) under the hood.
2
4
 
3
5
  # Ruby Client for parse.com REST API
@@ -115,11 +117,18 @@ Parse::Query.new("GameScore") \
115
117
 
116
118
  ```
117
119
 
120
+ ## Push Notifications
121
+
122
+ ```ruby
123
+ push = Parse::Push.new({"alert" => "I'm sending this push to all my app users!"})
124
+ push.save
125
+ ```
126
+
127
+
118
128
  # TODO
119
129
 
120
130
  - Add some form of debug logging
121
131
  - ~~Support for Date, Pointer, and Bytes API [data types](https://www.parse.com/docs/rest#objects-types)~~
122
- - Users
123
132
  - ACLs
124
133
  - Login
125
134
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.4
1
+ 0.0.5
data/example.rb CHANGED
@@ -28,3 +28,7 @@ Parse::Query.new(cls) \
28
28
  .value_in("score", [10, 20, 30, 40]) \
29
29
  .get
30
30
 
31
+ # Pushes
32
+ push = Parse::Push.new({ "alert"=> "I'm sending this push to all my app users!" })
33
+ push.save
34
+
@@ -22,3 +22,4 @@ require 'parse/datatypes'
22
22
  require 'parse/util'
23
23
  require 'parse/protocol'
24
24
  require 'parse/user'
25
+ require 'parse/push'
@@ -125,5 +125,9 @@ module Parse
125
125
  "/#{VERSION}/files/#{file_name}"
126
126
  end
127
127
 
128
+ # Construct a uri to send a push notification via the API.
129
+ def Protocol.push_uri
130
+ "/#{VERSION}/push"
131
+ end
128
132
  end
129
133
  end
data/lib/parse/push.rb ADDED
@@ -0,0 +1,32 @@
1
+ require 'cgi'
2
+ require 'parse/error'
3
+
4
+ module Parse
5
+ class Push
6
+ attr_accessor :channels
7
+ attr_accessor :channel
8
+ attr_accessor :type
9
+ attr_accessor :expiration_time_interval
10
+ attr_accessor :expiration_time
11
+ attr_accessor :data
12
+
13
+ def initialize(data, channel = "")
14
+ @data = data
15
+ @channel = channel
16
+ end
17
+
18
+ def save
19
+ uri = Protocol.push_uri
20
+
21
+ body = { :data => @data, :channel => @channel }
22
+ body.merge({ :channels => @channels }) if @channels
23
+ body.merge({ :expiration_time_interval => @expiration_time_interval }) if @expiration_time_interval
24
+ body.merge({ :expiration_time => @expiration_time }) if @expiration_time
25
+ body.merge({ :type => @type }) if @type
26
+
27
+ response = Parse.client.request uri, :post, body.to_json, nil
28
+ end
29
+
30
+ end
31
+
32
+ end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "parse-ruby-client"
8
- s.version = "0.0.4"
8
+ s.version = "0.0.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Alan deLevie", "Adam Alpern"]
12
- s.date = "2012-04-06"
12
+ s.date = "2012-04-19"
13
13
  s.description = "A simple Ruby client for the parse.com REST API"
14
14
  s.email = "adelevie@gmail.com"
15
15
  s.extra_rdoc_files = [
@@ -31,6 +31,7 @@ Gem::Specification.new do |s|
31
31
  "lib/parse/error.rb",
32
32
  "lib/parse/object.rb",
33
33
  "lib/parse/protocol.rb",
34
+ "lib/parse/push.rb",
34
35
  "lib/parse/query.rb",
35
36
  "lib/parse/user.rb",
36
37
  "lib/parse/util.rb",
@@ -44,6 +45,7 @@ Gem::Specification.new do |s|
44
45
  "test/test_datatypes.rb",
45
46
  "test/test_init.rb",
46
47
  "test/test_object.rb",
48
+ "test/test_push.rb",
47
49
  "test/test_query.rb",
48
50
  "test/test_user.rb"
49
51
  ]
data/test/test_push.rb ADDED
@@ -0,0 +1,14 @@
1
+ require 'helper'
2
+
3
+ class TestPush < Test::Unit::TestCase
4
+
5
+ def setup
6
+ Parse.init
7
+ end
8
+
9
+ def test_send
10
+ # gotta mock
11
+ end
12
+
13
+
14
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parse-ruby-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-04-06 00:00:00.000000000Z
13
+ date: 2012-04-19 00:00:00.000000000Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: patron
17
- requirement: &70183947794580 !ruby/object:Gem::Requirement
17
+ requirement: &70178541000720 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: '0'
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *70183947794580
25
+ version_requirements: *70178541000720
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: shoulda
28
- requirement: &70183947794100 !ruby/object:Gem::Requirement
28
+ requirement: &70178541000160 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
- version_requirements: *70183947794100
36
+ version_requirements: *70178541000160
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: bundler
39
- requirement: &70183947793620 !ruby/object:Gem::Requirement
39
+ requirement: &70178540999620 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ~>
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: 1.0.0
45
45
  type: :development
46
46
  prerelease: false
47
- version_requirements: *70183947793620
47
+ version_requirements: *70178540999620
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: jeweler
50
- requirement: &70183947793140 !ruby/object:Gem::Requirement
50
+ requirement: &70178540999120 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ~>
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: 1.6.4
56
56
  type: :development
57
57
  prerelease: false
58
- version_requirements: *70183947793140
58
+ version_requirements: *70178540999120
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: rcov
61
- requirement: &70183947792660 !ruby/object:Gem::Requirement
61
+ requirement: &70178540998580 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ! '>='
@@ -66,7 +66,7 @@ dependencies:
66
66
  version: '0'
67
67
  type: :development
68
68
  prerelease: false
69
- version_requirements: *70183947792660
69
+ version_requirements: *70178540998580
70
70
  description: A simple Ruby client for the parse.com REST API
71
71
  email: adelevie@gmail.com
72
72
  executables: []
@@ -89,6 +89,7 @@ files:
89
89
  - lib/parse/error.rb
90
90
  - lib/parse/object.rb
91
91
  - lib/parse/protocol.rb
92
+ - lib/parse/push.rb
92
93
  - lib/parse/query.rb
93
94
  - lib/parse/user.rb
94
95
  - lib/parse/util.rb
@@ -102,6 +103,7 @@ files:
102
103
  - test/test_datatypes.rb
103
104
  - test/test_init.rb
104
105
  - test/test_object.rb
106
+ - test/test_push.rb
105
107
  - test/test_query.rb
106
108
  - test/test_user.rb
107
109
  homepage: http://github.com/adelevie/parse-ruby-client
@@ -119,7 +121,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
119
121
  version: '0'
120
122
  segments:
121
123
  - 0
122
- hash: 4137621541877558226
124
+ hash: -951164517849250266
123
125
  required_rubygems_version: !ruby/object:Gem::Requirement
124
126
  none: false
125
127
  requirements: