Class: HaveAPI::ModelAdapter::Input
- Inherits:
-
Object
- Object
- HaveAPI::ModelAdapter::Input
- Defined in:
- lib/haveapi/model_adapter.rb
Overview
Subclass this class in your adapter and reimplement necessary methods.
Direct Known Subclasses
HaveAPI::ModelAdapters::ActiveRecord::Input, HaveAPI::ModelAdapters::Hash::Input
Class Method Summary collapse
-
.clean(model, raw, extra) ⇒ Object
Return model instance from a raw input resource parameter.
- .used_by(action) ⇒ Object
Instance Method Summary collapse
-
#[](name) ⇒ Object
Return parameter with ‘name`.
-
#has_param?(name) ⇒ Boolean
Return true if input parameters contain parameter with ‘name`.
-
#initialize(input) ⇒ Input
constructor
A new instance of Input.
Constructor Details
#initialize(input) ⇒ Input
Returns a new instance of Input.
67 68 69 |
# File 'lib/haveapi/model_adapter.rb', line 67 def initialize(input) @input = input end |
Class Method Details
.clean(model, raw, extra) ⇒ Object
Return model instance from a raw input resource parameter.
83 |
# File 'lib/haveapi/model_adapter.rb', line 83 def self.clean(model, raw, extra); end |
.used_by(action) ⇒ Object
65 |
# File 'lib/haveapi/model_adapter.rb', line 65 def self.used_by(action); end |
Instance Method Details
#[](name) ⇒ Object
Return parameter with ‘name`.
78 79 80 |
# File 'lib/haveapi/model_adapter.rb', line 78 def [](name) @input[name] end |
#has_param?(name) ⇒ Boolean
Return true if input parameters contain parameter with ‘name`.
73 74 75 |
# File 'lib/haveapi/model_adapter.rb', line 73 def has_param?(name) @input.has_key?(name) end |