Method: CommandFeedback::Service#initialize

Defined in:
lib/command_feedback/feedback.rb

#initialize(title, choices, description) ⇒ Service

Returns a new instance of Service.



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/command_feedback/feedback.rb', line 11

def initialize title, choices, description
  body = { 
    "multiplechoice" => {
      "title" => title,
      "description" => description,
      "choices" => Service.build_choices_hash(choices)
    } 
  }
  options = { :headers => { 'ContentType' => 'application/json' } }

  hostname = "get-feedback.at"
  @response = HTTParty.post "http://#{ hostname }/questions.json", :body => body, :options => options
end