parse-ruby-client 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +4 -3
- data/Gemfile.lock +7 -1
- data/README.md +10 -5
- data/VERSION +1 -1
- data/fixtures/vcr_cassettes/test_cloud_function.yml +81 -0
- data/fixtures/vcr_cassettes/test_created_at.yml +83 -0
- data/fixtures/vcr_cassettes/test_deep_parse.yml +244 -0
- data/fixtures/vcr_cassettes/test_destroy.yml +161 -0
- data/fixtures/vcr_cassettes/test_get.yml +163 -0
- data/fixtures/vcr_cassettes/test_new_object.yml +83 -0
- data/fixtures/vcr_cassettes/test_nils_delete_keys.yml +241 -0
- data/fixtures/vcr_cassettes/test_object_id.yml +83 -0
- data/fixtures/vcr_cassettes/test_parse_delete.yml +317 -0
- data/fixtures/vcr_cassettes/test_pointer.yml +83 -0
- data/fixtures/vcr_cassettes/test_server_update.yml +399 -0
- data/fixtures/vcr_cassettes/test_simple_save.yml +83 -0
- data/fixtures/vcr_cassettes/test_update.yml +161 -0
- data/fixtures/vcr_cassettes/test_updated_at.yml +161 -0
- data/fixtures/vcr_cassettes/test_user_save.yml +83 -0
- data/lib/parse-ruby-client.rb +2 -1
- data/lib/parse/cloud.rb +23 -0
- data/lib/parse/object.rb +11 -0
- data/lib/parse/protocol.rb +10 -1
- data/lib/parse/push.rb +1 -0
- data/lib/parse/query.rb +1 -0
- data/parse-ruby-client.gemspec +29 -8
- data/test/cloud_functions/MyCloudCode/cloud/main.js +4 -0
- data/test/helper.rb +8 -0
- data/test/test_client.rb +42 -34
- data/test/test_cloud.rb +29 -0
- data/test/test_object.rb +68 -44
- data/test/test_push.rb +20 -3
- data/test/test_query.rb +37 -29
- data/test/test_user.rb +30 -26
- metadata +52 -18
data/test/test_query.rb
CHANGED
@@ -5,14 +5,16 @@ Parse.init
|
|
5
5
|
class TestQuery < Test::Unit::TestCase
|
6
6
|
|
7
7
|
def test_get
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
VCR.use_cassette('test_get', :record => :new_episodes) do
|
9
|
+
post = Parse::Object.new "Post"
|
10
|
+
post["title"] = "foo"
|
11
|
+
post.save
|
11
12
|
|
12
|
-
|
13
|
+
q = Parse.get("Post", post.id)
|
13
14
|
|
14
|
-
|
15
|
-
|
15
|
+
assert_equal q.id, post.id
|
16
|
+
assert_equal q["title"], post["title"]
|
17
|
+
end
|
16
18
|
end
|
17
19
|
|
18
20
|
def test_add_contraint
|
@@ -37,37 +39,43 @@ class TestQuery < Test::Unit::TestCase
|
|
37
39
|
end
|
38
40
|
|
39
41
|
def test_limit_skip
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
42
|
+
VCR.use_cassette('test_limit_skip', :record => :new_episodes) do
|
43
|
+
q = Parse::Query.new "TestQuery"
|
44
|
+
q.limit = 2
|
45
|
+
q.skip = 3
|
46
|
+
query_matcher = has_entries(:limit => 2, :skip => 3)
|
47
|
+
Parse::Client.any_instance.expects(:request).with(anything, :get, nil, query_matcher).returns({}.to_json)
|
48
|
+
q.get
|
49
|
+
end
|
46
50
|
end
|
47
51
|
|
48
52
|
def test_count
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
53
|
+
VCR.use_cassette('test_count', :record => :new_episodes) do
|
54
|
+
q = Parse::Query.new "TestQuery"
|
55
|
+
q.count = true
|
56
|
+
query_matcher = has_entries(:count => true)
|
57
|
+
Parse::Client.any_instance.expects(:request).with(anything, :get, nil, query_matcher).returns({}.to_json)
|
58
|
+
q.get
|
59
|
+
end
|
54
60
|
end
|
55
61
|
|
56
62
|
def test_or
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
63
|
+
#VCR.use_cassette('test_or', :record => :new_episodes) do
|
64
|
+
foo = Parse::Object.new "Post"
|
65
|
+
foo["random"] = rand
|
66
|
+
foo.save
|
67
|
+
foo_query = Parse::Query.new("Post").eq("random", foo["random"])
|
68
|
+
assert_equal 1, foo_query.get.size
|
62
69
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
70
|
+
bar = Parse::Object.new "Post"
|
71
|
+
bar["random"] = rand
|
72
|
+
bar.save
|
73
|
+
bar_query = Parse::Query.new("Post").eq("random", bar["random"])
|
74
|
+
assert_equal 1, foo_query.get.size
|
68
75
|
|
69
|
-
|
70
|
-
|
76
|
+
query = foo_query.or(bar_query)
|
77
|
+
assert_equal 2, query.get.size
|
78
|
+
#end
|
71
79
|
end
|
72
80
|
|
73
81
|
def test_in_query
|
data/test/test_user.rb
CHANGED
@@ -6,36 +6,40 @@ class TestUser < Test::Unit::TestCase
|
|
6
6
|
Parse.init
|
7
7
|
end
|
8
8
|
|
9
|
-
def
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
9
|
+
def test_user_save
|
10
|
+
VCR.use_cassette('test_user_save', :record => :new_episodes) do
|
11
|
+
username = rand.to_s
|
12
|
+
data = {
|
13
|
+
:username => username,
|
14
|
+
:password => "topsecret"
|
15
|
+
}
|
16
|
+
user = Parse::User.new data
|
17
|
+
user.save
|
18
|
+
assert_equal user[Parse::Protocol::KEY_OBJECT_ID].class, String
|
19
|
+
assert_equal user[Parse::Protocol::KEY_CREATED_AT].class, String
|
20
|
+
end
|
19
21
|
end
|
20
22
|
|
21
|
-
def
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
23
|
+
def test_user_login
|
24
|
+
#VCR.use_cassette('test_user_login', :record => :new_episodes) do
|
25
|
+
u = "alan" + rand(10000000000000).to_s
|
26
|
+
data = {
|
27
|
+
:username => u,
|
28
|
+
:password => "secret"
|
29
|
+
}
|
27
30
|
|
28
|
-
|
31
|
+
user = Parse::User.new(data)
|
29
32
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
33
|
+
user.save
|
34
|
+
|
35
|
+
assert_equal user["username"], u
|
36
|
+
assert_equal user[Parse::Protocol::KEY_USER_SESSION_TOKEN].class, String
|
37
|
+
|
38
|
+
login = Parse::User.authenticate(u, "secret")
|
39
|
+
|
40
|
+
assert_equal login["username"], user["username"]
|
41
|
+
assert_equal login["sessionToken"].class, String
|
42
|
+
#end
|
39
43
|
end
|
40
44
|
|
41
45
|
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.1.
|
4
|
+
version: 0.1.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-09
|
13
|
+
date: 2012-10-09 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: patron
|
@@ -29,21 +29,21 @@ dependencies:
|
|
29
29
|
- !ruby/object:Gem::Version
|
30
30
|
version: '0'
|
31
31
|
- !ruby/object:Gem::Dependency
|
32
|
-
name:
|
32
|
+
name: bundler
|
33
33
|
requirement: !ruby/object:Gem::Requirement
|
34
34
|
none: false
|
35
35
|
requirements:
|
36
|
-
- -
|
36
|
+
- - ~>
|
37
37
|
- !ruby/object:Gem::Version
|
38
|
-
version:
|
39
|
-
type: :
|
38
|
+
version: 1.1.5
|
39
|
+
type: :development
|
40
40
|
prerelease: false
|
41
41
|
version_requirements: !ruby/object:Gem::Requirement
|
42
42
|
none: false
|
43
43
|
requirements:
|
44
|
-
- -
|
44
|
+
- - ~>
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version:
|
46
|
+
version: 1.1.5
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: shoulda
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -93,13 +93,13 @@ dependencies:
|
|
93
93
|
- !ruby/object:Gem::Version
|
94
94
|
version: 0.12.0
|
95
95
|
- !ruby/object:Gem::Dependency
|
96
|
-
name:
|
96
|
+
name: jeweler
|
97
97
|
requirement: !ruby/object:Gem::Requirement
|
98
98
|
none: false
|
99
99
|
requirements:
|
100
100
|
- - ~>
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version: 1.
|
102
|
+
version: 1.6.4
|
103
103
|
type: :development
|
104
104
|
prerelease: false
|
105
105
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -107,25 +107,41 @@ dependencies:
|
|
107
107
|
requirements:
|
108
108
|
- - ~>
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 1.
|
110
|
+
version: 1.6.4
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
112
|
+
name: rcov
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
none: false
|
115
115
|
requirements:
|
116
|
-
- -
|
116
|
+
- - ! '>='
|
117
117
|
- !ruby/object:Gem::Version
|
118
|
-
version:
|
118
|
+
version: '0'
|
119
119
|
type: :development
|
120
120
|
prerelease: false
|
121
121
|
version_requirements: !ruby/object:Gem::Requirement
|
122
122
|
none: false
|
123
123
|
requirements:
|
124
|
-
- -
|
124
|
+
- - ! '>='
|
125
125
|
- !ruby/object:Gem::Version
|
126
|
-
version:
|
126
|
+
version: '0'
|
127
127
|
- !ruby/object:Gem::Dependency
|
128
|
-
name:
|
128
|
+
name: webmock
|
129
|
+
requirement: !ruby/object:Gem::Requirement
|
130
|
+
none: false
|
131
|
+
requirements:
|
132
|
+
- - ! '>='
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: '0'
|
135
|
+
type: :development
|
136
|
+
prerelease: false
|
137
|
+
version_requirements: !ruby/object:Gem::Requirement
|
138
|
+
none: false
|
139
|
+
requirements:
|
140
|
+
- - ! '>='
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '0'
|
143
|
+
- !ruby/object:Gem::Dependency
|
144
|
+
name: vcr
|
129
145
|
requirement: !ruby/object:Gem::Requirement
|
130
146
|
none: false
|
131
147
|
requirements:
|
@@ -156,8 +172,24 @@ files:
|
|
156
172
|
- Rakefile
|
157
173
|
- VERSION
|
158
174
|
- example.rb
|
175
|
+
- fixtures/vcr_cassettes/test_cloud_function.yml
|
176
|
+
- fixtures/vcr_cassettes/test_created_at.yml
|
177
|
+
- fixtures/vcr_cassettes/test_deep_parse.yml
|
178
|
+
- fixtures/vcr_cassettes/test_destroy.yml
|
179
|
+
- fixtures/vcr_cassettes/test_get.yml
|
180
|
+
- fixtures/vcr_cassettes/test_new_object.yml
|
181
|
+
- fixtures/vcr_cassettes/test_nils_delete_keys.yml
|
182
|
+
- fixtures/vcr_cassettes/test_object_id.yml
|
183
|
+
- fixtures/vcr_cassettes/test_parse_delete.yml
|
184
|
+
- fixtures/vcr_cassettes/test_pointer.yml
|
185
|
+
- fixtures/vcr_cassettes/test_server_update.yml
|
186
|
+
- fixtures/vcr_cassettes/test_simple_save.yml
|
187
|
+
- fixtures/vcr_cassettes/test_update.yml
|
188
|
+
- fixtures/vcr_cassettes/test_updated_at.yml
|
189
|
+
- fixtures/vcr_cassettes/test_user_save.yml
|
159
190
|
- lib/parse-ruby-client.rb
|
160
191
|
- lib/parse/client.rb
|
192
|
+
- lib/parse/cloud.rb
|
161
193
|
- lib/parse/datatypes.rb
|
162
194
|
- lib/parse/error.rb
|
163
195
|
- lib/parse/object.rb
|
@@ -171,8 +203,10 @@ files:
|
|
171
203
|
- pkg/parse-ruby-client-0.0.2.gem
|
172
204
|
- pkg/parse-ruby-client-1-0.0.1.gem
|
173
205
|
- pkg/parse-ruby-client.gem
|
206
|
+
- test/cloud_functions/MyCloudCode/cloud/main.js
|
174
207
|
- test/helper.rb
|
175
208
|
- test/test_client.rb
|
209
|
+
- test/test_cloud.rb
|
176
210
|
- test/test_datatypes.rb
|
177
211
|
- test/test_init.rb
|
178
212
|
- test/test_object.rb
|
@@ -194,7 +228,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
194
228
|
version: '0'
|
195
229
|
segments:
|
196
230
|
- 0
|
197
|
-
hash:
|
231
|
+
hash: -1868119700729674580
|
198
232
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
199
233
|
none: false
|
200
234
|
requirements:
|