parse-ruby-client 0.1.2 → 0.1.3
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/VERSION +1 -1
- data/lib/parse/datatypes.rb +1 -1
- data/lib/parse/object.rb +13 -10
- data/lib/parse/query.rb +5 -0
- data/parse-ruby-client.gemspec +2 -2
- data/test/test_datatypes.rb +10 -1
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.3
|
data/lib/parse/datatypes.rb
CHANGED
data/lib/parse/object.rb
CHANGED
@@ -61,15 +61,8 @@ module Parse
|
|
61
61
|
def new?
|
62
62
|
self["objectId"].nil?
|
63
63
|
end
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
# Write the current state of the local object to the API.
|
68
|
-
# If the object has never been saved before, this will create
|
69
|
-
# a new object, otherwise it will update the existing stored object.
|
70
|
-
def save
|
71
|
-
method = @parse_object_id ? :put : :post
|
72
|
-
|
64
|
+
|
65
|
+
def safe_json
|
73
66
|
without_reserved = self.dup
|
74
67
|
Protocol::RESERVED_KEYS.each { |k| without_reserved.delete(k) }
|
75
68
|
|
@@ -82,7 +75,17 @@ module Parse
|
|
82
75
|
end
|
83
76
|
}
|
84
77
|
|
85
|
-
|
78
|
+
without_relations.to_json
|
79
|
+
end
|
80
|
+
|
81
|
+
private :parse
|
82
|
+
|
83
|
+
# Write the current state of the local object to the API.
|
84
|
+
# If the object has never been saved before, this will create
|
85
|
+
# a new object, otherwise it will update the existing stored object.
|
86
|
+
def save
|
87
|
+
method = @parse_object_id ? :put : :post
|
88
|
+
body = safe_json
|
86
89
|
data = Parse.client.request(self.uri, method, body)
|
87
90
|
|
88
91
|
if data
|
data/lib/parse/query.rb
CHANGED
data/parse-ruby-client.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
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.3"
|
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-
|
12
|
+
s.date = "2012-09-20"
|
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 = [
|
data/test/test_datatypes.rb
CHANGED
@@ -17,9 +17,18 @@ class TestDatatypes < Test::Unit::TestCase
|
|
17
17
|
parse_date = Parse::Date.new data
|
18
18
|
|
19
19
|
assert_equal parse_date.value, date_time
|
20
|
-
assert_equal JSON.parse(parse_date.to_json)["iso"], date_time.iso8601
|
20
|
+
assert_equal JSON.parse(parse_date.to_json)["iso"], date_time.iso8601(3)
|
21
21
|
assert_equal 0, parse_date <=> parse_date
|
22
22
|
assert_equal 0, Parse::Date.new(data) <=> Parse::Date.new(data)
|
23
|
+
|
24
|
+
post = Parse::Object.new("Post")
|
25
|
+
post["time"] = parse_date
|
26
|
+
post.save
|
27
|
+
q = Parse.get("Post", post.id)
|
28
|
+
|
29
|
+
# time zone from parse is utc so string formats don't compare equal,
|
30
|
+
# also floating points vary a bit so only equality after rounding to millis is guaranteed
|
31
|
+
assert_equal parse_date.to_time.utc.to_datetime.iso8601(3), q["time"].to_time.utc.to_datetime.iso8601(3)
|
23
32
|
end
|
24
33
|
|
25
34
|
def test_bytes
|
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.3
|
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-
|
13
|
+
date: 2012-09-20 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: patron
|
@@ -194,7 +194,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
194
194
|
version: '0'
|
195
195
|
segments:
|
196
196
|
- 0
|
197
|
-
hash:
|
197
|
+
hash: 227857004050835921
|
198
198
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
199
199
|
none: false
|
200
200
|
requirements:
|