Class: TheCity::Address

Inherits:
ApiObject show all
Defined in:
lib/api/address.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, #initialize_from_json_object, #is_deleted?, #set_attributes, tc_attr_accessor, #to_attributes

Constructor Details

#initialize(json_data = nil) ⇒ Address

Constructor.

Parameters:

  • json_data (optional) (defaults to: nil)

    JSON data of the address.



36
37
38
# File 'lib/api/address.rb', line 36

def initialize(json_data = nil)
  initialize_from_json_object(json_data) unless json_data.nil?
end

Class Method Details

.load_by_id(address_id) ⇒ Object

Loads the address by the specified ID.

Returns a new TheCity::Address object.

Parameters:

  • address_id

    The ID of the address to load.



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

def self.load_by_id(address_id)
  reader = AddressReader.new(address_id)
  self.new(reader.load_feed)
rescue
  nil
end

Instance Method Details

#deleteObject



44
45
46
# File 'lib/api/address.rb', line 44

def delete
  raise 'Address does not have a delete method'
end

#saveObject



40
41
42
# File 'lib/api/address.rb', line 40

def save
  raise 'Address does not have a save method'
end