Class: Pluct::Resource

Inherits:
Object
  • Object
show all
Includes:
Helpers::Request
Defined in:
lib/pluct/resource.rb

Constant Summary

Constants included from Helpers::Request

Helpers::Request::DEFAULT_HEADERS

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url, schema) ⇒ Resource

Returns a new instance of Resource.



7
8
9
10
11
12
# File 'lib/pluct/resource.rb', line 7

def initialize(url, schema)
  @url = url
  @data = get_data
  @schema = schema
  Resource.create_methods(@schema.links) if @schema
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



5
6
7
# File 'lib/pluct/resource.rb', line 5

def data
  @data
end

#schemaObject (readonly)

Returns the value of attribute schema.



5
6
7
# File 'lib/pluct/resource.rb', line 5

def schema
  @schema
end

#urlObject (readonly)

Returns the value of attribute url.



5
6
7
# File 'lib/pluct/resource.rb', line 5

def url
  @url
end

Instance Method Details

#get_dataObject

TODO: Authenticate the request if necessary.



15
16
17
# File 'lib/pluct/resource.rb', line 15

def get_data
  get @url
end