usergrid_ironhorse 0.1.1 → 0.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 28f2b98a13d3b368760c5b908fc619f41a26b866
4
- data.tar.gz: 2d8411645d057ac9101180369dd40e9c95f82cdc
3
+ metadata.gz: c0ca5041fc4ed9dde060760b5f912cc6420d3da2
4
+ data.tar.gz: ed1cba2dc008953b23a93bb867a8c4f7ba60ba2f
5
5
  SHA512:
6
- metadata.gz: ee348c8d8f12a749470810483f221a4635c2973f6bb42e4ea1c61e6efc7a70aa239c62a16481d98a9467ab6ac36c02243b9305d1a5b0af0bbe034dba1ad1cfb7
7
- data.tar.gz: cbd3e2c9cb112ac2a938fed8de633fb84d9d5f53b35c7ef1ea583230f8c09f4cc24423ad4c58e05de959cf1f23604041c18f21de93d74fa40b0468be0127fb2a
6
+ metadata.gz: e8e89a2b5f1110fd4e2a1f360cf821ccbe3ce99ca7e94f1d3480a3d3e8373117dae6f15b368abcca31187eeba0d03a707b31d07dad1e422b35c6f26c33ee3ff6
7
+ data.tar.gz: 3526808faf1012423b918dd703565dccb286b5db9b86c861639e14d899f460464ab2b5dd39d8667097444f3e18aed5c81dee299e088e398413eba2b834dbeb44
data/README.md CHANGED
@@ -152,7 +152,7 @@ usergrid_ironhorse/spec/spec_settings.yaml to match.)
152
152
 
153
153
  ## Release notes
154
154
 
155
- ### 0.1.0
155
+ ### 0.1.1
156
156
  * New Features
157
157
  1. Now prefer application client_id and client_secret (instead of auth_token) in usergrid.yml.
158
158
 
@@ -333,6 +333,12 @@ module Usergrid
333
333
  def method_missing(method_name, *args)
334
334
 
335
335
  method = method_name.to_s
336
+
337
+ if method.end_with? '!'
338
+ method.chop!
339
+ error_on_empty = true
340
+ end
341
+
336
342
  if method.start_with? 'find_all_by_'
337
343
  attribs = method.gsub /^find_all_by_/, ''
338
344
  elsif method.start_with? 'find_by_'
@@ -350,11 +356,6 @@ module Usergrid
350
356
  super
351
357
  end
352
358
 
353
- if method.end_with? '!'
354
- method.chop!
355
- error_on_empty = true
356
- end
357
-
358
359
  attribs = attribs.split '_and_'
359
360
  conditions = {}
360
361
  attribs.each { |attr| conditions[attr] = args.shift }
@@ -541,9 +542,9 @@ module Usergrid
541
542
  where(conditions).delete_all
542
543
  else
543
544
  pluck :uuid
544
- response = run_query
545
- response.entities.each {|entity| entity.delete} # todo: can this be optimized into one call?
546
- response.entities.size
545
+ response = load
546
+ response.each {|entity| entity.delete} # todo: can this be optimized into one call?
547
+ response.size
547
548
  end
548
549
  end
549
550
 
@@ -892,7 +893,18 @@ module Usergrid
892
893
  return if loaded?
893
894
  begin
894
895
  @response = run_query
895
- @records = @response.entities.collect {|r| @model_class.model_name.constantize.new(r.data)}
896
+ if (!@options[:select] or @options[:select] == '*')
897
+ @records = @response.entities.collect {|r| @model_class.model_name.constantize.new(r.data)}
898
+ else # handle list
899
+ selects = @options[:select].split ','
900
+ @records = @response.entities.collect do |r|
901
+ data = {}
902
+ (0..selects.size).each do |i|
903
+ data[selects[i]] = r[i]
904
+ end
905
+ @model_class.model_name.constantize.new(data)
906
+ end
907
+ end
896
908
  rescue RestClient::ResourceNotFound
897
909
  @records = []
898
910
  end
@@ -1,5 +1,5 @@
1
1
  module Usergrid
2
2
  module Ironhorse
3
- VERSION = '0.1.1'
3
+ VERSION = '0.1.2'
4
4
  end
5
5
  end
@@ -57,12 +57,14 @@ describe Usergrid::Ironhorse::Base do
57
57
  end
58
58
 
59
59
  it 'be created and destroyed' do
60
- foo = Foo.create name: 'foo2'
60
+ foo = Foo.create name: 'foo man'
61
61
  foo.persisted?.should be_true
62
- foo.name.should eq 'foo2'
62
+ foo.name.should eq 'foo man'
63
+ foo = Foo.find_by_name 'foo man'
64
+ foo.should_not be_nil
63
65
  foo.destroy.should be_true
64
66
  foo.persisted?.should be_false
65
- foo = Foo.find_by_name 'foo2'
67
+ foo = Foo.find_by_name 'foo man'
66
68
  foo.should be_nil
67
69
  end
68
70
 
@@ -19,8 +19,8 @@ Gem::Specification.new do |gem|
19
19
  gem.require_paths = ["lib"]
20
20
 
21
21
  gem.add_dependency 'usergrid_iron', '0.9.1'
22
- gem.add_dependency 'activemodel'
23
- gem.add_dependency 'activerecord'
22
+ gem.add_dependency 'activemodel', '~> 3.2'
23
+ gem.add_dependency 'activerecord', '~> 3.2'
24
24
  gem.add_dependency 'i18n'
25
25
 
26
26
  gem.add_development_dependency 'rake'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: usergrid_ironhorse
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.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-05-12 00:00:00.000000000 Z
11
+ date: 2014-03-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: usergrid_iron
@@ -28,30 +28,30 @@ dependencies:
28
28
  name: activemodel
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ~>
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: '3.2'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ~>
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: '3.2'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: activerecord
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ~>
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: '3.2'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ~>
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: '3.2'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: i18n
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -153,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
153
153
  version: '0'
154
154
  requirements: []
155
155
  rubyforge_project:
156
- rubygems_version: 2.0.3
156
+ rubygems_version: 2.0.6
157
157
  signing_key:
158
158
  specification_version: 4
159
159
  summary: Usergrid_ironhorse enables simple ActiveModel access to Apigee's App Services