Class: JustGiving::Fundraising

Inherits:
API
  • Object
show all
Defined in:
lib/just_giving/fundraising.rb

Instance Method Summary collapse

Methods included from Request

#get, #head, #post, #put

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

#pageObject

Get a specific page



28
29
30
# File 'lib/just_giving/fundraising.rb', line 28

def page
  get("v1/fundraising/pages/#{@short_name}")
end

#pagesObject

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

#suggestObject



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_imageObject



43
44
45
# File 'lib/just_giving/fundraising.rb', line 43

def upload_image
  # TODO
end