answers-ruby-client 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. checksums.yaml +7 -0
  2. data/.env.example +2 -0
  3. data/.gitignore +23 -0
  4. data/.rbenv-version +1 -0
  5. data/.travis.yml +3 -0
  6. data/Gemfile +5 -0
  7. data/LICENSE.txt +24 -0
  8. data/README.md +120 -0
  9. data/Rakefile +6 -0
  10. data/answers-ruby-client.gemspec +34 -0
  11. data/lib/answers-ruby-client.rb +14 -0
  12. data/lib/answers/answer.rb +40 -0
  13. data/lib/answers/base_model.rb +79 -0
  14. data/lib/answers/client.rb +111 -0
  15. data/lib/answers/error.rb +4 -0
  16. data/lib/answers/protocol.rb +40 -0
  17. data/lib/answers/question.rb +38 -0
  18. data/lib/answers/version.rb +3 -0
  19. data/spec/answer_spec.rb +115 -0
  20. data/spec/cassettes/Answers_Answer/When_API_keys_are_not_provided/DELETE_destroy/throws_an_Answers_Error.yml +97 -0
  21. data/spec/cassettes/Answers_Answer/When_API_keys_are_not_provided/GET_index/contains_objects_only_of_type_Answer_Answer.yml +90 -0
  22. data/spec/cassettes/Answers_Answer/When_API_keys_are_not_provided/GET_index/retrieves_a_list_of_Answers.yml +90 -0
  23. data/spec/cassettes/Answers_Answer/When_API_keys_are_not_provided/GET_show/retrieves_a_single_object_of_type_Answers_Answer.yml +52 -0
  24. data/spec/cassettes/Answers_Answer/When_API_keys_are_not_provided/POST_create/throws_an_Answers_Error.yml +48 -0
  25. data/spec/cassettes/Answers_Answer/When_API_keys_are_not_provided/PUT_update/throws_an_Answers_Error.yml +97 -0
  26. data/spec/cassettes/Answers_Answer/When_API_keys_are_provided/DELETE_destroy/deletes_an_Answer_Answer.yml +209 -0
  27. data/spec/cassettes/Answers_Answer/When_API_keys_are_provided/POST_create/creates_an_Answer_Answer.yml +54 -0
  28. data/spec/cassettes/Answers_Answer/When_API_keys_are_provided/PUT_update/updates_an_Answer_Answer.yml +107 -0
  29. data/spec/cassettes/Answers_Question/When_API_keys_are_not_provided/DELETE_destroy/throws_an_Answers_Error.yml +97 -0
  30. data/spec/cassettes/Answers_Question/When_API_keys_are_not_provided/GET_index/contains_objects_only_of_type_Answer_Question.yml +75 -0
  31. data/spec/cassettes/Answers_Question/When_API_keys_are_not_provided/GET_index/retrieves_a_list_of_Questions.yml +75 -0
  32. data/spec/cassettes/Answers_Question/When_API_keys_are_not_provided/GET_show/retrieves_a_single_object_of_type_Answers_Question.yml +52 -0
  33. data/spec/cassettes/Answers_Question/When_API_keys_are_not_provided/POST_create/throws_an_Answers_Error.yml +48 -0
  34. data/spec/cassettes/Answers_Question/When_API_keys_are_not_provided/PUT_update/throws_an_Answers_Error.yml +97 -0
  35. data/spec/cassettes/Answers_Question/When_API_keys_are_provided/DELETE_destroy/deletes_an_Answer_Question.yml +209 -0
  36. data/spec/cassettes/Answers_Question/When_API_keys_are_provided/POST_create/creates_an_Answer_Question.yml +54 -0
  37. data/spec/cassettes/Answers_Question/When_API_keys_are_provided/PUT_update/updates_an_Answer_Question.yml +107 -0
  38. data/spec/client_spec.rb +80 -0
  39. data/spec/question_spec.rb +124 -0
  40. data/spec/spec_helper.rb +22 -0
  41. metadata +259 -0
