parsecom 0.5.8 → 0.5.9
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 +18 -2
- data/lib/parse/object.rb +14 -1
- data/lib/parse/version.rb +1 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -233,6 +233,17 @@ end
|
|
233
233
|
result = batch.run
|
234
234
|
```
|
235
235
|
|
236
|
+
Or
|
237
|
+
|
238
|
+
```ruby
|
239
|
+
seans_score = GameScore.new 'score' => 1337, 'playerName' => 'Sean Plott'
|
240
|
+
zerocools_score = GameScore.new 'score' => 1338, 'playerName' => 'ZeroCool'
|
241
|
+
Parse.batch do
|
242
|
+
seans_score.save
|
243
|
+
zerocools_score.save
|
244
|
+
end
|
245
|
+
```
|
246
|
+
|
236
247
|
### Queries
|
237
248
|
|
238
249
|
#### Basic Queries
|
@@ -350,8 +361,7 @@ game_scores = GameScore.find :where => proc {
|
|
350
361
|
#### Counting Objects
|
351
362
|
|
352
363
|
```ruby
|
353
|
-
|
354
|
-
game_scores.query_count
|
364
|
+
game_score_count = GameScore.count 'playerName' => 'Jonathan Walsh'
|
355
365
|
```
|
356
366
|
|
357
367
|
#### Compound Queries
|
@@ -607,3 +617,9 @@ If you add an exclamation mark, "!" after the method name, the method is execute
|
|
607
617
|
class_a = ClassA.new :columnA => 'Hello, parse.com'
|
608
618
|
class_a.save!
|
609
619
|
```
|
620
|
+
|
621
|
+
If you want to use the master key for all API calls, set the use_master_key flag true so that you don't need to add "!" for all methods.
|
622
|
+
|
623
|
+
```ruby
|
624
|
+
Parse.use_master_key!
|
625
|
+
```
|
data/lib/parse/object.rb
CHANGED
@@ -62,8 +62,11 @@ module Parse
|
|
62
62
|
|
63
63
|
# TODO: need refactoring
|
64
64
|
def find! object_id_or_conditions, opts={}
|
65
|
-
|
65
|
+
raw_results = parse_client.find!(self.parse_class_name, object_id_or_conditions, opts)
|
66
|
+
results = [raw_results].flatten
|
66
67
|
results.map! {|hash| self.new hash}
|
68
|
+
results.query_count = raw_results.query_count
|
69
|
+
results
|
67
70
|
end
|
68
71
|
|
69
72
|
def find_by_id! object_id, opts={}
|
@@ -87,6 +90,16 @@ module Parse
|
|
87
90
|
end
|
88
91
|
find(:all, opts).query_count
|
89
92
|
end
|
93
|
+
|
94
|
+
def count! condition=nil, &block
|
95
|
+
opts = {:limit => 0, :count => true}
|
96
|
+
if condition
|
97
|
+
opts[:where] = condition
|
98
|
+
elsif block
|
99
|
+
opts[:where] = block
|
100
|
+
end
|
101
|
+
find!(:all, opts).query_count
|
102
|
+
end
|
90
103
|
end
|
91
104
|
|
92
105
|
attr_accessor :parse_object_id, :created_at, :updated_at, :acl
|
data/lib/parse/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parsecom
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-12-
|
12
|
+
date: 2013-12-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|