Skip to content

Commit

Permalink
Apparently you cant really do GETs with Pages. Fixed up Contribution …
Browse files Browse the repository at this point in the history
…to deal with summary view on get.
  • Loading branch information
kyleshank committed Feb 17, 2009
1 parent 8f7d5f9 commit c8c60cb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
6 changes: 5 additions & 1 deletion lib/actblue/contribution.rb
Expand Up @@ -4,10 +4,14 @@ class Contribution < ActiveBlue

XML_NAME = 'contribution'
ATTRIBUTES = ['order-number', 'created-on']
ELEMENTS = ['refcode', 'source', 'timestamp', 'submitter', 'recurring', 'recurringtimes', 'referrer', 'successuri', 'lineitems']
ELEMENTS = ['page', 'refcode', 'source', 'timestamp', 'submitter', 'recurring', 'recurringtimes', 'referrer', 'successuri', 'lineitems']

def self.get(params)
hash = ActiveBlue.get('/contributions', :query => params)
unless hash
return nil
end
return hash["contributions"] if ((params["view"] == "summary") || (params[:view] == "summary"))
result = []
if hash["contributions"]
hash["contributions"]["contribution"].each do |h|
Expand Down
13 changes: 0 additions & 13 deletions lib/actblue/page.rb
Expand Up @@ -6,19 +6,6 @@ class Page < ActiveBlue
ATTRIBUTES = ['name', 'partner', 'created-on']
ELEMENTS = ['title', 'author', 'blurb', 'visibility', 'showcandidatesummary', 'listentries']

def self.get(params)
hash = ActiveBlue.get('/pages', :query => params)
result = []
if hash["pages"]
hash["pages"].each do |h|
result << Page.new(h)
end
elsif hash["page"]
result << Page.new(hash["page"])
end
result
end

def post
super.post('/pages', :body => to_xml)
end
Expand Down

0 comments on commit c8c60cb

Please sign in to comment.