@@ -0,0 +1,4 @@
1
+ module Answers
2
+ class Error < StandardError
3
+ end
4
+ end
@@ -0,0 +1,40 @@
1
+ module Answers
2
+ module Protocol
3
+ DOMAIN = 'http://localhost:1337'
4
+ API_PATH = '/api'
5
+ API_VERSION = 'v1'
6
+ BASE_PATH = "#{DOMAIN}#{API_PATH}/#{API_VERSION}"
7
+
8
+ EMAIL_HEADER_KEY = 'X-User-Email'
9
+ TOKEN_HEADER_KEY = 'X-User-Token'
10
+
11
+ DEFAULT_CONTENT_TYPE = 'application/json'
12
+
13
+ def self.question_uri(question_id=nil)
14
+ if question_id
15
+ "#{BASE_PATH}/questions/#{question_id}"
16
+ else
17
+ "#{BASE_PATH}/questions"
18
+ end
19
+ end
20
+
21
+
22
+ def self.answer_uri(answer_id=nil)
23
+ if answer_id
24
+ "#{BASE_PATH}/answers/#{answer_id}"
25
+ else
26
+ "#{BASE_PATH}/answers"
27
+ end
28
+ end
29
+
30
+ def self.uri(resource, id=nil)
31
+ case resource
32
+ when :question
33
+ question_uri(id)
34
+ when :answer
35
+ answer_uri(id)
36
+ end
37
+ end
38
+
39
+ end
40
+ end
@@ -0,0 +1,38 @@
1
+ module Answers
2
+ class Question < BaseModel
3
+
4
+ QUESTION_ATTRS = [
5
+ {name: :id, read_only: true},
6
+ {name: :created_at, read_only: true},
7
+ {name: :updated_at, read_only: true},
8
+ {name: :text, read_only: false},
9
+ {name: :in_language, read_only: false},
10
+ {name: :answers, read_only: false}
11
+ ]
12
+
13
+ QUESTION_ATTRS.each do |attribute|
14
+ attr_fn = attribute[:read_only] ? :attr_reader : :attr_accessor
15
+ send(attr_fn, attribute[:name])
16
+ end
17
+
18
+ def initialize(params={})
19
+ QUESTION_ATTRS.each do |attribute|
20
+ instance_variable_set("@#{attribute[:name]}", params[attribute[:name]]) if params[attribute[:name]]
21
+ end
22
+ update_attributes!(params)
23
+ end
24
+
25
+ def attributes
26
+ ivar_to_sym = Proc.new {|ivar| ivar.to_s.sub(/^@/, '').to_sym}
27
+
28
+ attributes = instance_variables.inject({}) do |r, s|
29
+ r.merge!({ivar_to_sym[s] => instance_variable_get(s)})
30
+ end.delete_if do |k,v|
31
+ !QUESTION_ATTRS.map {|attribute| attribute[:name]}.include?(ivar_to_sym[k])
32
+ end
33
+
34
+ attributes
35
+ end
36
+
37
+ end
38
+ end
@@ -0,0 +1,3 @@
1
+ module Answers
2
+ VERSION = '0.0.1'
3
+ end
@@ -0,0 +1,115 @@
1
+ require 'spec_helper'
2
+ require 'pry'
3
+
4
+ describe Answers::Answer, :vcr do
5
+ context 'When API keys are not provided' do
6
+ before(:each) { Answers.init }
7
+
8
+ describe "GET index" do
9
+ let(:answers) { Answers::Answer.all }
10
+
11
+ it "retrieves a list of Answers" do
12
+ expect(answers).to(be_a(Array))
13
+ end
14
+
15
+ it "contains objects only of type Answer::Answer" do
16
+ types = answers.map {|a| a.class}.uniq
17
+ expect(types.length).to(eq(1))
18
+ expect(types.first).to(eq(Answers::Answer))
19
+ end
20
+ end
21
+
22
+ describe "GET show" do
23
+ let(:answer) { Answers::Answer.find(1) }
24
+
25
+ it "retrieves a single object of type Answers::Answer" do
26
+ expect(answer).to(be_a(Answers::Answer))
27
+ end
28
+ end
29
+
30
+ describe "POST create" do
31
+ it "throws an Answers::Error" do
32
+ answer = Answers::Answer.new
33
+ answer.text = 'sample'
34
+ answer.in_language = 'english'
35
+
36
+ expect { answer.save }.to raise_error(Answers::Error)
37
+ end
38
+ end
39
+
40
+ describe "PUT update" do
41
+ it "throws an Answers::Error" do
42
+ answer = Answers::Answer.find(1)
43
+ answer.text = 'revised'
44
+
45
+ expect { answer.save }.to raise_error(Answers::Error)
46
+ end
47
+ end
48
+
49
+ describe "DELETE destroy" do
50
+ it "throws an Answers::Error" do
51
+ answer = Answers::Answer.find(1)
52
+
53
+ expect { answer.delete }.to raise_error(Answers::Error)
54
+ end
55
+ end
56
+
57
+ end
58
+
59
+ context 'When API keys are provided' do
60
+ before(:each) do
61
+ Answers.init({
62
+ user_email: ENV['ANSWERS_USER_EMAIL'],
63
+ user_token: ENV['ANSWERS_USER_TOKEN']
64
+ })
65
+ end
66
+
67
+ describe "POST create" do
68
+ it "creates an Answer::Answer" do
69
+ answer = Answers::Answer.new
70
+ answer.text = 'sample'
71
+ answer.in_language = 'english'
72
+
73
+ old_created_at = answer.created_at
74
+ old_id = answer.id
75
+
76
+ answer.save
77
+
78
+ new_id = answer.id
79
+ new_created_at = answer.created_at
80
+
81
+ expect(old_id).to(be(nil))
82
+ expect(old_created_at).to(be(nil))
83
+ expect(new_id).to(be_a(Fixnum))
84
+ expect(new_created_at).to(be_a(String))
85
+ end
86
+ end
87
+
88
+ describe "PUT update" do
89
+ it "updates an Answer::Answer" do
90
+ answer = Answers::Answer.find(1)
91
+
92
+ old_updated_at = answer.updated_at
93
+ answer.text = 'new_text'
94
+ answer.save
95
+
96
+ #expect(answer.updated_at).not_to(eq(old_updated_at))
97
+ end
98
+ end
99
+
100
+ describe "DELETE destroy" do
101
+ it "deletes an Answer::Answer" do
102
+ answer = Answers::Answer.new
103
+ answer.text = 'sample'
104
+ answer.in_language = 'english'
105
+ answer.save
106
+
107
+ answer_to_delete = Answers::Answer.find(answer.id)
108
+ answer_to_delete.delete
109
+ query = Answers::Answer.find(answer.id)
110
+
111
+ expect(query).to(be(nil))
112
+ end
113
+ end
114
+ end
115
+ end
@@ -0,0 +1,97 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://localhost:1337/api/v1/answers/1
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ User-Agent:
13
+ - Faraday v0.9.0
14
+ Accept-Encoding:
15
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
+ Accept:
17
+ - "*/*"
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ X-Frame-Options:
24
+ - SAMEORIGIN
25
+ X-Xss-Protection:
26
+ - 1; mode=block
27
+ X-Content-Type-Options:
28
+ - nosniff
29
+ Content-Type:
30
+ - application/json; charset=utf-8
31
+ Etag:
32
+ - '"16891a972266d98b659eef6fcd1c3cc2"'
33
+ Cache-Control:
34
+ - max-age=0, private, must-revalidate
35
+ Set-Cookie:
36
+ - request_method=GET; path=/
37
+ X-Request-Id:
38
+ - 047be76a-bbb7-4e55-832c-b516aec6f6b3
39
+ X-Runtime:
40
+ - '0.143766'
41
+ Vary:
42
+ - Accept-Encoding
43
+ Connection:
44
+ - close
45
+ Server:
46
+ - thin 1.6.2 codename Doc Brown
47
+ body:
48
+ encoding: UTF-8
49
+ string: '{"answers":[{"id":1,"created_at":"2014-07-17T17:05:22.757Z","updated_at":"2014-07-25T17:40:55.377Z","text":"new_text","url":"http://localhost:1337/answers/1"}]}'
50
+ http_version:
51
+ recorded_at: Mon, 28 Jul 2014 14:43:13 GMT
52
+ - request:
53
+ method: delete
54
+ uri: http://localhost:1337/api/v1/answers/1
55
+ body:
56
+ encoding: US-ASCII
57
+ string: ''
58
+ headers:
59
+ Content-Type:
60
+ - application/json
61
+ User-Agent:
62
+ - Faraday v0.9.0
63
+ Accept-Encoding:
64
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
65
+ Accept:
66
+ - "*/*"
67
+ response:
68
+ status:
69
+ code: 401
70
+ message: Unauthorized
71
+ headers:
72
+ X-Frame-Options:
73
+ - SAMEORIGIN
74
+ X-Xss-Protection:
75
+ - 1; mode=block
76
+ X-Content-Type-Options:
77
+ - nosniff
78
+ Content-Type:
79
+ - application/json; charset=utf-8
80
+ Cache-Control:
81
+ - no-cache
82
+ X-Request-Id:
83
+ - 3f3e134b-fcfa-4a28-90e7-df968b604a63
84
+ X-Runtime:
85
+ - '0.011790'
86
+ Vary:
87
+ - Accept-Encoding
88
+ Connection:
89
+ - close
90
+ Server:
91
+ - thin 1.6.2 codename Doc Brown
92
+ body:
93
+ encoding: UTF-8
94
+ string: '{"error":"You need to sign in or sign up before continuing."}'
95
+ http_version:
96
+ recorded_at: Mon, 28 Jul 2014 14:43:13 GMT
97
+ recorded_with: VCR 2.9.2
@@ -0,0 +1,90 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://localhost:1337/api/v1/answers
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ User-Agent:
13
+ - Faraday v0.9.0
14
+ Accept-Encoding:
15
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
+ Accept:
17
+ - "*/*"
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ X-Frame-Options:
24
+ - SAMEORIGIN
25
+ X-Xss-Protection:
26
+ - 1; mode=block
27
+ X-Content-Type-Options:
28
+ - nosniff
29
+ Content-Type:
30
+ - application/json; charset=utf-8
31
+ Etag:
32
+ - '"0636a3d430a4a4d5f7d8de94ed39ecc7"'
33
+ Cache-Control:
34
+ - max-age=0, private, must-revalidate
35
+ Set-Cookie:
36
+ - request_method=GET; path=/
37
+ X-Request-Id:
38
+ - 386d15af-21cf-45d4-8f2b-e74b02680b14
39
+ X-Runtime:
40
+ - '0.086484'
41
+ Vary:
42
+ - Accept-Encoding
43
+ Connection:
44
+ - close
45
+ Server:
46
+ - thin 1.6.2 codename Doc Brown
47
+ body:
48
+ encoding: UTF-8
49
+ string: '{"answers":[{"id":2,"created_at":"2014-07-17T17:05:39.490Z","updated_at":"2014-07-17T17:06:06.004Z","text":"Yes!","url":"http://localhost:1337/answers/2"},{"id":3,"created_at":"2014-07-18T16:49:05.101Z","updated_at":"2014-07-18T16:49:05.101Z","text":null,"url":"http://localhost:1337/answers/3"},{"id":4,"created_at":"2014-07-18T17:12:14.381Z","updated_at":"2014-07-18T17:12:14.381Z","text":null,"url":"http://localhost:1337/answers/4"},{"id":5,"created_at":"2014-07-18T17:14:52.681Z","updated_at":"2014-07-18T17:14:52.681Z","text":null,"url":"http://localhost:1337/answers/5"},{"id":6,"created_at":"2014-07-18T17:15:01.684Z","updated_at":"2014-07-18T17:15:01.684Z","text":null,"url":"http://localhost:1337/answers/6"},{"id":7,"created_at":"2014-07-18T17:15:51.588Z","updated_at":"2014-07-18T17:15:51.588Z","text":null,"url":"http://localhost:1337/answers/7"},{"id":8,"created_at":"2014-07-18T17:17:12.070Z","updated_at":"2014-07-18T17:17:12.070Z","text":null,"url":"http://localhost:1337/answers/8"},{"id":9,"created_at":"2014-07-18T17:28:41.625Z","updated_at":"2014-07-18T17:28:41.625Z","text":null,"url":"http://localhost:1337/answers/9"},{"id":10,"created_at":"2014-07-18T17:57:03.533Z","updated_at":"2014-07-18T17:57:03.533Z","text":null,"url":"http://localhost:1337/answers/10"},{"id":11,"created_at":"2014-07-18T18:11:59.076Z","updated_at":"2014-07-18T18:11:59.076Z","text":"yes","url":"http://localhost:1337/answers/11"},{"id":12,"created_at":"2014-07-21T15:10:18.774Z","updated_at":"2014-07-21T15:10:18.774Z","text":"Yes","url":"http://localhost:1337/answers/12"},{"id":13,"created_at":"2014-07-23T15:41:03.404Z","updated_at":"2014-07-23T15:41:03.404Z","text":"yes","url":"http://localhost:1337/answers/13"},{"id":14,"created_at":"2014-07-25T16:23:37.219Z","updated_at":"2014-07-25T16:23:37.219Z","text":"sample","url":"http://localhost:1337/answers/14"},{"id":16,"created_at":"2014-07-25T16:25:06.193Z","updated_at":"2014-07-25T16:25:06.193Z","text":"an
50
+ answer 7648 0","url":"http://localhost:1337/answers/16"},{"id":17,"created_at":"2014-07-25T16:25:06.200Z","updated_at":"2014-07-25T16:25:06.200Z","text":"an
51
+ answer 55638 1","url":"http://localhost:1337/answers/17"},{"id":18,"created_at":"2014-07-25T16:25:06.202Z","updated_at":"2014-07-25T16:25:06.202Z","text":"an
52
+ answer 85267 2","url":"http://localhost:1337/answers/18"},{"id":19,"created_at":"2014-07-25T16:25:06.204Z","updated_at":"2014-07-25T16:25:06.204Z","text":"an
53
+ answer 23205 3","url":"http://localhost:1337/answers/19"},{"id":20,"created_at":"2014-07-25T16:25:06.206Z","updated_at":"2014-07-25T16:25:06.206Z","text":"an
54
+ answer 91873 4","url":"http://localhost:1337/answers/20"},{"id":21,"created_at":"2014-07-25T16:25:06.208Z","updated_at":"2014-07-25T16:25:06.208Z","text":"an
55
+ answer 96853 5","url":"http://localhost:1337/answers/21"},{"id":22,"created_at":"2014-07-25T16:25:06.210Z","updated_at":"2014-07-25T16:25:06.210Z","text":"an
56
+ answer 85643 6","url":"http://localhost:1337/answers/22"},{"id":23,"created_at":"2014-07-25T16:25:06.212Z","updated_at":"2014-07-25T16:25:06.212Z","text":"an
57
+ answer 45973 7","url":"http://localhost:1337/answers/23"},{"id":24,"created_at":"2014-07-25T16:25:06.214Z","updated_at":"2014-07-25T16:25:06.214Z","text":"an
58
+ answer 21200 8","url":"http://localhost:1337/answers/24"},{"id":25,"created_at":"2014-07-25T16:25:06.216Z","updated_at":"2014-07-25T16:25:06.216Z","text":"an
59
+ answer 13270 9","url":"http://localhost:1337/answers/25"},{"id":26,"created_at":"2014-07-25T16:25:06.218Z","updated_at":"2014-07-25T16:25:06.218Z","text":"an
60
+ answer 43568 10","url":"http://localhost:1337/answers/26"},{"id":27,"created_at":"2014-07-25T16:25:06.220Z","updated_at":"2014-07-25T16:25:06.220Z","text":"an
61
+ answer 36420 11","url":"http://localhost:1337/answers/27"},{"id":28,"created_at":"2014-07-25T16:25:06.222Z","updated_at":"2014-07-25T16:25:06.222Z","text":"an
62
+ answer 29447 12","url":"http://localhost:1337/answers/28"},{"id":29,"created_at":"2014-07-25T16:25:06.224Z","updated_at":"2014-07-25T16:25:06.224Z","text":"an
63
+ answer 69741 13","url":"http://localhost:1337/answers/29"},{"id":30,"created_at":"2014-07-25T16:25:06.227Z","updated_at":"2014-07-25T16:25:06.227Z","text":"an
64
+ answer 23576 14","url":"http://localhost:1337/answers/30"},{"id":31,"created_at":"2014-07-25T16:25:06.229Z","updated_at":"2014-07-25T16:25:06.229Z","text":"an
65
+ answer 90593 15","url":"http://localhost:1337/answers/31"},{"id":32,"created_at":"2014-07-25T16:25:06.232Z","updated_at":"2014-07-25T16:25:06.232Z","text":"an
66
+ answer 84598 16","url":"http://localhost:1337/answers/32"},{"id":33,"created_at":"2014-07-25T16:25:06.234Z","updated_at":"2014-07-25T16:25:06.234Z","text":"an
67
+ answer 19323 17","url":"http://localhost:1337/answers/33"},{"id":34,"created_at":"2014-07-25T16:25:06.235Z","updated_at":"2014-07-25T16:25:06.235Z","text":"an
68
+ answer 43581 18","url":"http://localhost:1337/answers/34"},{"id":35,"created_at":"2014-07-25T16:25:06.237Z","updated_at":"2014-07-25T16:25:06.237Z","text":"an
69
+ answer 87101 19","url":"http://localhost:1337/answers/35"},{"id":36,"created_at":"2014-07-25T16:25:06.239Z","updated_at":"2014-07-25T16:25:06.239Z","text":"an
70
+ answer 80247 20","url":"http://localhost:1337/answers/36"},{"id":37,"created_at":"2014-07-25T16:25:06.241Z","updated_at":"2014-07-25T16:25:06.241Z","text":"an
71
+ answer 60281 21","url":"http://localhost:1337/answers/37"},{"id":38,"created_at":"2014-07-25T16:25:06.242Z","updated_at":"2014-07-25T16:25:06.242Z","text":"an
72
+ answer 40109 22","url":"http://localhost:1337/answers/38"},{"id":39,"created_at":"2014-07-25T16:25:06.244Z","updated_at":"2014-07-25T16:25:06.244Z","text":"an
73
+ answer 69027 23","url":"http://localhost:1337/answers/39"},{"id":40,"created_at":"2014-07-25T16:25:06.246Z","updated_at":"2014-07-25T16:25:06.246Z","text":"an
74
+ answer 57697 24","url":"http://localhost:1337/answers/40"},{"id":41,"created_at":"2014-07-25T16:25:06.249Z","updated_at":"2014-07-25T16:25:06.249Z","text":"an
75
+ answer 70683 25","url":"http://localhost:1337/answers/41"},{"id":42,"created_at":"2014-07-25T16:25:06.252Z","updated_at":"2014-07-25T16:25:06.252Z","text":"an
76
+ answer 40660 26","url":"http://localhost:1337/answers/42"},{"id":43,"created_at":"2014-07-25T16:25:06.255Z","updated_at":"2014-07-25T16:25:06.255Z","text":"an
77
+ answer 23051 27","url":"http://localhost:1337/answers/43"},{"id":44,"created_at":"2014-07-25T16:25:06.258Z","updated_at":"2014-07-25T16:25:06.258Z","text":"an
78
+ answer 19933 28","url":"http://localhost:1337/answers/44"},{"id":45,"created_at":"2014-07-25T16:25:06.260Z","updated_at":"2014-07-25T16:25:06.260Z","text":"an
79
+ answer 53584 29","url":"http://localhost:1337/answers/45"},{"id":46,"created_at":"2014-07-25T16:25:06.261Z","updated_at":"2014-07-25T16:25:06.261Z","text":"an
80
+ answer 57337 30","url":"http://localhost:1337/answers/46"},{"id":47,"created_at":"2014-07-25T16:25:06.263Z","updated_at":"2014-07-25T16:25:06.263Z","text":"an
81
+ answer 73834 31","url":"http://localhost:1337/answers/47"},{"id":48,"created_at":"2014-07-25T16:25:06.265Z","updated_at":"2014-07-25T16:25:06.265Z","text":"an
82
+ answer 70920 32","url":"http://localhost:1337/answers/48"},{"id":49,"created_at":"2014-07-25T16:25:06.268Z","updated_at":"2014-07-25T16:25:06.268Z","text":"an
83
+ answer 95934 33","url":"http://localhost:1337/answers/49"},{"id":50,"created_at":"2014-07-25T16:25:06.270Z","updated_at":"2014-07-25T16:25:06.270Z","text":"an
84
+ answer 81200 34","url":"http://localhost:1337/answers/50"},{"id":51,"created_at":"2014-07-25T16:25:06.272Z","updated_at":"2014-07-25T16:25:06.272Z","text":"an
85
+ answer 35566 35","url":"http://localhost:1337/answers/51"},{"id":52,"created_at":"2014-07-25T16:25:06.275Z","updated_at":"2014-07-25T16:25:06.275Z","text":"an
86
+ answer 96241 36","url":"http://localhost:1337/answers/52"},{"id":53,"created_at":"2014-07-25T16:25:06.277Z","updated_at":"2014-07-25T16:25:06.277Z","text":"an
87
+ answer 36049 37","url":"http://localhost:1337/answers/53"},{"id":54,"created_at":"2014-07-25T16:25:20.635Z","updated_at":"2014-07-25T16:25:20.635Z","text":"sample","url":"http://localhost:1337/answers/54"},{"id":56,"created_at":"2014-07-25T16:27:16.368Z","updated_at":"2014-07-25T16:27:16.368Z","text":"sample","url":"http://localhost:1337/answers/56"},{"id":90,"created_at":"2014-07-25T17:38:49.116Z","updated_at":"2014-07-25T17:38:49.116Z","text":"sample","url":"http://localhost:1337/answers/90"},{"id":58,"created_at":"2014-07-25T16:27:48.436Z","updated_at":"2014-07-25T16:27:48.436Z","text":"sample","url":"http://localhost:1337/answers/58"},{"id":60,"created_at":"2014-07-25T16:28:12.320Z","updated_at":"2014-07-25T16:28:12.320Z","text":"sample","url":"http://localhost:1337/answers/60"},{"id":62,"created_at":"2014-07-25T16:31:14.264Z","updated_at":"2014-07-25T16:31:14.264Z","text":"sample","url":"http://localhost:1337/answers/62"},{"id":92,"created_at":"2014-07-25T17:38:53.467Z","updated_at":"2014-07-25T17:38:53.467Z","text":"sample","url":"http://localhost:1337/answers/92"},{"id":64,"created_at":"2014-07-25T16:32:48.743Z","updated_at":"2014-07-25T16:32:48.743Z","text":"sample","url":"http://localhost:1337/answers/64"},{"id":66,"created_at":"2014-07-25T16:33:16.638Z","updated_at":"2014-07-25T16:33:16.638Z","text":"sample","url":"http://localhost:1337/answers/66"},{"id":68,"created_at":"2014-07-25T16:33:38.790Z","updated_at":"2014-07-25T16:33:38.790Z","text":"sample","url":"http://localhost:1337/answers/68"},{"id":94,"created_at":"2014-07-25T17:39:05.628Z","updated_at":"2014-07-25T17:39:05.628Z","text":"sample","url":"http://localhost:1337/answers/94"},{"id":70,"created_at":"2014-07-25T16:36:30.260Z","updated_at":"2014-07-25T16:36:30.260Z","text":"sample","url":"http://localhost:1337/answers/70"},{"id":72,"created_at":"2014-07-25T16:39:23.676Z","updated_at":"2014-07-25T16:39:23.676Z","text":"sample","url":"http://localhost:1337/answers/72"},{"id":74,"created_at":"2014-07-25T16:39:50.119Z","updated_at":"2014-07-25T16:39:50.119Z","text":"sample","url":"http://localhost:1337/answers/74"},{"id":96,"created_at":"2014-07-25T17:39:47.170Z","updated_at":"2014-07-25T17:39:47.170Z","text":"sample","url":"http://localhost:1337/answers/96"},{"id":76,"created_at":"2014-07-25T16:40:27.551Z","updated_at":"2014-07-25T16:40:27.551Z","text":"sample","url":"http://localhost:1337/answers/76"},{"id":78,"created_at":"2014-07-25T16:49:39.795Z","updated_at":"2014-07-25T16:49:39.795Z","text":"sample","url":"http://localhost:1337/answers/78"},{"id":80,"created_at":"2014-07-25T16:54:11.372Z","updated_at":"2014-07-25T16:54:11.372Z","text":"sample","url":"http://localhost:1337/answers/80"},{"id":98,"created_at":"2014-07-25T17:40:55.316Z","updated_at":"2014-07-25T17:40:55.316Z","text":"sample","url":"http://localhost:1337/answers/98"},{"id":82,"created_at":"2014-07-25T16:54:52.692Z","updated_at":"2014-07-25T16:54:52.692Z","text":"sample","url":"http://localhost:1337/answers/82"},{"id":1,"created_at":"2014-07-17T17:05:22.757Z","updated_at":"2014-07-25T17:40:55.377Z","text":"new_text","url":"http://localhost:1337/answers/1"},{"id":84,"created_at":"2014-07-25T17:32:19.348Z","updated_at":"2014-07-25T17:32:19.348Z","text":"sample","url":"http://localhost:1337/answers/84"},{"id":86,"created_at":"2014-07-25T17:35:10.693Z","updated_at":"2014-07-25T17:35:10.693Z","text":"sample","url":"http://localhost:1337/answers/86"},{"id":88,"created_at":"2014-07-25T17:37:16.078Z","updated_at":"2014-07-25T17:37:16.078Z","text":"sample","url":"http://localhost:1337/answers/88"},{"id":100,"created_at":"2014-07-28T14:35:39.008Z","updated_at":"2014-07-28T14:35:39.008Z","text":"sample","url":"http://localhost:1337/answers/100"},{"id":102,"created_at":"2014-07-28T14:37:34.292Z","updated_at":"2014-07-28T14:37:34.292Z","text":"sample","url":"http://localhost:1337/answers/102"},{"id":104,"created_at":"2014-07-28T14:39:09.595Z","updated_at":"2014-07-28T14:39:09.595Z","text":"sample","url":"http://localhost:1337/answers/104"},{"id":106,"created_at":"2014-07-28T14:40:16.311Z","updated_at":"2014-07-28T14:40:16.311Z","text":"sample","url":"http://localhost:1337/answers/106"}]}'
88
+ http_version:
89
+ recorded_at: Mon, 28 Jul 2014 14:43:13 GMT
90
+ recorded_with: VCR 2.9.2
@@ -0,0 +1,90 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://localhost:1337/api/v1/answers
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ User-Agent:
13
+ - Faraday v0.9.0
14
+ Accept-Encoding:
15
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
+ Accept:
17
+ - "*/*"
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ X-Frame-Options:
24
+ - SAMEORIGIN
25
+ X-Xss-Protection:
26
+ - 1; mode=block
27
+ X-Content-Type-Options:
28
+ - nosniff
29
+ Content-Type:
30
+ - application/json; charset=utf-8
31
+ Etag:
32
+ - '"0636a3d430a4a4d5f7d8de94ed39ecc7"'
33
+ Cache-Control:
34
+ - max-age=0, private, must-revalidate
35
+ Set-Cookie:
36
+ - request_method=GET; path=/
37
+ X-Request-Id:
38
+ - 3f43155c-f39e-4c21-b34c-e7b03b12a5b9
39
+ X-Runtime:
40
+ - '0.086250'
41
+ Vary:
42
+ - Accept-Encoding
43
+ Connection:
44
+ - close
45
+ Server:
46
+ - thin 1.6.2 codename Doc Brown
47
+ body:
48
+ encoding: UTF-8
49
+ string: '{"answers":[{"id":2,"created_at":"2014-07-17T17:05:39.490Z","updated_at":"2014-07-17T17:06:06.004Z","text":"Yes!","url":"http://localhost:1337/answers/2"},{"id":3,"created_at":"2014-07-18T16:49:05.101Z","updated_at":"2014-07-18T16:49:05.101Z","text":null,"url":"http://localhost:1337/answers/3"},{"id":4,"created_at":"2014-07-18T17:12:14.381Z","updated_at":"2014-07-18T17:12:14.381Z","text":null,"url":"http://localhost:1337/answers/4"},{"id":5,"created_at":"2014-07-18T17:14:52.681Z","updated_at":"2014-07-18T17:14:52.681Z","text":null,"url":"http://localhost:1337/answers/5"},{"id":6,"created_at":"2014-07-18T17:15:01.684Z","updated_at":"2014-07-18T17:15:01.684Z","text":null,"url":"http://localhost:1337/answers/6"},{"id":7,"created_at":"2014-07-18T17:15:51.588Z","updated_at":"2014-07-18T17:15:51.588Z","text":null,"url":"http://localhost:1337/answers/7"},{"id":8,"created_at":"2014-07-18T17:17:12.070Z","updated_at":"2014-07-18T17:17:12.070Z","text":null,"url":"http://localhost:1337/answers/8"},{"id":9,"created_at":"2014-07-18T17:28:41.625Z","updated_at":"2014-07-18T17:28:41.625Z","text":null,"url":"http://localhost:1337/answers/9"},{"id":10,"created_at":"2014-07-18T17:57:03.533Z","updated_at":"2014-07-18T17:57:03.533Z","text":null,"url":"http://localhost:1337/answers/10"},{"id":11,"created_at":"2014-07-18T18:11:59.076Z","updated_at":"2014-07-18T18:11:59.076Z","text":"yes","url":"http://localhost:1337/answers/11"},{"id":12,"created_at":"2014-07-21T15:10:18.774Z","updated_at":"2014-07-21T15:10:18.774Z","text":"Yes","url":"http://localhost:1337/answers/12"},{"id":13,"created_at":"2014-07-23T15:41:03.404Z","updated_at":"2014-07-23T15:41:03.404Z","text":"yes","url":"http://localhost:1337/answers/13"},{"id":14,"created_at":"2014-07-25T16:23:37.219Z","updated_at":"2014-07-25T16:23:37.219Z","text":"sample","url":"http://localhost:1337/answers/14"},{"id":16,"created_at":"2014-07-25T16:25:06.193Z","updated_at":"2014-07-25T16:25:06.193Z","text":"an
50
+ answer 7648 0","url":"http://localhost:1337/answers/16"},{"id":17,"created_at":"2014-07-25T16:25:06.200Z","updated_at":"2014-07-25T16:25:06.200Z","text":"an
51
+ answer 55638 1","url":"http://localhost:1337/answers/17"},{"id":18,"created_at":"2014-07-25T16:25:06.202Z","updated_at":"2014-07-25T16:25:06.202Z","text":"an
52
+ answer 85267 2","url":"http://localhost:1337/answers/18"},{"id":19,"created_at":"2014-07-25T16:25:06.204Z","updated_at":"2014-07-25T16:25:06.204Z","text":"an
53
+ answer 23205 3","url":"http://localhost:1337/answers/19"},{"id":20,"created_at":"2014-07-25T16:25:06.206Z","updated_at":"2014-07-25T16:25:06.206Z","text":"an
54
+ answer 91873 4","url":"http://localhost:1337/answers/20"},{"id":21,"created_at":"2014-07-25T16:25:06.208Z","updated_at":"2014-07-25T16:25:06.208Z","text":"an
55
+ answer 96853 5","url":"http://localhost:1337/answers/21"},{"id":22,"created_at":"2014-07-25T16:25:06.210Z","updated_at":"2014-07-25T16:25:06.210Z","text":"an
56
+ answer 85643 6","url":"http://localhost:1337/answers/22"},{"id":23,"created_at":"2014-07-25T16:25:06.212Z","updated_at":"2014-07-25T16:25:06.212Z","text":"an
57
+ answer 45973 7","url":"http://localhost:1337/answers/23"},{"id":24,"created_at":"2014-07-25T16:25:06.214Z","updated_at":"2014-07-25T16:25:06.214Z","text":"an
58
+ answer 21200 8","url":"http://localhost:1337/answers/24"},{"id":25,"created_at":"2014-07-25T16:25:06.216Z","updated_at":"2014-07-25T16:25:06.216Z","text":"an
59
+ answer 13270 9","url":"http://localhost:1337/answers/25"},{"id":26,"created_at":"2014-07-25T16:25:06.218Z","updated_at":"2014-07-25T16:25:06.218Z","text":"an
60
+ answer 43568 10","url":"http://localhost:1337/answers/26"},{"id":27,"created_at":"2014-07-25T16:25:06.220Z","updated_at":"2014-07-25T16:25:06.220Z","text":"an
61
+ answer 36420 11","url":"http://localhost:1337/answers/27"},{"id":28,"created_at":"2014-07-25T16:25:06.222Z","updated_at":"2014-07-25T16:25:06.222Z","text":"an
62
+ answer 29447 12","url":"http://localhost:1337/answers/28"},{"id":29,"created_at":"2014-07-25T16:25:06.224Z","updated_at":"2014-07-25T16:25:06.224Z","text":"an
63
+ answer 69741 13","url":"http://localhost:1337/answers/29"},{"id":30,"created_at":"2014-07-25T16:25:06.227Z","updated_at":"2014-07-25T16:25:06.227Z","text":"an
64
+ answer 23576 14","url":"http://localhost:1337/answers/30"},{"id":31,"created_at":"2014-07-25T16:25:06.229Z","updated_at":"2014-07-25T16:25:06.229Z","text":"an
65
+ answer 90593 15","url":"http://localhost:1337/answers/31"},{"id":32,"created_at":"2014-07-25T16:25:06.232Z","updated_at":"2014-07-25T16:25:06.232Z","text":"an
66
+ answer 84598 16","url":"http://localhost:1337/answers/32"},{"id":33,"created_at":"2014-07-25T16:25:06.234Z","updated_at":"2014-07-25T16:25:06.234Z","text":"an
67
+ answer 19323 17","url":"http://localhost:1337/answers/33"},{"id":34,"created_at":"2014-07-25T16:25:06.235Z","updated_at":"2014-07-25T16:25:06.235Z","text":"an
68
+ answer 43581 18","url":"http://localhost:1337/answers/34"},{"id":35,"created_at":"2014-07-25T16:25:06.237Z","updated_at":"2014-07-25T16:25:06.237Z","text":"an
69
+ answer 87101 19","url":"http://localhost:1337/answers/35"},{"id":36,"created_at":"2014-07-25T16:25:06.239Z","updated_at":"2014-07-25T16:25:06.239Z","text":"an
70
+ answer 80247 20","url":"http://localhost:1337/answers/36"},{"id":37,"created_at":"2014-07-25T16:25:06.241Z","updated_at":"2014-07-25T16:25:06.241Z","text":"an
71
+ answer 60281 21","url":"http://localhost:1337/answers/37"},{"id":38,"created_at":"2014-07-25T16:25:06.242Z","updated_at":"2014-07-25T16:25:06.242Z","text":"an
72
+ answer 40109 22","url":"http://localhost:1337/answers/38"},{"id":39,"created_at":"2014-07-25T16:25:06.244Z","updated_at":"2014-07-25T16:25:06.244Z","text":"an
73
+ answer 69027 23","url":"http://localhost:1337/answers/39"},{"id":40,"created_at":"2014-07-25T16:25:06.246Z","updated_at":"2014-07-25T16:25:06.246Z","text":"an
74
+ answer 57697 24","url":"http://localhost:1337/answers/40"},{"id":41,"created_at":"2014-07-25T16:25:06.249Z","updated_at":"2014-07-25T16:25:06.249Z","text":"an
75
+ answer 70683 25","url":"http://localhost:1337/answers/41"},{"id":42,"created_at":"2014-07-25T16:25:06.252Z","updated_at":"2014-07-25T16:25:06.252Z","text":"an
76
+ answer 40660 26","url":"http://localhost:1337/answers/42"},{"id":43,"created_at":"2014-07-25T16:25:06.255Z","updated_at":"2014-07-25T16:25:06.255Z","text":"an
77
+ answer 23051 27","url":"http://localhost:1337/answers/43"},{"id":44,"created_at":"2014-07-25T16:25:06.258Z","updated_at":"2014-07-25T16:25:06.258Z","text":"an
78
+ answer 19933 28","url":"http://localhost:1337/answers/44"},{"id":45,"created_at":"2014-07-25T16:25:06.260Z","updated_at":"2014-07-25T16:25:06.260Z","text":"an
79
+ answer 53584 29","url":"http://localhost:1337/answers/45"},{"id":46,"created_at":"2014-07-25T16:25:06.261Z","updated_at":"2014-07-25T16:25:06.261Z","text":"an
80
+ answer 57337 30","url":"http://localhost:1337/answers/46"},{"id":47,"created_at":"2014-07-25T16:25:06.263Z","updated_at":"2014-07-25T16:25:06.263Z","text":"an
81
+ answer 73834 31","url":"http://localhost:1337/answers/47"},{"id":48,"created_at":"2014-07-25T16:25:06.265Z","updated_at":"2014-07-25T16:25:06.265Z","text":"an
82
+ answer 70920 32","url":"http://localhost:1337/answers/48"},{"id":49,"created_at":"2014-07-25T16:25:06.268Z","updated_at":"2014-07-25T16:25:06.268Z","text":"an
83
+ answer 95934 33","url":"http://localhost:1337/answers/49"},{"id":50,"created_at":"2014-07-25T16:25:06.270Z","updated_at":"2014-07-25T16:25:06.270Z","text":"an
84
+ answer 81200 34","url":"http://localhost:1337/answers/50"},{"id":51,"created_at":"2014-07-25T16:25:06.272Z","updated_at":"2014-07-25T16:25:06.272Z","text":"an
85
+ answer 35566 35","url":"http://localhost:1337/answers/51"},{"id":52,"created_at":"2014-07-25T16:25:06.275Z","updated_at":"2014-07-25T16:25:06.275Z","text":"an
86
+ answer 96241 36","url":"http://localhost:1337/answers/52"},{"id":53,"created_at":"2014-07-25T16:25:06.277Z","updated_at":"2014-07-25T16:25:06.277Z","text":"an
87
+ answer 36049 37","url":"http://localhost:1337/answers/53"},{"id":54,"created_at":"2014-07-25T16:25:20.635Z","updated_at":"2014-07-25T16:25:20.635Z","text":"sample","url":"http://localhost:1337/answers/54"},{"id":56,"created_at":"2014-07-25T16:27:16.368Z","updated_at":"2014-07-25T16:27:16.368Z","text":"sample","url":"http://localhost:1337/answers/56"},{"id":90,"created_at":"2014-07-25T17:38:49.116Z","updated_at":"2014-07-25T17:38:49.116Z","text":"sample","url":"http://localhost:1337/answers/90"},{"id":58,"created_at":"2014-07-25T16:27:48.436Z","updated_at":"2014-07-25T16:27:48.436Z","text":"sample","url":"http://localhost:1337/answers/58"},{"id":60,"created_at":"2014-07-25T16:28:12.320Z","updated_at":"2014-07-25T16:28:12.320Z","text":"sample","url":"http://localhost:1337/answers/60"},{"id":62,"created_at":"2014-07-25T16:31:14.264Z","updated_at":"2014-07-25T16:31:14.264Z","text":"sample","url":"http://localhost:1337/answers/62"},{"id":92,"created_at":"2014-07-25T17:38:53.467Z","updated_at":"2014-07-25T17:38:53.467Z","text":"sample","url":"http://localhost:1337/answers/92"},{"id":64,"created_at":"2014-07-25T16:32:48.743Z","updated_at":"2014-07-25T16:32:48.743Z","text":"sample","url":"http://localhost:1337/answers/64"},{"id":66,"created_at":"2014-07-25T16:33:16.638Z","updated_at":"2014-07-25T16:33:16.638Z","text":"sample","url":"http://localhost:1337/answers/66"},{"id":68,"created_at":"2014-07-25T16:33:38.790Z","updated_at":"2014-07-25T16:33:38.790Z","text":"sample","url":"http://localhost:1337/answers/68"},{"id":94,"created_at":"2014-07-25T17:39:05.628Z","updated_at":"2014-07-25T17:39:05.628Z","text":"sample","url":"http://localhost:1337/answers/94"},{"id":70,"created_at":"2014-07-25T16:36:30.260Z","updated_at":"2014-07-25T16:36:30.260Z","text":"sample","url":"http://localhost:1337/answers/70"},{"id":72,"created_at":"2014-07-25T16:39:23.676Z","updated_at":"2014-07-25T16:39:23.676Z","text":"sample","url":"http://localhost:1337/answers/72"},{"id":74,"created_at":"2014-07-25T16:39:50.119Z","updated_at":"2014-07-25T16:39:50.119Z","text":"sample","url":"http://localhost:1337/answers/74"},{"id":96,"created_at":"2014-07-25T17:39:47.170Z","updated_at":"2014-07-25T17:39:47.170Z","text":"sample","url":"http://localhost:1337/answers/96"},{"id":76,"created_at":"2014-07-25T16:40:27.551Z","updated_at":"2014-07-25T16:40:27.551Z","text":"sample","url":"http://localhost:1337/answers/76"},{"id":78,"created_at":"2014-07-25T16:49:39.795Z","updated_at":"2014-07-25T16:49:39.795Z","text":"sample","url":"http://localhost:1337/answers/78"},{"id":80,"created_at":"2014-07-25T16:54:11.372Z","updated_at":"2014-07-25T16:54:11.372Z","text":"sample","url":"http://localhost:1337/answers/80"},{"id":98,"created_at":"2014-07-25T17:40:55.316Z","updated_at":"2014-07-25T17:40:55.316Z","text":"sample","url":"http://localhost:1337/answers/98"},{"id":82,"created_at":"2014-07-25T16:54:52.692Z","updated_at":"2014-07-25T16:54:52.692Z","text":"sample","url":"http://localhost:1337/answers/82"},{"id":1,"created_at":"2014-07-17T17:05:22.757Z","updated_at":"2014-07-25T17:40:55.377Z","text":"new_text","url":"http://localhost:1337/answers/1"},{"id":84,"created_at":"2014-07-25T17:32:19.348Z","updated_at":"2014-07-25T17:32:19.348Z","text":"sample","url":"http://localhost:1337/answers/84"},{"id":86,"created_at":"2014-07-25T17:35:10.693Z","updated_at":"2014-07-25T17:35:10.693Z","text":"sample","url":"http://localhost:1337/answers/86"},{"id":88,"created_at":"2014-07-25T17:37:16.078Z","updated_at":"2014-07-25T17:37:16.078Z","text":"sample","url":"http://localhost:1337/answers/88"},{"id":100,"created_at":"2014-07-28T14:35:39.008Z","updated_at":"2014-07-28T14:35:39.008Z","text":"sample","url":"http://localhost:1337/answers/100"},{"id":102,"created_at":"2014-07-28T14:37:34.292Z","updated_at":"2014-07-28T14:37:34.292Z","text":"sample","url":"http://localhost:1337/answers/102"},{"id":104,"created_at":"2014-07-28T14:39:09.595Z","updated_at":"2014-07-28T14:39:09.595Z","text":"sample","url":"http://localhost:1337/answers/104"},{"id":106,"created_at":"2014-07-28T14:40:16.311Z","updated_at":"2014-07-28T14:40:16.311Z","text":"sample","url":"http://localhost:1337/answers/106"}]}'
88
+ http_version:
89
+ recorded_at: Mon, 28 Jul 2014 14:43:12 GMT
90
+ recorded_with: VCR 2.9.2