odata-model 0.6.6 → 0.6.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/odata/model/attributes.rb +11 -1
- data/lib/odata/model/query.rb +1 -0
- data/lib/odata/model/version.rb +1 -1
- data/spec/model/query_interface_spec.rb +10 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc7c291da8495ada9a0beb127fa4e666e8b5cd56
|
4
|
+
data.tar.gz: 7a45e166a9ed430b467da229f1816e7390500999
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 42870cdfa10e9cd05838a4edccc0cf55d1f7e852a5d0633fca3100c4214e867ad76c9e904e4ca53a97573901927bab475d660e94641e84279c55c7c83d3e68c4
|
7
|
+
data.tar.gz: 576864455235a157cd3046cf0c62aeaab47ae2807f86d5cd7be733f5b8ce098b308c43e75a447cfd964112f48d9882ee3109bef3b2f1be4d1a4ed806222b32cb
|
data/CHANGELOG.md
CHANGED
@@ -11,6 +11,17 @@ module OData
|
|
11
11
|
# ...
|
12
12
|
end
|
13
13
|
|
14
|
+
# Updates all the attributes on a model instance based on the passed in
|
15
|
+
# Hash.
|
16
|
+
# @params [Hash] hash of attributes to update
|
17
|
+
# @return [self]
|
18
|
+
def update_attributes(attribute_hash)
|
19
|
+
attribute_hash.each do |key, value|
|
20
|
+
self.send(:"#{key}=", value) if self.respond_to?(:"#{key}=")
|
21
|
+
end
|
22
|
+
self
|
23
|
+
end
|
24
|
+
|
14
25
|
# Returns an array of registered attributes.
|
15
26
|
# @return [Array]
|
16
27
|
# @api private
|
@@ -40,7 +51,6 @@ module OData
|
|
40
51
|
register_attribute(attribute_name, literal_name, options)
|
41
52
|
create_accessors(attribute_name)
|
42
53
|
#define_attribute_methods [attribute_name] if defined?(::ActiveModel)
|
43
|
-
|
44
54
|
nil
|
45
55
|
end
|
46
56
|
|
data/lib/odata/model/query.rb
CHANGED
data/lib/odata/model/version.rb
CHANGED
@@ -2,13 +2,22 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe OData::Model do
|
4
4
|
describe 'query interface' do
|
5
|
-
it { expect(Product).to respond_to(:[]) }
|
6
5
|
describe 'Product[]' do
|
6
|
+
it { expect(Product).to respond_to(:[]) }
|
7
|
+
|
7
8
|
it 'finds a model instance' do
|
8
9
|
expect(Product[0]).to be_a(Product)
|
9
10
|
end
|
10
11
|
end
|
11
12
|
|
13
|
+
describe 'Product.find' do
|
14
|
+
it { expect(Product).to respond_to(:find) }
|
15
|
+
|
16
|
+
it 'finds a model instance' do
|
17
|
+
expect(Product.find(0)).to be_a(Product)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
12
21
|
it { expect(Product).to respond_to(:where) }
|
13
22
|
describe 'Product#where' do
|
14
23
|
it { expect(Product.where(:name)).to be_a(OData::Model::QueryProxy) }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: odata-model
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Thompson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|