Class: GdsApi::NeedApi
- Inherits:
-
Base
- Object
- Base
- GdsApi::NeedApi
show all
- Defined in:
- lib/gds_api/need_api.rb
Instance Attribute Summary
Attributes inherited from Base
#options
Instance Method Summary
collapse
Methods inherited from Base
#client, #create_client, #get_list!, #initialize, #url_for_slug
Constructor Details
This class inherits a constructor from GdsApi::Base
Instance Method Details
#close(need_id, duplicate_of) ⇒ Object
35
36
37
38
39
40
41
|
# File 'lib/gds_api/need_api.rb', line 35
def close(need_id, duplicate_of)
put_json!("#{endpoint}/needs/#{CGI.escape(need_id.to_s)}/closed", duplicate_of)
end
|
#create_need(need) ⇒ Object
22
23
24
|
# File 'lib/gds_api/need_api.rb', line 22
def create_need(need)
post_json!("#{endpoint}/needs", need)
end
|
#create_note(note) ⇒ Object
48
49
50
|
# File 'lib/gds_api/need_api.rb', line 48
def create_note(note)
post_json!("#{endpoint}/notes", note)
end
|
#need(need_id) ⇒ Object
18
19
20
|
# File 'lib/gds_api/need_api.rb', line 18
def need(need_id)
get_json("#{endpoint}/needs/#{CGI.escape(need_id.to_s)}")
end
|
#needs(options = {}) ⇒ Object
5
6
7
8
9
|
# File 'lib/gds_api/need_api.rb', line 5
def needs(options = {})
query = query_string(options)
get_list!("#{endpoint}/needs#{query}")
end
|
#needs_by_id(*ids) ⇒ Object
11
12
13
14
15
16
|
# File 'lib/gds_api/need_api.rb', line 11
def needs_by_id(*ids)
ids_string = ids.flatten.map(&:to_i).sort.join(',')
query = query_string(ids: ids_string)
get_list!("#{endpoint}/needs#{query}")
end
|
#organisations ⇒ Object
31
32
33
|
# File 'lib/gds_api/need_api.rb', line 31
def organisations
get_json!("#{endpoint}/organisations")["organisations"]
end
|
#reopen(need_id, author) ⇒ Object
43
44
45
46
|
# File 'lib/gds_api/need_api.rb', line 43
def reopen(need_id, author)
delete_json!("#{endpoint}/needs/#{CGI.escape(need_id.to_s)}/closed", author)
end
|
#update_need(need_id, need_update) ⇒ Object
26
27
28
29
|
# File 'lib/gds_api/need_api.rb', line 26
def update_need(need_id, need_update)
put_json!("#{endpoint}/needs/#{CGI.escape(need_id.to_s)}", need_update)
end
|