Class: Wordnik::Endpoint

Inherits:
Object show all
Extended by:
ActiveModel::Naming
Includes:
ActiveModel::Conversion, ActiveModel::Validations
Defined in:
lib/wordnik/endpoint.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#descriptionObject

Returns the value of attribute description.



9
10
11
# File 'lib/wordnik/endpoint.rb', line 9

def description
  @description
end

#operationsObject

Returns the value of attribute operations.



9
10
11
# File 'lib/wordnik/endpoint.rb', line 9

def operations
  @operations
end

#pathObject

Returns the value of attribute path.



9
10
11
# File 'lib/wordnik/endpoint.rb', line 9

def path
  @path
end

#resourceObject

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..

Returns:

  • (Boolean)


29
30
31
# File 'lib/wordnik/endpoint.rb', line 29

def persisted?
  false
end