mogli 0.0.11 → 0.0.12

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.
data/lib/mogli.rb CHANGED
@@ -20,6 +20,7 @@ require "mogli/education"
20
20
  require "mogli/event"
21
21
  require "mogli/group"
22
22
  require "mogli/interest"
23
+ require "mogli/link"
23
24
  require "mogli/movie"
24
25
  require "mogli/music"
25
26
  require "mogli/note"
data/lib/mogli/client.rb CHANGED
@@ -102,15 +102,15 @@ module Mogli
102
102
  end
103
103
 
104
104
  def create_instance(klass,data)
105
- klass = determine_class(klass,data)
106
- if klass.nil?
105
+ klass_to_create = determine_class(data["type"]||klass,data)
106
+ if klass_to_create.nil?
107
107
  raise UnrecognizeableClassError.new("unable to recognize klass for #{klass.inspect} => #{data.inspect}")
108
108
  end
109
- klass.new(data,self)
109
+ klass_to_create.new(data,self)
110
110
  end
111
111
 
112
112
  def constantize_string(klass)
113
- klass.is_a?(String) ? Mogli.const_get(klass) : klass
113
+ klass.is_a?(String) ? Mogli.const_get(klass.capitalize) : klass
114
114
  end
115
115
 
116
116
  def determine_class(klass_or_klasses,data)
data/lib/mogli/model.rb CHANGED
@@ -1,5 +1,8 @@
1
1
  module Mogli
2
2
  class Model < Hashie::Dash
3
+
4
+ attr_accessor :type
5
+
3
6
  def client=(val)
4
7
  @client=val
5
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mogli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Mangino