Low level Ruby access to the Answers Platform API
gem 'answers-ruby-client'
gem install answers-ruby-client
require 'answers'
Answers.init
questions = Answers::Question.all
questions.each do |question|
p question.id
p question.text
end
answers = Answers::Answer.all
answers.each do |answer|
p answer.id
p answer.text
p answer.question_id
q = Answers::Question.find(question.id)
p q.text
end
# write API (requires authentication)
Answers.init({
user_email: 'person@email.tld',
user_token: '1234567890qwertyuiop'
})
question = Answers::Question.new
question.text = 'Is this a question?'
question.save
answer = Answers::Answer.new
answer.text = 'Yes, this is a question.'
answer.question_id = question.id
answer.save
Answers::Question.new(text: 'hello').save
Answers::Answer.new(text: 'hello').save
Answers.Question.find(1)
Answers.Answer.find(1)
a = Answers::Question.find(1)
a.text = 'new_text'
a.save
a = Answers::Question.find(1)
a.text = 'new_text'
a.delete
id
(Integer)text
(String
) - the text of the questionin_language
(String
) - the language of the questionneed_to_know
(String
)
text
(String
) - the text of the answerin_language
(String
) - the language of the answerquestion_id
(Integer
) - the
- Fork it ( https://github.com/18F/answers-ruby-client/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Public Domain. See LICENSE.txt.