usergrid_iron 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -181,6 +181,10 @@ usergrid_iron/spec/spec_settings.yaml to match.)
181
181
 
182
182
  ## Release notes
183
183
 
184
+ ### 0.0.8
185
+ * Bug fixes
186
+ 1. better handling of paging
187
+
184
188
  ### 0.0.7
185
189
  * Bug fixes
186
190
  1. multiple_entities? should check data['list']
@@ -3,7 +3,6 @@ module Usergrid
3
3
  include Enumerable
4
4
 
5
5
  attr_accessor :iterator_follows_cursor
6
- attr_reader :query_params
7
6
 
8
7
  def initialize(url, api_url, options={}, response=nil)
9
8
  super url, api_url, options, response
@@ -55,16 +54,16 @@ module Usergrid
55
54
  # options: 'reversed', 'start', 'cursor', 'limit', 'permission'
56
55
  def update_query(updates, query=nil, options={})
57
56
  options = options.symbolize_keys
58
- @query_params = query ? options.merge({ql: query}) : options
59
- self.put(updates, {params: @query_params })
57
+ query_params = query ? options.merge({ql: query}) : options
58
+ self.put(updates, {params: query_params })
60
59
  self
61
60
  end
62
61
 
63
62
  # options: 'reversed', 'start', 'cursor', 'limit', 'permission'
64
63
  def query(query=nil, options={})
65
64
  options = options.symbolize_keys
66
- @query_params = query ? options.merge({ql: query}) : options
67
- self.get({params: @query_params })
65
+ query_params = query ? options.merge({ql: query}) : options
66
+ self.get({params: query_params })
68
67
  self
69
68
  end
70
69
 
@@ -81,7 +80,19 @@ module Usergrid
81
80
  end
82
81
 
83
82
  def next_page
84
- query(nil, @query_params.merge({cursor: cursor}))
83
+ query(nil, query_params.merge({cursor: cursor}))
84
+ end
85
+
86
+ protected
87
+
88
+ def query_params
89
+ params = {}
90
+ if response.data['params']
91
+ response.data['params'].each do |k,v|
92
+ params[k] = v[0]
93
+ end
94
+ end
95
+ params
85
96
  end
86
97
  end
87
98
  end
@@ -1,3 +1,3 @@
1
1
  module Usergrid
2
- VERSION = '0.0.7'
2
+ VERSION = '0.0.8'
3
3
  end
@@ -8,6 +8,7 @@ describe Usergrid::Collection do
8
8
  @entity_data = (1..25).collect do |i|
9
9
  { name: "name_#{i}", value: "value_#{i+1}" }
10
10
  end
11
+ (1..3).each {|i| @entity_data[i]['three'] = 3}
11
12
  @collection.create_entities @entity_data
12
13
  end
13
14
 
@@ -63,10 +64,10 @@ describe Usergrid::Collection do
63
64
  end
64
65
 
65
66
  it "should be able to page forward by cursor" do
66
- @collection.query nil, limit: 2
67
+ @collection.query 'select * where three = 3', limit: 2
67
68
  @collection.next_page
68
- @collection.size.should eq 2
69
- @collection[0].name.should eq @entity_data[2][:name]
69
+ @collection.size.should eq 1
70
+ @collection[0].name.should eq @entity_data[3][:name]
70
71
  end
71
72
 
72
73
  it "should be able to update based on a query" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: usergrid_iron
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
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: 2012-12-31 00:00:00.000000000 Z
12
+ date: 2013-01-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client
@@ -149,7 +149,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
149
149
  version: '0'
150
150
  segments:
151
151
  - 0
152
- hash: 3136296998900059944
152
+ hash: -759495065477750704
153
153
  required_rubygems_version: !ruby/object:Gem::Requirement
154
154
  none: false
155
155
  requirements:
@@ -158,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
158
158
  version: '0'
159
159
  segments:
160
160
  - 0
161
- hash: 3136296998900059944
161
+ hash: -759495065477750704
162
162
  requirements: []
163
163
  rubyforge_project:
164
164
  rubygems_version: 1.8.24