parse-ruby-client 0.1.15 → 0.2.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.
- data/.travis.yml +1 -0
- data/Gemfile +5 -7
- data/Gemfile.lock +39 -15
- data/README.md +6 -8
- data/VERSION +1 -1
- data/features.md +1 -1
- data/fixtures/vcr_cassettes/test_batch_update_nils_delete_keys.yml +239 -0
- data/fixtures/vcr_cassettes/test_saving_nested_objects.yml +62 -0
- data/fixtures/vcr_cassettes/test_xget.yml +182 -0
- data/lib/parse-ruby-client.rb +7 -2
- data/lib/parse/batch.rb +4 -3
- data/lib/parse/client.rb +26 -18
- data/lib/parse/datatypes.rb +22 -15
- data/lib/parse/http_client.rb +84 -0
- data/lib/parse/object.rb +56 -66
- data/lib/parse/query.rb +11 -1
- data/lib/parse/util.rb +4 -4
- data/parse-ruby-client.gemspec +9 -6
- data/test/test_batch.rb +20 -0
- data/test/test_datatypes.rb +5 -6
- data/test/test_object.rb +9 -14
- data/test/test_query.rb +27 -3
- metadata +11 -8
- data/fixtures/vcr_cassettes/test_circular_save.yml +0 -121
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
|
-
# Add dependencies required to use your gem here.
|
3
|
-
# Example:
|
4
|
-
# gem 'activesupport', '>= 2.3.5'
|
5
2
|
|
6
|
-
# Add dependencies to develop your gem here.
|
7
|
-
# Include everything needed to run rake, tests, features, etc.
|
8
3
|
group :development do
|
9
4
|
gem 'bundler'
|
10
5
|
gem 'shoulda', '>= 0'
|
11
6
|
gem 'test-unit', '= 2.5.0'
|
12
7
|
gem 'mocha', '= 0.12.0', :require => false
|
13
|
-
gem 'jeweler',
|
8
|
+
gem 'jeweler', '~> 1.8.5'
|
14
9
|
gem 'simplecov', :require => false
|
15
10
|
gem 'webmock'
|
16
11
|
gem 'vcr'
|
17
12
|
end
|
18
13
|
|
19
|
-
|
14
|
+
platforms :ruby do
|
15
|
+
gem 'patron' # skip patron for jruby
|
16
|
+
end
|
17
|
+
|
20
18
|
gem 'iron_mq'
|
data/Gemfile.lock
CHANGED
@@ -1,33 +1,57 @@
|
|
1
|
-
GIT
|
2
|
-
remote: https://github.com/foxnewsnetwork/jeweler.git
|
3
|
-
revision: f05c62e168cfc29bd82cebe06df8fd11e1ef09ee
|
4
|
-
branch: ruby-2.0.0-ifying
|
5
|
-
specs:
|
6
|
-
jeweler (1.8.4)
|
7
|
-
bundler (~> 1.3.0.pre)
|
8
|
-
git (>= 1.2.5)
|
9
|
-
rake
|
10
|
-
rdoc
|
11
|
-
|
12
1
|
GEM
|
13
2
|
remote: https://rubygems.org/
|
14
3
|
specs:
|
15
|
-
addressable (2.3.
|
4
|
+
addressable (2.3.5)
|
5
|
+
builder (3.2.2)
|
16
6
|
crack (0.3.1)
|
7
|
+
faraday (0.8.7)
|
8
|
+
multipart-post (~> 1.1)
|
17
9
|
git (1.2.5)
|
10
|
+
github_api (0.10.1)
|
11
|
+
addressable
|
12
|
+
faraday (~> 0.8.1)
|
13
|
+
hashie (>= 1.2)
|
14
|
+
multi_json (~> 1.4)
|
15
|
+
nokogiri (~> 1.5.2)
|
16
|
+
oauth2
|
17
|
+
hashie (2.0.5)
|
18
|
+
highline (1.6.19)
|
19
|
+
httpauth (0.2.0)
|
18
20
|
iron_core (0.5.1)
|
19
21
|
rest (>= 2.2.0)
|
20
22
|
iron_mq (2.1.3)
|
21
23
|
iron_core (>= 0.4.2)
|
24
|
+
jeweler (1.8.6)
|
25
|
+
builder
|
26
|
+
bundler (~> 1.0)
|
27
|
+
git (>= 1.2.5)
|
28
|
+
github_api (= 0.10.1)
|
29
|
+
highline (>= 1.6.15)
|
30
|
+
nokogiri (= 1.5.10)
|
31
|
+
rake
|
32
|
+
rdoc
|
22
33
|
json (1.8.0)
|
34
|
+
jwt (0.1.8)
|
35
|
+
multi_json (>= 1.5)
|
23
36
|
metaclass (0.0.1)
|
24
37
|
mime-types (1.20.1)
|
25
38
|
mocha (0.12.0)
|
26
39
|
metaclass (~> 0.0.1)
|
27
|
-
multi_json (1.7.
|
40
|
+
multi_json (1.7.7)
|
41
|
+
multi_xml (0.5.4)
|
42
|
+
multipart-post (1.2.0)
|
28
43
|
net-http-persistent (2.8)
|
44
|
+
nokogiri (1.5.10)
|
45
|
+
oauth2 (0.9.2)
|
46
|
+
faraday (~> 0.8)
|
47
|
+
httpauth (~> 0.2)
|
48
|
+
jwt (~> 0.1.4)
|
49
|
+
multi_json (~> 1.0)
|
50
|
+
multi_xml (~> 0.5)
|
51
|
+
rack (~> 1.2)
|
29
52
|
patron (0.4.18)
|
30
|
-
|
53
|
+
rack (1.5.2)
|
54
|
+
rake (10.1.0)
|
31
55
|
rdoc (4.0.1)
|
32
56
|
json (~> 1.4)
|
33
57
|
rest (2.2.0)
|
@@ -52,7 +76,7 @@ PLATFORMS
|
|
52
76
|
DEPENDENCIES
|
53
77
|
bundler
|
54
78
|
iron_mq
|
55
|
-
jeweler
|
79
|
+
jeweler (~> 1.8.5)
|
56
80
|
mocha (= 0.12.0)
|
57
81
|
patron
|
58
82
|
shoulda
|
data/README.md
CHANGED
@@ -26,6 +26,8 @@ Parse.init :application_id => "<your_app_id>",
|
|
26
26
|
|
27
27
|
[](https://travis-ci.org/adelevie/parse-ruby-client)
|
28
28
|
|
29
|
+
[](https://codeclimate.com/github/adelevie/parse-ruby-client)
|
30
|
+
|
29
31
|
**Table of Contents** *generated with [DocToc](http://doctoc.herokuapp.com/)*
|
30
32
|
|
31
33
|
- [Summary](#summary)
|
@@ -273,15 +275,11 @@ batch.run!
|
|
273
275
|
Because manually constructing `"path"` values is repetitive, you can use `Parse::Batch#create_object`, `Parse::Batch#update_object`, and `Parse::Batch#delete_object`. Each of these methods takes an instance of `Parse::Object` as the only argument. Then you just call `Parse::Batch#run!`. For example:
|
274
276
|
|
275
277
|
```ruby
|
276
|
-
|
277
|
-
|
278
|
+
batch = Parse::Batch.new
|
279
|
+
# making a few GameScore objects and adding them to the batch operation.
|
280
|
+
[1, 2, 3, 4, 5].each do |i|
|
278
281
|
gs = Parse::Object.new("GameScore")
|
279
282
|
gs["score"] = "#{i}"
|
280
|
-
gs
|
281
|
-
end
|
282
|
-
|
283
|
-
batch = Parse::Batch.new
|
284
|
-
game_scores.each do |gs|
|
285
283
|
batch.create_object(gs)
|
286
284
|
end
|
287
285
|
batch.run!
|
@@ -348,7 +346,7 @@ bytes = Parse::Bytes.new(data)
|
|
348
346
|
The `Pointer` type is used when mobile code sets a `PFObject` (iOS SDK) or `ParseObject` (Android SDK) as the value of another object. It contains the `className` and `objectId` of the referred-to value.
|
349
347
|
|
350
348
|
```ruby
|
351
|
-
pointer = Parse::Pointer.new({"className => gameScore", "objectId" => "GeqPWJdNqp"})
|
349
|
+
pointer = Parse::Pointer.new({"className" => "gameScore", "objectId" => "GeqPWJdNqp"})
|
352
350
|
```
|
353
351
|
|
354
352
|
Pointers to `user` objects have a `className` of `_User`. Prefixing with an underscore is forbidden for developer-defined classes and signifies the class is a special built-in.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/features.md
CHANGED
@@ -322,7 +322,7 @@ Dates are useful in combination with the built-in createdAt and updatedAt fields
|
|
322
322
|
|
323
323
|
```ruby
|
324
324
|
game_score = Parse::Query.new("GameScore").tap do |q|
|
325
|
-
g.greater_than("createdAt", Parse::
|
325
|
+
g.greater_than("createdAt", Parse::Date.new(DateTime.now)) # query options explained in more detail later in this document
|
326
326
|
end.get.first
|
327
327
|
```
|
328
328
|
|
@@ -0,0 +1,239 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://api.parse.com/1/classes/BatchTestObject
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"foo":"1"}'
|
9
|
+
headers:
|
10
|
+
Content-Type:
|
11
|
+
- application/json
|
12
|
+
Accept:
|
13
|
+
- application/json
|
14
|
+
User-Agent:
|
15
|
+
- Parse for Ruby, 0.0
|
16
|
+
X-Parse-Master-Key:
|
17
|
+
- ''
|
18
|
+
X-Parse-Rest-Api-Key:
|
19
|
+
- <X-Parse-REST-API-Key>
|
20
|
+
X-Parse-Application-Id:
|
21
|
+
- <X-Parse-Application-Id>
|
22
|
+
X-Parse-Session-Token:
|
23
|
+
- ''
|
24
|
+
Expect:
|
25
|
+
- ''
|
26
|
+
response:
|
27
|
+
status:
|
28
|
+
code: 201
|
29
|
+
message: Created
|
30
|
+
headers:
|
31
|
+
Access-Control-Allow-Origin:
|
32
|
+
- '*'
|
33
|
+
Access-Control-Request-Method:
|
34
|
+
- '*'
|
35
|
+
Cache-Control:
|
36
|
+
- no-cache
|
37
|
+
Content-Type:
|
38
|
+
- application/json; charset=utf-8
|
39
|
+
Date:
|
40
|
+
- Wed, 22 May 2013 16:29:53 GMT
|
41
|
+
Location:
|
42
|
+
- https://api.parse.com/1/classes/BatchTestObject/2ymFSQYHfE
|
43
|
+
Server:
|
44
|
+
- nginx/1.2.2
|
45
|
+
Set-Cookie:
|
46
|
+
- <COOKIE-KEY>
|
47
|
+
Status:
|
48
|
+
- 201 Created
|
49
|
+
X-Runtime:
|
50
|
+
- '0.036319'
|
51
|
+
X-Ua-Compatible:
|
52
|
+
- IE=Edge,chrome=1
|
53
|
+
Content-Length:
|
54
|
+
- '64'
|
55
|
+
Connection:
|
56
|
+
- keep-alive
|
57
|
+
body:
|
58
|
+
encoding: ASCII-8BIT
|
59
|
+
string: '{"createdAt":"2013-05-22T16:29:53.618Z","objectId":"2ymFSQYHfE"}'
|
60
|
+
http_version:
|
61
|
+
recorded_at: Wed, 22 May 2013 16:29:53 GMT
|
62
|
+
- request:
|
63
|
+
method: post
|
64
|
+
uri: https://api.parse.com/1/batch
|
65
|
+
body:
|
66
|
+
encoding: UTF-8
|
67
|
+
string: '{"requests":[{"method":"PUT","path":"/1/classes/BatchTestObject/2ymFSQYHfE","body":{"foo":{"__op":"Delete"}}}]}'
|
68
|
+
headers:
|
69
|
+
Content-Type:
|
70
|
+
- application/json
|
71
|
+
Accept:
|
72
|
+
- application/json
|
73
|
+
User-Agent:
|
74
|
+
- Parse for Ruby, 0.0
|
75
|
+
X-Parse-Master-Key:
|
76
|
+
- ''
|
77
|
+
X-Parse-Rest-Api-Key:
|
78
|
+
- <X-Parse-REST-API-Key>
|
79
|
+
X-Parse-Application-Id:
|
80
|
+
- <X-Parse-Application-Id>
|
81
|
+
X-Parse-Session-Token:
|
82
|
+
- ''
|
83
|
+
Expect:
|
84
|
+
- ''
|
85
|
+
response:
|
86
|
+
status:
|
87
|
+
code: 200
|
88
|
+
message: OK
|
89
|
+
headers:
|
90
|
+
Access-Control-Allow-Origin:
|
91
|
+
- '*'
|
92
|
+
Access-Control-Request-Method:
|
93
|
+
- '*'
|
94
|
+
Cache-Control:
|
95
|
+
- max-age=0, private, must-revalidate
|
96
|
+
Content-Type:
|
97
|
+
- application/json; charset=utf-8
|
98
|
+
Date:
|
99
|
+
- Wed, 22 May 2013 16:29:53 GMT
|
100
|
+
Etag:
|
101
|
+
- '"46d925ca6ec13b0f74a396e85f13e0d2"'
|
102
|
+
Server:
|
103
|
+
- nginx/1.2.2
|
104
|
+
Set-Cookie:
|
105
|
+
- <COOKIE-KEY>
|
106
|
+
Status:
|
107
|
+
- 200 OK
|
108
|
+
X-Runtime:
|
109
|
+
- '0.036707'
|
110
|
+
X-Ua-Compatible:
|
111
|
+
- IE=Edge,chrome=1
|
112
|
+
Content-Length:
|
113
|
+
- '54'
|
114
|
+
Connection:
|
115
|
+
- keep-alive
|
116
|
+
body:
|
117
|
+
encoding: ASCII-8BIT
|
118
|
+
string: '[{"success":{"updatedAt":"2013-05-22T16:29:53.704Z"}}]'
|
119
|
+
http_version:
|
120
|
+
recorded_at: Wed, 22 May 2013 16:29:53 GMT
|
121
|
+
- request:
|
122
|
+
method: get
|
123
|
+
uri: https://api.parse.com/1/classes/BatchTestObject/2ymFSQYHfE
|
124
|
+
body:
|
125
|
+
encoding: US-ASCII
|
126
|
+
string: ''
|
127
|
+
headers:
|
128
|
+
Content-Type:
|
129
|
+
- application/json
|
130
|
+
Accept:
|
131
|
+
- application/json
|
132
|
+
User-Agent:
|
133
|
+
- Parse for Ruby, 0.0
|
134
|
+
X-Parse-Master-Key:
|
135
|
+
- ''
|
136
|
+
X-Parse-Rest-Api-Key:
|
137
|
+
- <X-Parse-REST-API-Key>
|
138
|
+
X-Parse-Application-Id:
|
139
|
+
- <X-Parse-Application-Id>
|
140
|
+
X-Parse-Session-Token:
|
141
|
+
- ''
|
142
|
+
Expect:
|
143
|
+
- ''
|
144
|
+
response:
|
145
|
+
status:
|
146
|
+
code: 200
|
147
|
+
message: OK
|
148
|
+
headers:
|
149
|
+
Access-Control-Allow-Origin:
|
150
|
+
- '*'
|
151
|
+
Access-Control-Request-Method:
|
152
|
+
- '*'
|
153
|
+
Cache-Control:
|
154
|
+
- max-age=0, private, must-revalidate
|
155
|
+
Content-Type:
|
156
|
+
- application/json; charset=utf-8
|
157
|
+
Date:
|
158
|
+
- Wed, 22 May 2013 16:29:53 GMT
|
159
|
+
Etag:
|
160
|
+
- '"97322f30380a98755c73de04b24d660c"'
|
161
|
+
Server:
|
162
|
+
- nginx/1.2.2
|
163
|
+
Set-Cookie:
|
164
|
+
- <COOKIE-KEY>
|
165
|
+
Status:
|
166
|
+
- 200 OK
|
167
|
+
X-Runtime:
|
168
|
+
- '0.046347'
|
169
|
+
X-Ua-Compatible:
|
170
|
+
- IE=Edge,chrome=1
|
171
|
+
Content-Length:
|
172
|
+
- '103'
|
173
|
+
Connection:
|
174
|
+
- keep-alive
|
175
|
+
body:
|
176
|
+
encoding: ASCII-8BIT
|
177
|
+
string: '{"createdAt":"2013-05-22T16:29:53.618Z","updatedAt":"2013-05-22T16:29:53.704Z","objectId":"2ymFSQYHfE"}'
|
178
|
+
http_version:
|
179
|
+
recorded_at: Wed, 22 May 2013 16:29:53 GMT
|
180
|
+
- request:
|
181
|
+
method: get
|
182
|
+
uri: https://api.parse.com/1/classes/BatchTestObject/2ymFSQYHfE
|
183
|
+
body:
|
184
|
+
encoding: US-ASCII
|
185
|
+
string: ''
|
186
|
+
headers:
|
187
|
+
Content-Type:
|
188
|
+
- application/json
|
189
|
+
Accept:
|
190
|
+
- application/json
|
191
|
+
User-Agent:
|
192
|
+
- Parse for Ruby, 0.0
|
193
|
+
X-Parse-Master-Key:
|
194
|
+
- ''
|
195
|
+
X-Parse-Rest-Api-Key:
|
196
|
+
- <X-Parse-REST-API-Key>
|
197
|
+
X-Parse-Application-Id:
|
198
|
+
- <X-Parse-Application-Id>
|
199
|
+
X-Parse-Session-Token:
|
200
|
+
- ''
|
201
|
+
Expect:
|
202
|
+
- ''
|
203
|
+
response:
|
204
|
+
status:
|
205
|
+
code: 200
|
206
|
+
message: OK
|
207
|
+
headers:
|
208
|
+
Access-Control-Allow-Origin:
|
209
|
+
- '*'
|
210
|
+
Access-Control-Request-Method:
|
211
|
+
- '*'
|
212
|
+
Cache-Control:
|
213
|
+
- max-age=0, private, must-revalidate
|
214
|
+
Content-Type:
|
215
|
+
- application/json; charset=utf-8
|
216
|
+
Date:
|
217
|
+
- Wed, 22 May 2013 16:31:59 GMT
|
218
|
+
Etag:
|
219
|
+
- '"97322f30380a98755c73de04b24d660c"'
|
220
|
+
Server:
|
221
|
+
- nginx/1.2.2
|
222
|
+
Set-Cookie:
|
223
|
+
- <COOKIE-KEY>
|
224
|
+
Status:
|
225
|
+
- 200 OK
|
226
|
+
X-Runtime:
|
227
|
+
- '0.027746'
|
228
|
+
X-Ua-Compatible:
|
229
|
+
- IE=Edge,chrome=1
|
230
|
+
Content-Length:
|
231
|
+
- '103'
|
232
|
+
Connection:
|
233
|
+
- keep-alive
|
234
|
+
body:
|
235
|
+
encoding: ASCII-8BIT
|
236
|
+
string: '{"createdAt":"2013-05-22T16:29:53.618Z","updatedAt":"2013-05-22T16:29:53.704Z","objectId":"2ymFSQYHfE"}'
|
237
|
+
http_version:
|
238
|
+
recorded_at: Wed, 22 May 2013 16:31:59 GMT
|
239
|
+
recorded_with: VCR 2.4.0
|
@@ -0,0 +1,62 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://api.parse.com/1/classes/Post
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"comment":{"__op":"Delete"}}'
|
9
|
+
headers:
|
10
|
+
Content-Type:
|
11
|
+
- application/json
|
12
|
+
Accept:
|
13
|
+
- application/json
|
14
|
+
User-Agent:
|
15
|
+
- Parse for Ruby, 0.0
|
16
|
+
X-Parse-Master-Key:
|
17
|
+
- ''
|
18
|
+
X-Parse-Rest-Api-Key:
|
19
|
+
- <X-Parse-REST-API-Key>
|
20
|
+
X-Parse-Application-Id:
|
21
|
+
- <X-Parse-Application-Id>
|
22
|
+
X-Parse-Session-Token:
|
23
|
+
- ''
|
24
|
+
Expect:
|
25
|
+
- ''
|
26
|
+
response:
|
27
|
+
status:
|
28
|
+
code: 201
|
29
|
+
message: Created
|
30
|
+
headers:
|
31
|
+
Access-Control-Allow-Origin:
|
32
|
+
- '*'
|
33
|
+
Access-Control-Request-Method:
|
34
|
+
- '*'
|
35
|
+
Cache-Control:
|
36
|
+
- no-cache
|
37
|
+
Content-Type:
|
38
|
+
- application/json; charset=utf-8
|
39
|
+
Date:
|
40
|
+
- Wed, 22 May 2013 22:24:06 GMT
|
41
|
+
Location:
|
42
|
+
- https://api.parse.com/1/classes/Post/lt1txKrs3x
|
43
|
+
Server:
|
44
|
+
- nginx/1.2.2
|
45
|
+
Set-Cookie:
|
46
|
+
- <COOKIE-KEY>
|
47
|
+
Status:
|
48
|
+
- 201 Created
|
49
|
+
X-Runtime:
|
50
|
+
- '0.035016'
|
51
|
+
X-Ua-Compatible:
|
52
|
+
- IE=Edge,chrome=1
|
53
|
+
Transfer-Encoding:
|
54
|
+
- chunked
|
55
|
+
Connection:
|
56
|
+
- keep-alive
|
57
|
+
body:
|
58
|
+
encoding: ASCII-8BIT
|
59
|
+
string: '{"createdAt":"2013-05-22T22:24:06.104Z","objectId":"lt1txKrs3x"}'
|
60
|
+
http_version:
|
61
|
+
recorded_at: Wed, 22 May 2013 22:24:06 GMT
|
62
|
+
recorded_with: VCR 2.4.0
|