Class: Wordnik::Endpoint
- Extended by:
- ActiveModel::Naming
- Includes:
- ActiveModel::Conversion, ActiveModel::Validations
- Defined in:
- lib/wordnik/endpoint.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#operations ⇒ Object
Returns the value of attribute operations.
-
#path ⇒ Object
Returns the value of attribute path.
-
#resource ⇒ Object
Returns the value of attribute resource.
Instance Method Summary collapse
-
#initialize(resource, attributes = {}) ⇒ Endpoint
constructor
A new instance of Endpoint.
-
#persisted? ⇒ Boolean
It’s an ActiveModel thing..
Constructor Details
#initialize(resource, attributes = {}) ⇒ Endpoint
Returns a new instance of Endpoint.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/wordnik/endpoint.rb', line 13 def initialize(resource, attributes = {}) self.resource = resource attributes.each do |name, value| send("#{name.to_s.underscore.to_sym}=", value) end # Generate Operations instances from JSON if self.operations self.operations = self.operations.map do |operationData| Operation.new(self, operationData) end end end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
9 10 11 |
# File 'lib/wordnik/endpoint.rb', line 9 def description @description end |
#operations ⇒ Object
Returns the value of attribute operations.
9 10 11 |
# File 'lib/wordnik/endpoint.rb', line 9 def operations @operations end |
#path ⇒ Object
Returns the value of attribute path.
9 10 11 |
# File 'lib/wordnik/endpoint.rb', line 9 def path @path end |
#resource ⇒ Object
Returns the value of attribute resource.
9 10 11 |
# File 'lib/wordnik/endpoint.rb', line 9 def resource @resource end |
Instance Method Details
#persisted? ⇒ Boolean
It’s an ActiveModel thing..
29 30 31 |
# File 'lib/wordnik/endpoint.rb', line 29 def persisted? false end |