Module: R3c
- Defined in:
- lib/r3c.rb,
lib/r3c/r3c.rb,
lib/r3c/version.rb,
lib/r3c/rest_helper.rb
Defined Under Namespace
Classes: Attachment, BaseEntity, CustomField, Group, Issue, IssueStatus, Membership, Project, Query, Role, TimeEntry, Tracker, User, Version, WikiPage
Constant Summary
collapse
- VERSION =
"0.0.8"
Class Method Summary
collapse
Class Method Details
.add_watcher(issue_id, user_id, format = "xml") ⇒ Object
Note: see r3c.rb for example about how to retrieve watchers on an issue Example: R3c.add_watcher(1, 1)
20
21
22
23
24
25
|
# File 'lib/r3c/rest_helper.rb', line 20
def self.add_watcher(issue_id, user_id, format="xml")
response = execute(method: :post, url: "#{R3c::BaseEntity.site}/issues/#{issue_id}/watchers.#{format}", headers: {params: {user_id: user_id}})
return JSON.parse(response) if format == "json"
response
end
|
.auth(auth) ⇒ Object
21
22
23
|
# File 'lib/r3c.rb', line 21
def self.auth auth
R3c::BaseEntity.auth auth
end
|
.enumerations(enumeration, format = "xml") ⇒ Object
Example: R3c.enumerations(“issue_priorities”)
38
39
40
41
42
43
|
# File 'lib/r3c/rest_helper.rb', line 38
def self.enumerations(enumeration, format="xml")
response = self.execute(method: :get, url: "#{R3c::BaseEntity.site}/enumerations/#{enumeration}.#{format}")
return JSON.parse(response) if format == "json"
response
end
|
.r3c_version ⇒ Object
9
10
11
|
# File 'lib/r3c.rb', line 9
def self.r3c_version
VERSION
end
|
.remove_watcher(issue_id, user_id, format = "xml") ⇒ Object
Example: R3c.remove_watcher(1, 1)
29
30
31
32
33
34
|
# File 'lib/r3c/rest_helper.rb', line 29
def self.remove_watcher(issue_id, user_id, format="xml")
response = execute(method: :delete, url: "#{R3c::BaseEntity.site}/issues/#{issue_id}/watchers/#{user_id}.#{format}")
return JSON.parse(response) if format == "json"
response
end
|
.search(q, format = "xml") ⇒ Object
Example: R3c.search(“sometext”)
49
50
51
52
53
54
|
# File 'lib/r3c/rest_helper.rb', line 49
def self.search(q, format = "xml")
response = execute(method: :get, url: "#{R3c::BaseEntity.site}/search.#{format}", headers: {params: {all_words: "", q: q}} )
return JSON.parse(response) if format == "json"
response
end
|
.ssl(ssl_options) ⇒ Object
.upload(file, format = "xml") ⇒ Object
9
10
11
12
|
# File 'lib/r3c/rest_helper.rb', line 9
def self.upload(file, format="xml")
response = execute(method: :post, url: "#{R3c::BaseEntity.site}/uploads.#{format}", file: file, :multipart => true, :content_type => 'application/octet-stream')
token = JSON.parse(response)['upload']['token']
end
|
.verify_ssl? ⇒ Boolean
31
32
33
34
35
36
37
|
# File 'lib/r3c.rb', line 31
def self.verify_ssl?
if R3c::BaseEntity.self.ssl_options[:verify_mode] == OpenSSL::SSL::VERIFY_NONE
return false
else
return true
end
end
|