Class: JustGiving::Fundraising
- Defined in:
- lib/just_giving/fundraising.rb
Instance Method Summary collapse
-
#create(params) ⇒ Object
Create a new fundraising page.
-
#donations(page = 1, per_page = 50) ⇒ Object
Get all donations per page.
-
#initialize(short_name = nil) ⇒ Fundraising
constructor
A new instance of Fundraising.
-
#page ⇒ Object
Get a specific page.
-
#pages ⇒ Object
Get all pages.
-
#short_name_registered? ⇒ Boolean
Check if a short name is registered.
- #suggest ⇒ Object
-
#update_story(story) ⇒ Object
Update a pages story.
- #upload_image ⇒ Object
Methods included from Request
Constructor Details
#initialize(short_name = nil) ⇒ Fundraising
3 4 5 |
# File 'lib/just_giving/fundraising.rb', line 3 def initialize(short_name=nil) @short_name = short_name end |
Instance Method Details
#create(params) ⇒ Object
Create a new fundraising page
13 14 15 |
# File 'lib/just_giving/fundraising.rb', line 13 def create(params) put("v1/fundraising/pages", {:basic_auth => true}.merge(params)) end |
#donations(page = 1, per_page = 50) ⇒ Object
Get all donations per page
33 34 35 36 |
# File 'lib/just_giving/fundraising.rb', line 33 def donations(page=1, per_page=50) get("v1/fundraising/pages/#{@short_name}/donations?pageNum=#{page}&page_size=#{per_page}", :basic_auth => true) end |
#page ⇒ Object
Get a specific page
28 29 30 |
# File 'lib/just_giving/fundraising.rb', line 28 def page get("v1/fundraising/pages/#{@short_name}") end |
#pages ⇒ Object
Get all pages
8 9 10 |
# File 'lib/just_giving/fundraising.rb', line 8 def pages get("v1/fundraising/pages", :basic_auth => true) end |
#short_name_registered? ⇒ Boolean
Check if a short name is registered
18 19 20 21 22 23 24 25 |
# File 'lib/just_giving/fundraising.rb', line 18 def short_name_registered? begin head("v1/fundraising/pages/#{@short_name}") return true rescue JustGiving::NotFound return false end end |
#suggest ⇒ Object
47 48 49 |
# File 'lib/just_giving/fundraising.rb', line 47 def suggest # TODO end |
#update_story(story) ⇒ Object
Update a pages story
39 40 41 |
# File 'lib/just_giving/fundraising.rb', line 39 def update_story(story) post("v1/fundraising/pages/#{@short_name}", {:basic_auth => true}.merge({:storySupplement => story})) end |
#upload_image ⇒ Object
43 44 45 |
# File 'lib/just_giving/fundraising.rb', line 43 def upload_image # TODO end |