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
38
39
40
41
42
43
44
|
# File 'lib/gds_api/need_api.rb', line 38
def close(need_id, duplicate_of)
put_json("#{endpoint}/needs/#{CGI.escape(need_id.to_s)}/closed", duplicate_of)
end
|
#content_id(need_id) ⇒ Object
10
11
12
|
# File 'lib/gds_api/need_api.rb', line 10
def content_id(need_id)
get_raw("#{endpoint}/needs/#{CGI.escape(need_id.to_s)}/content_id")
end
|
#create_need(need) ⇒ Object
25
26
27
|
# File 'lib/gds_api/need_api.rb', line 25
def create_need(need)
post_json("#{endpoint}/needs", need)
end
|
#create_note(note) ⇒ Object
52
53
54
|
# File 'lib/gds_api/need_api.rb', line 52
def create_note(note)
post_json("#{endpoint}/notes", note)
end
|
#need(need_id) ⇒ Object
21
22
23
|
# File 'lib/gds_api/need_api.rb', line 21
def need(need_id)
get_json("#{endpoint}/needs/#{CGI.escape(need_id.to_s)}")
end
|
#needs(options = {}) ⇒ Object
4
5
6
7
8
|
# File 'lib/gds_api/need_api.rb', line 4
def needs(options = {})
query = query_string(options)
get_list("#{endpoint}/needs#{query}")
end
|
#needs_by_id(*ids) ⇒ Object
14
15
16
17
18
19
|
# File 'lib/gds_api/need_api.rb', line 14
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
34
35
36
|
# File 'lib/gds_api/need_api.rb', line 34
def organisations
get_json("#{endpoint}/organisations")["organisations"]
end
|
#reopen(need_id, author) ⇒ Object
46
47
48
49
50
|
# File 'lib/gds_api/need_api.rb', line 46
def reopen(need_id, author)
delete_json_with_params!("#{endpoint}/needs/#{CGI.escape(need_id.to_s)}/closed", author)
end
|
#update_need(need_id, need_update) ⇒ Object
29
30
31
32
|
# File 'lib/gds_api/need_api.rb', line 29
def update_need(need_id, need_update)
put_json("#{endpoint}/needs/#{CGI.escape(need_id.to_s)}", need_update)
end
|