Sha256: a5c4688951f2588252c64ce21b8d71e8dee4c290fb7937d2e79d0350168ad583

Contents?: true

Size: 844 Bytes

Versions: 3

Compression:

Stored size: 844 Bytes

Contents

module RubyRedtail
  class TagGroup
    class Contacts
      def initialize(tag_group_id,api_hash)
        @api_hash = api_hash
        @tag_group_id = tag_group_id
      end
  
      def fetch
        build_contacts_array RubyRedtail::Query.run("taggroups/#{@tag_group_id}/contacts", @api_hash, "GET")["TagMember_Result"]["TagMembers"]
      end
      
      private
      
      def build_contact contact_hash
        if contact_hash
          RubyRedtail::Contact.new(contact_hash,@api_hash)
        else
          raise RubyRedtail::AuthenticationError
        end
      end

      def build_contacts_array contact_hashes
        if contact_hashes
          contact_hashes.collect { |contact_hash| self.build_contact contact_hash }
        else
          raise RubyRedtail::AuthenticationError
        end
      end
      
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ruby-redtail-0.3.4 lib/ruby-redtail/tag_group/contacts.rb
ruby-redtail-0.3.3 lib/ruby-redtail/tag_group/contacts.rb
ruby-redtail-0.3.2 lib/ruby-redtail/tag_group/contacts.rb