Class: RubyRedtail::Client

Inherits:
Contact
  • Object
show all
Defined in:
lib/ruby-redtail/client.rb

Instance Attribute Summary

Attributes inherited from Contact

#api_hash, #id

Instance Method Summary collapse

Methods inherited from Contact

#create_user_defined_field, #delete, #departments, #details, #family, #fetch, #fetch_basic, #fetch_master, #inportant_information, #memberships, #personal_profile, #tag_groups, #update, #update_details, #update_important_information, #update_personal_profile, #update_user_defined_field, #user_defined_fields

Constructor Details

#initialize(client = {}, api_hash) ⇒ Client

Raises:

  • (ArgumentError)


4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/ruby-redtail/client.rb', line 4

def initialize(client = {}, api_hash)
  @api_hash = api_hash
  
  raise ArgumentError unless client['ClientID']
  @id = client['ClientID']
  
  raise ArgumentError if client.class != Hash
  client.each do |key, value|
    key = key.underscore
    self.class.send :attr_accessor, key
    instance_variable_set "@#{key}", value
  end
end