Class: RemoteFactoryGirl::JsonToActiveResource
- Inherits:
-
Object
- Object
- RemoteFactoryGirl::JsonToActiveResource
- Defined in:
- lib/remote_factory_girl/json_to_active_resource.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#json ⇒ Object
(also: #to_hash)
readonly
Returns the value of attribute json.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(json, config = {}) ⇒ JsonToActiveResource
constructor
A new instance of JsonToActiveResource.
- #resource(resource) ⇒ Object
Constructor Details
#initialize(json, config = {}) ⇒ JsonToActiveResource
Returns a new instance of JsonToActiveResource.
12 13 14 15 16 |
# File 'lib/remote_factory_girl/json_to_active_resource.rb', line 12 def initialize(json, config = {}) raise 'ActiveResource not defined' if !defined?(ActiveResource) @json = json @config = config end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
8 9 10 |
# File 'lib/remote_factory_girl/json_to_active_resource.rb', line 8 def config @config end |
#json ⇒ Object (readonly) Also known as: to_hash
Returns the value of attribute json.
8 9 10 |
# File 'lib/remote_factory_girl/json_to_active_resource.rb', line 8 def json @json end |
Class Method Details
.convert(json, config = {}) ⇒ Object
4 5 6 |
# File 'lib/remote_factory_girl/json_to_active_resource.rb', line 4 def self.convert(json, config = {}) new(json, config) end |
Instance Method Details
#resource(resource) ⇒ Object
18 19 20 |
# File 'lib/remote_factory_girl/json_to_active_resource.rb', line 18 def resource(resource) resource.find(id) end |