Class: TheCity::Skill

Inherits:
ApiObject show all
Defined in:
lib/api/skill.rb

Instance Attribute Summary

Attributes inherited from ApiObject

#error_messages, #marked_for_destruction

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiObject

__tc_attributes, #delete, #initialize_from_json_object, #is_deleted?, #save, #set_attributes, tc_attr_accessor, #to_attributes

Constructor Details

#initialize(reader = nil) ⇒ Skill

Constructor.

Parameters:

  • reader (optional) (defaults to: nil)

    The object that has the data. This can be a TheCity::SkillReader or Hash object.



23
24
25
26
27
28
29
30
# File 'lib/api/skill.rb', line 23

def initialize(reader = nil)
  @writer_object = SkillWriter
  if reader.is_a?(SkillReader)
    initialize_from_json_object(reader.load_feed) 
  elsif reader.is_a?(Hash)
    initialize_from_json_object(reader)
  end
end

Class Method Details

.load_by_id(fund_id) ⇒ Object

Loads the skill by the specified ID.

Returns a new TheCity::Skill object.

Parameters:

  • skill_id

    The ID of the skill to load.



15
16
17
18
# File 'lib/api/skill.rb', line 15

def self.load_by_id(fund_id)
  skill_reader = SkillReader.new(fund_id)
  self.new(skill_reader)
end