Class: FirstGiving::Donation
- Inherits:
-
Object
- Object
- FirstGiving::Donation
- Includes:
- Base
- Defined in:
- lib/firstgiving/donation.rb
Defined Under Namespace
Modules: Actions
Constant Summary
Constants included from Base
Base::DONATION_PRODUCTION_ENDPOINT, Base::DONATION_SANDBOX_ENDPOINT, Base::SEARCH_ENDPOINT
Instance Method Summary collapse
- #creditcard(params) ⇒ Object
- #headers ⇒ Object
-
#initialize ⇒ Donation
constructor
A new instance of Donation.
- #parse(body) ⇒ Object
- #recurring_creditcard_profile(params) ⇒ Object
- #verify(params) ⇒ Object
Methods included from Base
#headers_json, #headers_security, #logging
Constructor Details
#initialize ⇒ Donation
Returns a new instance of Donation.
13 14 15 16 |
# File 'lib/firstgiving/donation.rb', line 13 def initialize @api_endpoint = DONATION_PRODUCTION_ENDPOINT @api_endpoint = DONATION_SANDBOX_ENDPOINT if FirstGiving.configuration.[:use_staging] end |
Instance Method Details
#creditcard(params) ⇒ Object
22 23 24 25 |
# File 'lib/firstgiving/donation.rb', line 22 def creditcard(params) response = post_call(@api_endpoint, Actions::CREDITCARD, params, headers) parse(response.body) end |
#headers ⇒ Object
18 19 20 |
# File 'lib/firstgiving/donation.rb', line 18 def headers headers_json.merge!(headers_security) end |
#parse(body) ⇒ Object
36 37 38 |
# File 'lib/firstgiving/donation.rb', line 36 def parse(body) Crack::XML.parse(body) end |
#recurring_creditcard_profile(params) ⇒ Object
32 33 34 |
# File 'lib/firstgiving/donation.rb', line 32 def recurring_creditcard_profile(params) call(Actions::RECURRING_CREDITCARD_PROFILE, params, headers) end |