Class: TheCity::Terminology

Inherits:
ApiObject show all
Defined in:
lib/api/terminology.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(json_data) ⇒ Terminology

Constructor.

Parameters:

  • json_data

    JSON data of the Terminology.



24
25
26
27
28
# File 'lib/api/terminology.rb', line 24

def initialize(json_data)
  @writer_object = TerminologyWriter
  self.term = json_data.keys[0]
  self.label = json_data.values[0]
end

Class Method Details

.load_by_term(term) ⇒ Object

Loads the terminology by the specified term.

Returns a new TheCity::Terminology object.

Parameters:

  • term

    The term of the Terminology to load.



14
15
16
17
18
19
# File 'lib/api/terminology.rb', line 14

def self.load_by_term(term)
  reader = TerminologyReader.new(term)
  self.new(reader.load_feed)
rescue
  nil
end