Sha256: 6d4f6664626ea6d458e8a0eaedfa41d575b48420c64855a3007876ec5ff5bb93
Contents?: true
Size: 747 Bytes
Versions: 2
Compression:
Stored size: 747 Bytes
Contents
module Promoter class ContactList attr_reader :id, :name API_URL = "https://app.promoter.io/api/lists" def initialize(attrs) @id = attrs['id'] @name = attrs['name'] end def self.all(page=1) response = Request.get("#{API_URL}/?page=#{page}") response['results'].map {|attrs| new(attrs)} end def self.contact_ids_for(contact_list_id) response = Request.get("#{API_URL}/#{contact_list_id}/contacts") response['results'].map {|attrs| attrs["id"]} end def self.remove_contact(params={}) contact_list_id = params[:contact_list_id] contact_id = params[:contact_id] Request.delete("#{API_URL}/#{contact_list_id}/contacts/#{contact_id}") end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
promoter-0.1.4 | lib/promoter/contact_list.rb |
promoter-0.1.0 | lib/promoter/contact_list.rb |