Class: RubyRedtail::TagGroup

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

Instance Method Summary collapse

Constructor Details

#initialize(tag_group = {}, api_hash) ⇒ TagGroup

Returns a new instance of TagGroup.

Raises:

  • (ArgumentError)


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

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

Instance Method Details

#contactsObject



18
19
20
# File 'lib/ruby-redtail/tag_group.rb', line 18

def contacts
  build_contacts_array RubyRedtail::Query.run("taggroups/#{@id}/contacts", @api_hash, "GET")["TagMembers"]
end