Skip to content

Commit

Permalink
move back in so i don't need to change api
Browse files Browse the repository at this point in the history
  • Loading branch information
amro committed Jun 8, 2012
1 parent a325c81 commit 904e9ba
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 25 deletions.
28 changes: 27 additions & 1 deletion lib/gibbon.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def base_api_url
"https://#{dc_from_api_key}api.mailchimp.com/1.3/?method="
end

protected
protected
def call(method, params = {})
api_url = base_api_url + method
params = @default_params.merge(params)
Expand Down Expand Up @@ -64,6 +64,32 @@ def dc_from_api_key
end
end

class GibbonExport < Gibbon
def initialize(api_key = nil, extra_params = {})
super(api_key, extra_params)
end

protected

def export_api_url
"http://#{dc_from_api_key}api.mailchimp.com/export/1.0/"
end

def call(method, params = {})
api_url = export_api_url + method + "/"
params = @default_params.merge(params)
response = self.class.post(api_url, :body => params, :timeout => @timeout)

lines = response.body.lines
if @throws_exceptions
first_line_object = JSON.parse(lines.first) if lines.first
raise "Error from MailChimp Export API: #{first_line_object["error"]} (code #{first_line_object["code"]})" if first_line_object.is_a?(Hash) && first_line_object["error"]
end

lines
end
end

module HTTParty
module HashConversions
# @param key<Object> The key for the param.
Expand Down
24 changes: 0 additions & 24 deletions lib/gibbon_export.rb

This file was deleted.

0 comments on commit 904e9ba

Please sign in to comment.