lib/promoter/contact.rb in promoter-0.1.7 vs lib/promoter/contact.rb in promoter-0.1.8
- old
+ new
@@ -17,26 +17,32 @@
def destroy
Contact.destroy(self.email)
end
- # Parameter Optional? Description
- # page yes Returns which page of results to return.
- # Defaults to 1
- # email yes Filter the results by email address.
+ # Parameter Optional? Description
+ # page yes Returns which page of results to return. Defaults to 1
+ #
+ # email yes Filter the results by email address.
+ # contact_list_id yes Filter the results by contact list
def self.all(options={})
if !options.is_a?(Hash)
puts "-- DEPRECATION WARNING--"
puts "Passing in a number as a page is deprecated and will be removed from future versions of this gem.\nInstead pass in a hash of attributes.\n\n e.g. Promoter::Contact.all(page: 2)"
query_string = "page=#{options}"
else
# default to first page
options[:page] ||= 1
+
+ if options.key?(:contact_list_id)
+ options[:contact_list__id] = options.delete(:contact_list_id)
+ end
+
query_string = URI.encode_www_form(options)
end
response = Request.get("#{API_URL}/?#{query_string}")
- response['results'].map {|attrs| new(attrs)}
+ response['results'].map { |attrs| new(attrs) }
end
def self.find(id)
response = Request.get("#{API_URL}/#{id}")
new(response)
@@ -78,6 +84,6 @@
response = Request.post(API_URL + "/survey/", attributes)
new(response)
end
end
-end
\ No newline at end of file
+end