Class: Resource

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

Constant Summary collapse

'resources'

Instance Attribute Summary collapse

Attributes inherited from Element

#id, #links, #short_name

Instance Method Summary collapse

Methods inherited from Element

#check_json_info

Constructor Details

#initialize(json_str) ⇒ Resource

Returns a new instance of Resource.



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

def initialize(json_str)
  json_data = check_json_info json_str

  super(json_data[ModelUtils::ID],
        nil,
        json_data[ModelUtils::LINKS],
        @@type_of_links)

  @description = json_data[ModelUtils::DESCRIPTION]
  @class_id = json_data[ModelUtils::CLASS_ID]
  @title = json_data[ModelUtils::TITLE]
end

Instance Attribute Details

#class_idObject (readonly)

Returns the value of attribute class_id.



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

def class_id
  @class_id
end

#descriptionObject (readonly)

Returns the value of attribute description.



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

def description
  @description
end

#titleObject (readonly)

Returns the value of attribute title.



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

def title
  @title
end

Instance Method Details

#to_sObject



23
24
25
# File 'lib/Appolo/Models/secondary/resource.rb', line 23

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