Class: Resource

Inherits:
Object
  • Object
show all
Defined in:
lib/Appolo/Models/secondary/resource.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json_str) ⇒ Resource

Returns a new instance of Resource.



9
10
11
12
13
14
15
16
17
# File 'lib/Appolo/Models/secondary/resource.rb', line 9

def initialize(json_str)
  json_data = ModelUtils::check_json_info json_str
  
  @id = json_data[ModelUtils::ID]
  @description = json_data[ModelUtils::DESCRIPTION]
  @class_id = json_data[ModelUtils::CLASS_ID]
  @title = json_data[ModelUtils::TITLE]
  @links = Links.new json_data[ModelUtils::LINKS], 'resources'
end

Instance Attribute Details

#class_idObject (readonly)

Returns the value of attribute class_id.



6
7
8
# File 'lib/Appolo/Models/secondary/resource.rb', line 6

def class_id
  @class_id
end

#descriptionObject (readonly)

Returns the value of attribute description.



6
7
8
# File 'lib/Appolo/Models/secondary/resource.rb', line 6

def description
  @description
end

#idObject (readonly)

Returns the value of attribute id.



6
7
8
# File 'lib/Appolo/Models/secondary/resource.rb', line 6

def id
  @id
end

Returns the value of attribute links.



7
8
9
# File 'lib/Appolo/Models/secondary/resource.rb', line 7

def links
  @links
end

#titleObject (readonly)

Returns the value of attribute title.



6
7
8
# File 'lib/Appolo/Models/secondary/resource.rb', line 6

def title
  @title
end

Instance Method Details

#to_sObject



19
20
21
# File 'lib/Appolo/Models/secondary/resource.rb', line 19

def to_s
  "Resource : #{@class_id} - #{@title}"
end