Class: Ahub::Question
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
#destroy, #initialize, #update
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
16
17
18
|
# File 'lib/ahub/question.rb', line 16
def body
@body
end
|
#body_as_html ⇒ Object
Returns the value of attribute body_as_html.
16
17
18
|
# File 'lib/ahub/question.rb', line 16
def body_as_html
@body_as_html
end
|
#title ⇒ Object
Returns the value of attribute title.
16
17
18
|
# File 'lib/ahub/question.rb', line 16
def title
@title
end
|
Class Method Details
.create(title:, body:, topics:, space_id: nil, username:, password:) ⇒ Object
5
6
7
8
9
10
11
12
13
14
|
# File 'lib/ahub/question.rb', line 5
def self.create(title:, body:, topics:, space_id: nil, username:, password:)
url = "#{base_url}.json"
payload = {title: title, body: body, topics: topics}
payload[:spaceId] = space_id if space_id
= (username:username, password:password)
create_resource(url: url, payload: payload, headers: )
end
|
Instance Method Details
#move(space_id:) ⇒ Object
22
23
24
25
26
27
|
# File 'lib/ahub/question.rb', line 22
def move(space_id:)
raise Exception("No Question Id") unless id
move_url = "#{self.class.base_url}/#{id}/move.json?space=#{space_id}"
RestClient.put("#{url}", self.class.)
end
|
#to_s ⇒ Object
33
34
35
|
# File 'lib/ahub/question.rb', line 33
def to_s
url
end
|
#url ⇒ Object
29
30
31
|
# File 'lib/ahub/question.rb', line 29
def url
"#{self.class.base_url}/#{id}.json" if id
end
|
#user ⇒ Object
18
19
20
|
# File 'lib/ahub/question.rb', line 18
def user
@author
end
|