Class: RubyRedtail::Addresses

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby-redtail/contact/addresses.rb

Instance Method Summary collapse

Constructor Details

#initialize(api_hash) ⇒ Addresses

Returns a new instance of Addresses.



4
5
6
# File 'lib/ruby-redtail/contact/addresses.rb', line 4

def initialize(api_hash)
  @api_hash = api_hash
end

Instance Method Details

#assets_and_liabilities(contact_id) ⇒ Object

Fetch Assets and Liabilities



69
70
71
# File 'lib/ruby-redtail/contact/addresses.rb', line 69

def assets_and_liabilities (contact_id)
  RubyRedtail::Query.run("contacts/#{contact_id}/assets-liabilities", @api_hash, "GET")
end

#create(contact_id, params) ⇒ Object

Create New Address



19
20
21
# File 'lib/ruby-redtail/contact/addresses.rb', line 19

def create (contact_id, params)
  update(contact_id, 0, params)
end

#create_internet_address(contact_id, params) ⇒ Object

Create New Internet Address



59
60
61
# File 'lib/ruby-redtail/contact/addresses.rb', line 59

def create_internet_address (contact_id, params)
  update_internet_address(contact_id, 0, params)
end

#create_phone(contact_id, params) ⇒ Object

Create New Phone



39
40
41
# File 'lib/ruby-redtail/contact/addresses.rb', line 39

def create_phone (contact_id, params)
  update(contact_id, 0, params)
end

#delete(contact_id, address_id) ⇒ Object

Delete Address



24
25
26
# File 'lib/ruby-redtail/contact/addresses.rb', line 24

def delete (contact_id, address_id)
  RubyRedtail::Query.run("contacts/#{contact_id}/addresses/#{address_id}", @api_hash, 'DELETE')
end

#delete_internet_address(contact_id, internet_id) ⇒ Object

Delete Internet Address



64
65
66
# File 'lib/ruby-redtail/contact/addresses.rb', line 64

def delete_internet_address (contact_id, internet_id)
  RubyRedtail::Query.run("contacts/#{contact_id}/phones/#{internet_id}", @api_hash, 'DELETE')
end

#delete_phone(contact_id, phone_id) ⇒ Object

Delete Phone



44
45
46
# File 'lib/ruby-redtail/contact/addresses.rb', line 44

def delete_phone (contact_id, phone_id)
  RubyRedtail::Query.run("contacts/#{contact_id}/phones/#{phone_id}", @api_hash, 'DELETE')
end

#fetch(contact_id) ⇒ Object

Fetch Address By Contact Id



9
10
11
# File 'lib/ruby-redtail/contact/addresses.rb', line 9

def fetch (contact_id)
  RubyRedtail::Query.run("contacts/#{contact_id}/addresses", @api_hash, "GET")
end

#internet_addresses(contact_id) ⇒ Object

Fetch Internet Addresses By Contact Id



49
50
51
# File 'lib/ruby-redtail/contact/addresses.rb', line 49

def internet_addresses (contact_id)
  RubyRedtail::Query.run("contacts/#{contact_id}/internets", @api_hash, "GET")
end

#phones(contact_id) ⇒ Object

Fetch Phones By Contact Id



29
30
31
# File 'lib/ruby-redtail/contact/addresses.rb', line 29

def phones (contact_id)
  RubyRedtail::Query.run("contacts/#{contact_id}/phones", @api_hash, "GET")
end

#update(contact_id, address_id, params) ⇒ Object

Update Address



14
15
16
# File 'lib/ruby-redtail/contact/addresses.rb', line 14

def update (contact_id, address_id, params)
  RubyRedtail::Query.run("contacts/#{contact_id}/addresses/#{address_id}", @api_hash, 'PUT', params)
end

#update_internet_address(contact_id, internet_id, params) ⇒ Object

Update Internet Address



54
55
56
# File 'lib/ruby-redtail/contact/addresses.rb', line 54

def update_internet_address (contact_id, internet_id, params)
  RubyRedtail::Query.run("contacts/#{contact_id}/phones/#{internet_id}", @api_hash, 'PUT', params)
end

#update_phone(contact_id, phone_id, params) ⇒ Object

Update Phone



34
35
36
# File 'lib/ruby-redtail/contact/addresses.rb', line 34

def update_phone (contact_id, phone_id, params)
  RubyRedtail::Query.run("contacts/#{contact_id}/phones/#{phone_id}", @api_hash, 'PUT', params)
end