usergrid_iron 0.9.1 → 0.9.2
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.
- checksums.yaml +4 -4
- data/README.md +6 -2
- data/lib/usergrid/core/collection.rb +8 -0
- data/lib/usergrid/core/resource.rb +6 -0
- data/lib/usergrid/version.rb +1 -1
- data/spec/usergrid/core/collection_spec.rb +13 -1
- data/spec/usergrid/core/entity_spec.rb +21 -0
- data/usergrid_iron.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f53faa7df2776d5557c02883ee9b4fc679b98b4
|
4
|
+
data.tar.gz: c130b1f04391cd5dddc2edcfb38e6a40aeb7a303
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff3beb3570d1babe8c21d4364dab63b12cb601a8ac8e979e3571d53eb7802a5c3b329a50605f7d5c40adeb840aed25c78d6a20742776198ac2bf877d1ac63d22
|
7
|
+
data.tar.gz: f9c49a5e87574f65a6f03391e4e1e10b11bba1bf6c4b0a2a191d1d9be8674ddb464e57b9e6a0c72f9466460971e1647405857ba723521cfec8947d071c50cd17
|
data/README.md
CHANGED
@@ -36,7 +36,7 @@ Awesome. Let's go!
|
|
36
36
|
For this example, we'll assume you've already set up an organization, application, and user -
|
37
37
|
just fill in your own values in the code below.
|
38
38
|
|
39
|
-
```
|
39
|
+
```ruby
|
40
40
|
require 'usergrid_iron'
|
41
41
|
|
42
42
|
# fill in your values here!
|
@@ -88,7 +88,7 @@ superuser credentials below, and follow along!
|
|
88
88
|
(Better yet: If you used the Usergrid launcher and let it initialize your database,
|
89
89
|
you shouldn't need to do anything!)
|
90
90
|
|
91
|
-
```
|
91
|
+
```ruby
|
92
92
|
require 'usergrid_iron'
|
93
93
|
|
94
94
|
usergrid_api = 'http://localhost:8080'
|
@@ -181,6 +181,10 @@ usergrid_iron/spec/spec_settings.yaml to match.)
|
|
181
181
|
|
182
182
|
## Release notes
|
183
183
|
|
184
|
+
### 0.9.2
|
185
|
+
* New features
|
186
|
+
1. delete_query (batch delete by query)
|
187
|
+
|
184
188
|
### 0.9.1
|
185
189
|
* New features
|
186
190
|
1. may now login using credentials: application.login_credentials() or organization.login_credentials()
|
@@ -59,6 +59,14 @@ module Usergrid
|
|
59
59
|
self
|
60
60
|
end
|
61
61
|
|
62
|
+
# options: 'reversed', 'start', 'cursor', 'limit', 'permission'
|
63
|
+
def delete_query(query=nil, options={})
|
64
|
+
options = options.symbolize_keys
|
65
|
+
query_params = query ? options.merge({ql: query}) : options
|
66
|
+
self.delete({params: query_params })
|
67
|
+
self
|
68
|
+
end
|
69
|
+
|
62
70
|
# options: 'reversed', 'start', 'cursor', 'limit', 'permission'
|
63
71
|
def query(query=nil, options={})
|
64
72
|
options = options.symbolize_keys
|
@@ -58,6 +58,12 @@ module Usergrid
|
|
58
58
|
put(updates, {params: options})
|
59
59
|
end
|
60
60
|
|
61
|
+
# options: 'reversed', 'start', 'cursor', 'limit', 'permission'
|
62
|
+
def delete_query(query=nil, options={})
|
63
|
+
options = options.merge({ql: query}) if query
|
64
|
+
delete({params: options})
|
65
|
+
end
|
66
|
+
|
61
67
|
def entity
|
62
68
|
get unless response
|
63
69
|
response.entity
|
data/lib/usergrid/version.rb
CHANGED
@@ -78,6 +78,14 @@ describe Usergrid::Collection do
|
|
78
78
|
entity.name.should eq @entity_data[4][:name]
|
79
79
|
end
|
80
80
|
|
81
|
+
it "should be able to delete based on a query" do
|
82
|
+
@collection.delete_query "select * where name = \'#{@entity_data[5][:name]}\'"
|
83
|
+
@collection.query
|
84
|
+
entity = @collection.detect { |e| e['name'] == "#{@entity_data[5][:name]}" }
|
85
|
+
entity.should be_nil
|
86
|
+
@entity_data.delete @entity_data[5]
|
87
|
+
end
|
88
|
+
|
81
89
|
it "should be able to iterate within the page" do
|
82
90
|
@collection.query
|
83
91
|
@collection.cursor.should_not be_nil
|
@@ -91,7 +99,11 @@ describe Usergrid::Collection do
|
|
91
99
|
@collection.query
|
92
100
|
@collection.cursor.should_not be_nil
|
93
101
|
count = 0
|
94
|
-
|
102
|
+
seen = Set.new
|
103
|
+
@collection.follow_cursor.each do |e|
|
104
|
+
seen.add?(e.uuid).should_not be_nil
|
105
|
+
count += 1
|
106
|
+
end
|
95
107
|
count.should eq @entity_data.size
|
96
108
|
end
|
97
109
|
|
@@ -52,4 +52,25 @@ describe Usergrid::Entity do
|
|
52
52
|
Usergrid::Resource::RESERVED.each { |a| hash.should_not have_key(a) }
|
53
53
|
end
|
54
54
|
|
55
|
+
it "should be able to delete itself" do
|
56
|
+
user = create_random_user @application
|
57
|
+
name = user.name
|
58
|
+
user.delete
|
59
|
+
u = @application['users'].entities.detect {|e| e.name == "#{name}"}
|
60
|
+
u.should be_nil
|
61
|
+
end
|
62
|
+
|
63
|
+
it "should be able to update and delete by query" do
|
64
|
+
dog = (@application.create_dog name: 'Vex').entity
|
65
|
+
|
66
|
+
@application['dogs'].update_query({foo: 'bar'}, "select * where name = \'#{dog.name}\'")
|
67
|
+
dog.get
|
68
|
+
dog.foo.should eq('bar')
|
69
|
+
|
70
|
+
@application['dogs'].delete_query "select * where name = \'#{dog.name}\'"
|
71
|
+
|
72
|
+
dog = @application['dogs'].entities.detect {|e| e.name == "#{dog.name}"}
|
73
|
+
dog.should be_nil
|
74
|
+
end
|
75
|
+
|
55
76
|
end
|
data/usergrid_iron.gemspec
CHANGED
@@ -3,7 +3,7 @@ require File.expand_path('../lib/usergrid/version', __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
5
|
gem.authors = ["Scott Ganyo"]
|
6
|
-
gem.email = ["
|
6
|
+
gem.email = ["scott@ganyo.com"]
|
7
7
|
gem.description = %q{Low-level gem to access Usergrid / Apigee App Services}
|
8
8
|
gem.summary = %q{Usergrid_iron enables simple, low-level Ruby access to Apigee's App Services
|
9
9
|
(aka Usergrid) REST API with minimal dependencies.}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: usergrid_iron
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott Ganyo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-09-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -82,7 +82,7 @@ dependencies:
|
|
82
82
|
version: '0'
|
83
83
|
description: Low-level gem to access Usergrid / Apigee App Services
|
84
84
|
email:
|
85
|
-
-
|
85
|
+
- scott@ganyo.com
|
86
86
|
executables:
|
87
87
|
- autospec
|
88
88
|
- htmldiff
|