odata-model 0.6.0 → 0.6.1

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: f1c27d269a3d790289f1ddc47105ac90a2cc624a
4
- data.tar.gz: e792cdd4714423a0547a55325240544d3de93131
3
+ metadata.gz: 020be93a49670fde2d76fcd4383404740c85d18d
4
+ data.tar.gz: 0cfddee7c63aca2e5a1779b260ff65e38522ec5b
5
5
  SHA512:
6
- metadata.gz: 684aa848b09892f94f7280dc8417f72f646ad4461c17232895e0302f49e3d96ab83873bdd4ce3642f523fd946910cde11f24abaeeb983f975797ccd331076155
7
- data.tar.gz: 543ad9a2ef1ec7c142475eb96dc284d5db067a6efd4454ab5f2d8f98f281ca7afd6a1839bad2d159f1be9d907561f33b4660fd8050965e3e858a9755b4bf4825
6
+ metadata.gz: bf02e889c5318df600d166eb83257130053b2a96dde54d71b413216c6ceaf784af4e3dda4451ee97c0f0bb2517f7573edab981144e1ce8931c32dd18b44ec231
7
+ data.tar.gz: 7c15b9b21ab724a549f00a1cd09af2cdc611751e54f2dd2e39966ecfd0db78a33c7a1201aa7226bd7c32db61ff77f9f63f0977453b1f6e4ba1d0ec5bb1825e5c
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.6.1
4
+
5
+ * Added support for declaring association class_name as a string.
6
+
3
7
  ## 0.6.0
4
8
 
5
9
  * Updated to work with OData gem version 0.6.0
@@ -45,15 +45,16 @@ module OData
45
45
  class_eval do
46
46
  define_method(accessor_name) do
47
47
  association_entities = odata_entity.associations[association_name]
48
+ klass = self.class.odata_associations[association_name][:class_name]
49
+ model_klass = klass.is_a?(Class) ? klass : klass.to_s.constantize
50
+ model = model_klass.new
48
51
  if association_entities.is_a?(Enumerable)
49
52
  association_entities.collect do |entity|
50
- model = self.class.odata_associations[association_name][:class_name].new
51
53
  model.instance_variable_set(:@odata_entity, entity)
52
54
  model
53
55
  end
54
56
  else
55
57
  return nil if association_entities.nil?
56
- model = self.class.odata_associations[association_name][:class_name].new
57
58
  model.instance_variable_set(:@odata_entity, association_entities)
58
59
  model
59
60
  end
@@ -1,5 +1,5 @@
1
1
  module OData
2
2
  module Model
3
- VERSION = '0.6.0'
3
+ VERSION = '0.6.1'
4
4
  end
5
5
  end
@@ -12,5 +12,5 @@ class Product
12
12
  property 'DiscontinuedDate'
13
13
 
14
14
  associated_with 'Categories', class_name: Category, as: :categories
15
- associated_with 'Supplier', class_name: Supplier, as: :supplier
15
+ associated_with 'Supplier', class_name: 'Supplier', as: :supplier
16
16
  end
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.0
4
+ version: 0.6.1
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-01 00:00:00.000000000 Z
11
+ date: 2014-10-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler