Class: ActBlue::Contribution

Inherits:
ActiveBlue show all
Defined in:
lib/actblue/contribution.rb

Constant Summary collapse

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

Constants inherited from ActiveBlue

ActiveBlue::ACT_TYPES

Instance Attribute Summary

Attributes inherited from ActiveBlue

#variables

Class Method Summary collapse

Methods inherited from ActiveBlue

#[], #[]=, #initialize, #to_xml, #to_xml_element

Constructor Details

This class inherits a constructor from ActBlue::ActiveBlue

Class Method Details

.get(params) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/actblue/contribution.rb', line 9

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|
        result << Contribution.new(h)
    end
  elsif hash["contribution"]
    result << Contribution.new(hash["contribution"])
  end
  result
end