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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 42afeea8024b07520aa806548a55546735cda5fc
4
- data.tar.gz: 8b79b9fc2185902dff6ebb1f79b49ae09438a621
3
+ metadata.gz: dc7c291da8495ada9a0beb127fa4e666e8b5cd56
4
+ data.tar.gz: 7a45e166a9ed430b467da229f1816e7390500999
5
5
  SHA512:
6
- metadata.gz: dc2d58b8c32689dce5e74fd491149af9d100424ff199ef792e08265a34ba96f9238a80e365acf5734b9df722024bcc44badb42661218d8fb52ff3d1cbb353429
7
- data.tar.gz: 06107450d1d6ca79ea42ed4f820c0c374f595b949715d11e881424d8312c01a0954d84e5f4265036b74d69ef15b8c0473453ccf6bd4f3de76e1e597f2b21a539
6
+ metadata.gz: 42870cdfa10e9cd05838a4edccc0cf55d1f7e852a5d0633fca3100c4214e867ad76c9e904e4ca53a97573901927bab475d660e94641e84279c55c7c83d3e68c4
7
+ data.tar.gz: 576864455235a157cd3046cf0c62aeaab47ae2807f86d5cd7be733f5b8ce098b308c43e75a447cfd964112f48d9882ee3109bef3b2f1be4d1a4ed806222b32cb
@@ -1,5 +1,10 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.6.7
4
+
5
+ * Added implementation of OData::Model#update_attributes.
6
+ * Added OData::Model.find implementation.
7
+
3
8
  ## 0.6.6
4
9
 
5
10
  * Added OData::Model::QueryProxy#empty?
@@ -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
 
@@ -66,6 +66,7 @@ module OData
66
66
  model.instance_variable_set(:@odata_entity, entity)
67
67
  model
68
68
  end
69
+ alias_method :find, :[]
69
70
  end
70
71
  end
71
72
  end
@@ -1,5 +1,5 @@
1
1
  module OData
2
2
  module Model
3
- VERSION = '0.6.6'
3
+ VERSION = '0.6.7'
4
4
  end
5
5
  end
@@ -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.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-10 00:00:00.000000000 Z
11
+ date: 2014-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler