parse-ruby-client 0.1.6 → 0.1.7
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/README.md +22 -1
- data/VERSION +1 -1
- data/fixtures/vcr_cassettes/test_new_model.yml +83 -0
- data/lib/parse-ruby-client.rb +2 -1
- data/lib/parse/model.rb +7 -0
- data/parse-ruby-client.gemspec +4 -1
- data/test/test_model.rb +25 -0
- metadata +5 -2
data/README.md
CHANGED
@@ -19,7 +19,7 @@ This currently depends on the gems 'json' and 'patron' for JSON support and HTTP
|
|
19
19
|
|
20
20
|
## Installation
|
21
21
|
|
22
|
-
`gem "parse-ruby-client", "~> 0.1.
|
22
|
+
`gem "parse-ruby-client", "~> 0.1.7"`
|
23
23
|
|
24
24
|
---
|
25
25
|
|
@@ -87,6 +87,27 @@ game_score = Parse::Object.new "GameScore", {
|
|
87
87
|
}
|
88
88
|
```
|
89
89
|
|
90
|
+
### ActiveRecord-style Models
|
91
|
+
|
92
|
+
I like ActiveRecord-style models, but I also want to avoid ActiveRecord-style model bloat. `Parse::Model` is just a subclass of `Parse::Object` that passes the class name into the `initialize` method.
|
93
|
+
|
94
|
+
```ruby
|
95
|
+
class Post < Parse::Model
|
96
|
+
end
|
97
|
+
```
|
98
|
+
|
99
|
+
The entire source for `Parse::Model` is just seven lines of simple Ruby:
|
100
|
+
|
101
|
+
```ruby
|
102
|
+
module Parse
|
103
|
+
class Model < Parse::Object
|
104
|
+
def initialize
|
105
|
+
super(self.class.to_s)
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
```
|
110
|
+
|
90
111
|
## Retrieving Objects
|
91
112
|
|
92
113
|
Individual objects can be retrieved with a single call to ```Parse.get()``` supplying the class and object id.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.7
|
@@ -0,0 +1,83 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://api.parse.com/1/classes/TestModelObject
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: ! '{}'
|
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
|
+
- D3Y8jNCQk6kpkKhpRGnWLYTrFGQ7j8dtDVnWZRnZ
|
20
|
+
X-Parse-Application-Id:
|
21
|
+
- PPVk6L5M9R1R8GVk8Ye9jT8f5SQNBIeoJUDJLmkT
|
22
|
+
X-Parse-Session-Token:
|
23
|
+
- ''
|
24
|
+
Expect:
|
25
|
+
- ''
|
26
|
+
response:
|
27
|
+
status:
|
28
|
+
code: 201
|
29
|
+
message: !binary |-
|
30
|
+
Q3JlYXRlZA==
|
31
|
+
headers:
|
32
|
+
!binary "QWNjZXNzLUNvbnRyb2wtQWxsb3ctT3JpZ2lu":
|
33
|
+
- !binary |-
|
34
|
+
Kg==
|
35
|
+
!binary "QWNjZXNzLUNvbnRyb2wtUmVxdWVzdC1NZXRob2Q=":
|
36
|
+
- !binary |-
|
37
|
+
Kg==
|
38
|
+
!binary "Q2FjaGUtQ29udHJvbA==":
|
39
|
+
- !binary |-
|
40
|
+
bm8tY2FjaGU=
|
41
|
+
!binary "Q29udGVudC1UeXBl":
|
42
|
+
- !binary |-
|
43
|
+
YXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOA==
|
44
|
+
!binary "RGF0ZQ==":
|
45
|
+
- !binary |-
|
46
|
+
U2F0LCAwNSBKYW4gMjAxMyAxNzowOTowNCBHTVQ=
|
47
|
+
!binary "TG9jYXRpb24=":
|
48
|
+
- !binary |-
|
49
|
+
aHR0cHM6Ly9hcGkucGFyc2UuY29tLzEvY2xhc3Nlcy9UZXN0TW9kZWxPYmpl
|
50
|
+
Y3QvUkxOVUdqSzB6TQ==
|
51
|
+
!binary "U2VydmVy":
|
52
|
+
- !binary |-
|
53
|
+
bmdpbngvMS4yLjI=
|
54
|
+
!binary "U2V0LUNvb2tpZQ==":
|
55
|
+
- !binary |-
|
56
|
+
X3BhcnNlX3Nlc3Npb249QkFoN0Jra2lEM05sYzNOcGIyNWZhV1FHT2daRlJp
|
57
|
+
SWxNV05qWWpBNFlUYzNZMkppWkdJNE9UVXpObUkyTUdVMk1XUXpOakZoTXpr
|
58
|
+
JTNELS04YWEzZWNjZGYwMWExNzNhZTdjYzBhNDlhY2MxNGU0M2FmNjk0ZWI1
|
59
|
+
OyBkb21haW49LnBhcnNlLmNvbTsgcGF0aD0vOyBleHBpcmVzPVRodSwgMDUt
|
60
|
+
SmFuLTIwMjMgMTc6MDk6MDQgR01UOyBzZWN1cmU7IEh0dHBPbmx5
|
61
|
+
!binary "U3RhdHVz":
|
62
|
+
- !binary |-
|
63
|
+
MjAxIENyZWF0ZWQ=
|
64
|
+
!binary "WC1SdW50aW1l":
|
65
|
+
- !binary |-
|
66
|
+
MTAuMTk5MDMz
|
67
|
+
!binary "WC1VYS1Db21wYXRpYmxl":
|
68
|
+
- !binary |-
|
69
|
+
SUU9RWRnZSxjaHJvbWU9MQ==
|
70
|
+
!binary "Q29udGVudC1MZW5ndGg=":
|
71
|
+
- !binary |-
|
72
|
+
NjQ=
|
73
|
+
!binary "Q29ubmVjdGlvbg==":
|
74
|
+
- !binary |-
|
75
|
+
a2VlcC1hbGl2ZQ==
|
76
|
+
body:
|
77
|
+
encoding: ASCII-8BIT
|
78
|
+
string: !binary |-
|
79
|
+
eyJjcmVhdGVkQXQiOiIyMDEzLTAxLTA1VDE3OjA4OjU0Ljc5NFoiLCJvYmpl
|
80
|
+
Y3RJZCI6IlJMTlVHakswek0ifQ==
|
81
|
+
http_version:
|
82
|
+
recorded_at: Sat, 05 Jan 2013 17:09:06 GMT
|
83
|
+
recorded_with: VCR 2.0.1
|
data/lib/parse-ruby-client.rb
CHANGED
data/lib/parse/model.rb
ADDED
data/parse-ruby-client.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "parse-ruby-client"
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.7"
|
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"]
|
@@ -31,6 +31,7 @@ Gem::Specification.new do |s|
|
|
31
31
|
"fixtures/vcr_cassettes/test_deep_parse.yml",
|
32
32
|
"fixtures/vcr_cassettes/test_destroy.yml",
|
33
33
|
"fixtures/vcr_cassettes/test_get.yml",
|
34
|
+
"fixtures/vcr_cassettes/test_new_model.yml",
|
34
35
|
"fixtures/vcr_cassettes/test_new_object.yml",
|
35
36
|
"fixtures/vcr_cassettes/test_nils_delete_keys.yml",
|
36
37
|
"fixtures/vcr_cassettes/test_object_id.yml",
|
@@ -46,6 +47,7 @@ Gem::Specification.new do |s|
|
|
46
47
|
"lib/parse/cloud.rb",
|
47
48
|
"lib/parse/datatypes.rb",
|
48
49
|
"lib/parse/error.rb",
|
50
|
+
"lib/parse/model.rb",
|
49
51
|
"lib/parse/object.rb",
|
50
52
|
"lib/parse/protocol.rb",
|
51
53
|
"lib/parse/push.rb",
|
@@ -61,6 +63,7 @@ Gem::Specification.new do |s|
|
|
61
63
|
"test/test_datatypes.rb",
|
62
64
|
"test/test_init.rb",
|
63
65
|
"test/test_init_from_cloud_code.rb",
|
66
|
+
"test/test_model.rb",
|
64
67
|
"test/test_object.rb",
|
65
68
|
"test/test_push.rb",
|
66
69
|
"test/test_query.rb",
|
data/test/test_model.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestModelObject < Parse::Model
|
4
|
+
end
|
5
|
+
|
6
|
+
class TestModel < Test::Unit::TestCase
|
7
|
+
def setup
|
8
|
+
Parse.init
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_new
|
12
|
+
VCR.use_cassette('test_new_model', :record => :new_episodes) do
|
13
|
+
tmo = TestModelObject.new
|
14
|
+
assert_equal tmo.new?, true
|
15
|
+
tmo.save
|
16
|
+
assert_equal tmo.new?, false
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_superclass
|
21
|
+
tmo = TestModelObject
|
22
|
+
assert_equal tmo.superclass, Parse::Model
|
23
|
+
assert_equal tmo.superclass.superclass, Parse::Object
|
24
|
+
end
|
25
|
+
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.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -178,6 +178,7 @@ files:
|
|
178
178
|
- fixtures/vcr_cassettes/test_deep_parse.yml
|
179
179
|
- fixtures/vcr_cassettes/test_destroy.yml
|
180
180
|
- fixtures/vcr_cassettes/test_get.yml
|
181
|
+
- fixtures/vcr_cassettes/test_new_model.yml
|
181
182
|
- fixtures/vcr_cassettes/test_new_object.yml
|
182
183
|
- fixtures/vcr_cassettes/test_nils_delete_keys.yml
|
183
184
|
- fixtures/vcr_cassettes/test_object_id.yml
|
@@ -193,6 +194,7 @@ files:
|
|
193
194
|
- lib/parse/cloud.rb
|
194
195
|
- lib/parse/datatypes.rb
|
195
196
|
- lib/parse/error.rb
|
197
|
+
- lib/parse/model.rb
|
196
198
|
- lib/parse/object.rb
|
197
199
|
- lib/parse/protocol.rb
|
198
200
|
- lib/parse/push.rb
|
@@ -208,6 +210,7 @@ files:
|
|
208
210
|
- test/test_datatypes.rb
|
209
211
|
- test/test_init.rb
|
210
212
|
- test/test_init_from_cloud_code.rb
|
213
|
+
- test/test_model.rb
|
211
214
|
- test/test_object.rb
|
212
215
|
- test/test_push.rb
|
213
216
|
- test/test_query.rb
|
@@ -227,7 +230,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
227
230
|
version: '0'
|
228
231
|
segments:
|
229
232
|
- 0
|
230
|
-
hash:
|
233
|
+
hash: -55766238074805369
|
231
234
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
232
235
|
none: false
|
233
236
|
requirements:
|