parse-ruby-client 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
@@ -94,7 +94,7 @@ module Parse
94
94
  def as_json(*a)
95
95
  {
96
96
  Protocol::KEY_TYPE => Protocol::TYPE_DATE,
97
- "iso" => value.iso8601
97
+ "iso" => value.iso8601(3)
98
98
  }
99
99
  end
100
100
 
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
- private :parse
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
- body = without_relations.to_json
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
@@ -39,6 +39,11 @@ module Parse
39
39
  add_constraint field, value
40
40
  self
41
41
  end
42
+
43
+ def not_eq(field, value)
44
+ add_constraint field, { "$ne" => value }
45
+ self
46
+ end
42
47
 
43
48
  def regex(field, expression)
44
49
  add_constraint field, { "$regex" => expression }
@@ -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.2"
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-08-31"
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 = [
@@ -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.2
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-08-31 00:00:00.000000000 Z
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: 2354067513295992545
197
+ hash: 227857004050835921
198
198
  required_rubygems_version: !ruby/object:Gem::Requirement
199
199
  none: false
200
200
  requirements: