lhc 12.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (195) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +37 -0
  3. data/.rubocop.localch.yml +325 -0
  4. data/.rubocop.yml +61 -0
  5. data/.ruby-version +1 -0
  6. data/Gemfile +13 -0
  7. data/Gemfile.activesupport4 +4 -0
  8. data/Gemfile.activesupport5 +4 -0
  9. data/Gemfile.activesupport6 +4 -0
  10. data/LICENSE +674 -0
  11. data/README.md +984 -0
  12. data/Rakefile +25 -0
  13. data/cider-ci.yml +6 -0
  14. data/cider-ci/bin/bundle +51 -0
  15. data/cider-ci/bin/ruby_install +8 -0
  16. data/cider-ci/bin/ruby_version +25 -0
  17. data/cider-ci/jobs/rspec-activesupport-4.yml +28 -0
  18. data/cider-ci/jobs/rspec-activesupport-5.yml +27 -0
  19. data/cider-ci/jobs/rspec-activesupport-6.yml +28 -0
  20. data/cider-ci/jobs/rubocop.yml +18 -0
  21. data/cider-ci/task_components/bundle.yml +22 -0
  22. data/cider-ci/task_components/rspec.yml +36 -0
  23. data/cider-ci/task_components/rubocop.yml +29 -0
  24. data/cider-ci/task_components/ruby.yml +15 -0
  25. data/friday.yml +3 -0
  26. data/lhc.gemspec +39 -0
  27. data/lib/core_ext/hash/deep_transform_values.rb +48 -0
  28. data/lib/lhc.rb +136 -0
  29. data/lib/lhc/concerns/lhc/basic_methods_concern.rb +42 -0
  30. data/lib/lhc/concerns/lhc/configuration_concern.rb +20 -0
  31. data/lib/lhc/concerns/lhc/fix_invalid_encoding_concern.rb +42 -0
  32. data/lib/lhc/concerns/lhc/formats_concern.rb +25 -0
  33. data/lib/lhc/concerns/lhc/request/user_agent_concern.rb +25 -0
  34. data/lib/lhc/config.rb +47 -0
  35. data/lib/lhc/endpoint.rb +119 -0
  36. data/lib/lhc/error.rb +80 -0
  37. data/lib/lhc/errors/client_error.rb +73 -0
  38. data/lib/lhc/errors/parser_error.rb +4 -0
  39. data/lib/lhc/errors/server_error.rb +28 -0
  40. data/lib/lhc/errors/timeout.rb +4 -0
  41. data/lib/lhc/errors/unknown_error.rb +4 -0
  42. data/lib/lhc/format.rb +18 -0
  43. data/lib/lhc/formats.rb +8 -0
  44. data/lib/lhc/formats/form.rb +45 -0
  45. data/lib/lhc/formats/json.rb +55 -0
  46. data/lib/lhc/formats/multipart.rb +45 -0
  47. data/lib/lhc/formats/plain.rb +42 -0
  48. data/lib/lhc/interceptor.rb +32 -0
  49. data/lib/lhc/interceptors.rb +26 -0
  50. data/lib/lhc/interceptors/auth.rb +98 -0
  51. data/lib/lhc/interceptors/caching.rb +127 -0
  52. data/lib/lhc/interceptors/default_timeout.rb +16 -0
  53. data/lib/lhc/interceptors/logging.rb +37 -0
  54. data/lib/lhc/interceptors/monitoring.rb +63 -0
  55. data/lib/lhc/interceptors/prometheus.rb +51 -0
  56. data/lib/lhc/interceptors/retry.rb +41 -0
  57. data/lib/lhc/interceptors/rollbar.rb +36 -0
  58. data/lib/lhc/interceptors/throttle.rb +81 -0
  59. data/lib/lhc/interceptors/zipkin.rb +110 -0
  60. data/lib/lhc/railtie.rb +10 -0
  61. data/lib/lhc/request.rb +157 -0
  62. data/lib/lhc/response.rb +60 -0
  63. data/lib/lhc/response/data.rb +28 -0
  64. data/lib/lhc/response/data/base.rb +22 -0
  65. data/lib/lhc/response/data/collection.rb +16 -0
  66. data/lib/lhc/response/data/item.rb +29 -0
  67. data/lib/lhc/rspec.rb +12 -0
  68. data/lib/lhc/test/cache_helper.rb +3 -0
  69. data/lib/lhc/version.rb +5 -0
  70. data/script/ci/build.sh +19 -0
  71. data/spec/basic_methods/delete_spec.rb +34 -0
  72. data/spec/basic_methods/get_spec.rb +49 -0
  73. data/spec/basic_methods/post_spec.rb +42 -0
  74. data/spec/basic_methods/put_spec.rb +48 -0
  75. data/spec/basic_methods/request_spec.rb +19 -0
  76. data/spec/basic_methods/request_without_rails_spec.rb +29 -0
  77. data/spec/config/endpoints_spec.rb +63 -0
  78. data/spec/config/placeholders_spec.rb +32 -0
  79. data/spec/core_ext/hash/deep_transform_values_spec.rb +24 -0
  80. data/spec/dummy/README.rdoc +28 -0
  81. data/spec/dummy/Rakefile +8 -0
  82. data/spec/dummy/app/assets/config/manifest.js +3 -0
  83. data/spec/dummy/app/assets/images/.keep +0 -0
  84. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  85. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  86. data/spec/dummy/app/controllers/application_controller.rb +7 -0
  87. data/spec/dummy/app/controllers/concerns/.keep +0 -0
  88. data/spec/dummy/app/helpers/application_helper.rb +4 -0
  89. data/spec/dummy/app/mailers/.keep +0 -0
  90. data/spec/dummy/app/models/.keep +0 -0
  91. data/spec/dummy/app/models/concerns/.keep +0 -0
  92. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  93. data/spec/dummy/bin/bundle +5 -0
  94. data/spec/dummy/bin/rails +6 -0
  95. data/spec/dummy/bin/rake +6 -0
  96. data/spec/dummy/config.ru +6 -0
  97. data/spec/dummy/config/application.rb +16 -0
  98. data/spec/dummy/config/boot.rb +7 -0
  99. data/spec/dummy/config/environment.rb +7 -0
  100. data/spec/dummy/config/environments/development.rb +36 -0
  101. data/spec/dummy/config/environments/production.rb +77 -0
  102. data/spec/dummy/config/environments/test.rb +41 -0
  103. data/spec/dummy/config/initializers/assets.rb +10 -0
  104. data/spec/dummy/config/initializers/backtrace_silencers.rb +9 -0
  105. data/spec/dummy/config/initializers/cookies_serializer.rb +5 -0
  106. data/spec/dummy/config/initializers/filter_parameter_logging.rb +6 -0
  107. data/spec/dummy/config/initializers/inflections.rb +18 -0
  108. data/spec/dummy/config/initializers/mime_types.rb +6 -0
  109. data/spec/dummy/config/initializers/session_store.rb +5 -0
  110. data/spec/dummy/config/initializers/wrap_parameters.rb +11 -0
  111. data/spec/dummy/config/locales/en.yml +23 -0
  112. data/spec/dummy/config/routes.rb +58 -0
  113. data/spec/dummy/config/secrets.yml +22 -0
  114. data/spec/dummy/lib/assets/.keep +0 -0
  115. data/spec/dummy/log/.keep +0 -0
  116. data/spec/dummy/public/404.html +67 -0
  117. data/spec/dummy/public/422.html +67 -0
  118. data/spec/dummy/public/500.html +66 -0
  119. data/spec/dummy/public/favicon.ico +0 -0
  120. data/spec/endpoint/compile_spec.rb +35 -0
  121. data/spec/endpoint/match_spec.rb +41 -0
  122. data/spec/endpoint/placeholders_spec.rb +30 -0
  123. data/spec/endpoint/remove_interpolated_params_spec.rb +17 -0
  124. data/spec/endpoint/values_as_params_spec.rb +31 -0
  125. data/spec/error/dup_spec.rb +12 -0
  126. data/spec/error/find_spec.rb +57 -0
  127. data/spec/error/response_spec.rb +17 -0
  128. data/spec/error/timeout_spec.rb +14 -0
  129. data/spec/error/to_s_spec.rb +80 -0
  130. data/spec/formats/form_spec.rb +27 -0
  131. data/spec/formats/json_spec.rb +66 -0
  132. data/spec/formats/multipart_spec.rb +26 -0
  133. data/spec/formats/plain_spec.rb +29 -0
  134. data/spec/interceptors/after_request_spec.rb +20 -0
  135. data/spec/interceptors/after_response_spec.rb +39 -0
  136. data/spec/interceptors/auth/basic_auth_spec.rb +17 -0
  137. data/spec/interceptors/auth/bearer_spec.rb +19 -0
  138. data/spec/interceptors/auth/reauthentication_configuration_spec.rb +61 -0
  139. data/spec/interceptors/auth/reauthentication_spec.rb +44 -0
  140. data/spec/interceptors/before_request_spec.rb +21 -0
  141. data/spec/interceptors/before_response_spec.rb +20 -0
  142. data/spec/interceptors/caching/hydra_spec.rb +26 -0
  143. data/spec/interceptors/caching/main_spec.rb +73 -0
  144. data/spec/interceptors/caching/methods_spec.rb +42 -0
  145. data/spec/interceptors/caching/options_spec.rb +89 -0
  146. data/spec/interceptors/caching/parameters_spec.rb +24 -0
  147. data/spec/interceptors/caching/response_status_spec.rb +29 -0
  148. data/spec/interceptors/caching/to_cache_spec.rb +16 -0
  149. data/spec/interceptors/default_interceptors_spec.rb +15 -0
  150. data/spec/interceptors/default_timeout/main_spec.rb +34 -0
  151. data/spec/interceptors/define_spec.rb +29 -0
  152. data/spec/interceptors/dup_spec.rb +19 -0
  153. data/spec/interceptors/logging/main_spec.rb +37 -0
  154. data/spec/interceptors/monitoring/main_spec.rb +97 -0
  155. data/spec/interceptors/prometheus_spec.rb +54 -0
  156. data/spec/interceptors/response_competition_spec.rb +41 -0
  157. data/spec/interceptors/retry/main_spec.rb +73 -0
  158. data/spec/interceptors/return_response_spec.rb +38 -0
  159. data/spec/interceptors/rollbar/invalid_encoding_spec.rb +43 -0
  160. data/spec/interceptors/rollbar/main_spec.rb +57 -0
  161. data/spec/interceptors/throttle/main_spec.rb +106 -0
  162. data/spec/interceptors/throttle/reset_track_spec.rb +53 -0
  163. data/spec/interceptors/zipkin/distributed_tracing_spec.rb +135 -0
  164. data/spec/rails_helper.rb +6 -0
  165. data/spec/request/body_spec.rb +39 -0
  166. data/spec/request/encoding_spec.rb +37 -0
  167. data/spec/request/error_handling_spec.rb +88 -0
  168. data/spec/request/headers_spec.rb +12 -0
  169. data/spec/request/ignore_errors_spec.rb +73 -0
  170. data/spec/request/option_dup_spec.rb +13 -0
  171. data/spec/request/parallel_requests_spec.rb +59 -0
  172. data/spec/request/params_encoding_spec.rb +26 -0
  173. data/spec/request/request_without_rails_spec.rb +15 -0
  174. data/spec/request/url_patterns_spec.rb +54 -0
  175. data/spec/request/user_agent_spec.rb +26 -0
  176. data/spec/request/user_agent_without_rails_spec.rb +27 -0
  177. data/spec/response/body_spec.rb +16 -0
  178. data/spec/response/code_spec.rb +16 -0
  179. data/spec/response/data_accessor_spec.rb +29 -0
  180. data/spec/response/data_spec.rb +61 -0
  181. data/spec/response/effective_url_spec.rb +16 -0
  182. data/spec/response/headers_spec.rb +18 -0
  183. data/spec/response/options_spec.rb +18 -0
  184. data/spec/response/success_spec.rb +13 -0
  185. data/spec/response/time_spec.rb +21 -0
  186. data/spec/spec_helper.rb +8 -0
  187. data/spec/support/fixtures/json/feedback.json +11 -0
  188. data/spec/support/fixtures/json/feedbacks.json +164 -0
  189. data/spec/support/fixtures/json/localina_content_ad.json +23 -0
  190. data/spec/support/load_json.rb +5 -0
  191. data/spec/support/reset_config.rb +7 -0
  192. data/spec/support/zipkin_mock.rb +113 -0
  193. data/spec/timeouts/no_signal_spec.rb +13 -0
  194. data/spec/timeouts/timings_spec.rb +55 -0
  195. metadata +534 -0
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe LHC::Request do
6
+ before do
7
+ Object.send(:remove_const, :Rails)
8
+ LHC.send(:remove_const, :Request)
9
+ load('lhc/concerns/lhc/request/user_agent_concern.rb')
10
+ load('lhc/request.rb')
11
+ end
12
+
13
+ context 'default headers' do
14
+ context 'agent' do
15
+ it 'sets header agent information to be LHC' do
16
+ stub_request(:get, "http://local.ch/")
17
+ .with(
18
+ headers: {
19
+ 'User-Agent' => "LHC (#{LHC::VERSION}) [https://github.com/local-ch/lhc]"
20
+ }
21
+ )
22
+ .to_return(status: 200)
23
+ LHC.get('http://local.ch')
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rails_helper'
4
+
5
+ describe LHC::Response do
6
+ context 'body' do
7
+ let(:body) { 'this is a body' }
8
+
9
+ let(:raw_response) { OpenStruct.new(body: body) }
10
+
11
+ it 'provides response body' do
12
+ response = LHC::Response.new(raw_response, nil)
13
+ expect(response.body).to eq body
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rails_helper'
4
+
5
+ describe LHC::Response do
6
+ context 'code' do
7
+ let(:code) { 200 }
8
+
9
+ let(:raw_response) { OpenStruct.new(code: code) }
10
+
11
+ it 'provides response code' do
12
+ response = LHC::Response.new(raw_response, nil)
13
+ expect(response.code).to eq code
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rails_helper'
4
+
5
+ describe LHC do
6
+ context 'data accessor (hash with indifferent access)' do
7
+ before(:each) do
8
+ stub_request(:get, "http://local.ch/")
9
+ .with(headers: {
10
+ 'Accept' => 'application/json,application/vnd.api+json',
11
+ 'Content-Type' => 'application/json; charset=utf-8',
12
+ 'Accept-Charset' => 'utf-8'
13
+ })
14
+ .to_return(body: { 'MyProp' => 'MyValue' }.to_json)
15
+ end
16
+
17
+ it 'makes data accessible with square bracket accessor (string)' do
18
+ expect(
19
+ LHC.json.get('http://local.ch')['MyProp']
20
+ ).to eq 'MyValue'
21
+ end
22
+
23
+ it 'makes data accessible with square bracket accessor (symbol)' do
24
+ expect(
25
+ LHC.json.get('http://local.ch')[:MyProp]
26
+ ).to eq 'MyValue'
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,61 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rails_helper'
4
+
5
+ describe LHC::Response do
6
+ context 'data' do
7
+ let(:value) { 'some_value' }
8
+
9
+ let(:raw_response) { OpenStruct.new(body: body.to_json) }
10
+
11
+ let(:response) { LHC::Response.new(raw_response, nil) }
12
+
13
+ context 'for item' do
14
+ let(:body) { { some_key: { nested: value } } }
15
+
16
+ it 'makes data from response body available' do
17
+ expect(response.data.some_key.nested).to eq value
18
+ end
19
+
20
+ it 'makes data from response body available with hash bracket notation' do
21
+ expect(response.data[:some_key][:nested]).to eq value
22
+ end
23
+
24
+ it 'can be converted to json with the as_json method' do
25
+ expect(response.data.as_json).to eq body.as_json
26
+ end
27
+
28
+ it 'can be converted to an open struct with the as_open_struct method' do
29
+ expect(response.data.as_open_struct).to eq JSON.parse(response.body, object_class: OpenStruct)
30
+ end
31
+
32
+ it 'returns nil when data is not available' do
33
+ expect(response.data.something).to be_nil
34
+ end
35
+ end
36
+
37
+ context 'for collection' do
38
+ let(:body) { [{ some_key: { nested: value } }] }
39
+
40
+ it 'can be converted to json with the as_json method' do
41
+ expect(response.data.as_json).to eq body.as_json
42
+ end
43
+
44
+ it 'can be converted to an open struct with the as_open_struct method' do
45
+ expect(response.data.as_open_struct).to eq JSON.parse(response.body, object_class: OpenStruct)
46
+ end
47
+
48
+ it 'is a collection of items' do
49
+ expect(response.data.size).to eq(1)
50
+ end
51
+
52
+ it 'makes item data from response body available' do
53
+ expect(response.data.first.some_key.nested).to eq value
54
+ end
55
+
56
+ it 'makes item data from response body available with hash bracket notation' do
57
+ expect(response.data.first[:some_key][:nested]).to eq value
58
+ end
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rails_helper'
4
+
5
+ describe LHC::Response do
6
+ context 'effective_url' do
7
+ let(:effective_url) { 'https://www.local.ch' }
8
+
9
+ let(:raw_response) { OpenStruct.new(effective_url: effective_url) }
10
+
11
+ it 'provides effective_url' do
12
+ response = LHC::Response.new(raw_response, nil)
13
+ expect(response.effective_url).to eq effective_url
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rails_helper'
4
+
5
+ describe LHC::Response do
6
+ context 'headers' do
7
+ let(:headers) do
8
+ { 'Content-Encoding' => 'UTF-8' }
9
+ end
10
+
11
+ let(:raw_response) { OpenStruct.new(headers: headers) }
12
+
13
+ it 'provides headers' do
14
+ response = LHC::Response.new(raw_response, nil)
15
+ expect(response.headers).to eq headers
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rails_helper'
4
+
5
+ describe LHC::Response do
6
+ context 'headers' do
7
+ let(:options) do
8
+ { 'return_code' => :ok }
9
+ end
10
+
11
+ let(:raw_response) { OpenStruct.new(options: options) }
12
+
13
+ it 'provides headers' do
14
+ response = LHC::Response.new(raw_response, nil)
15
+ expect(response.options).to eq options
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rails_helper'
4
+
5
+ describe LHC::Response do
6
+ context 'success?' do
7
+ let(:response_success) { LHC::Response.new(Typhoeus::Response.new(response_code: 200, mock: true), nil) }
8
+ let(:response_error) { LHC::Response.new(Typhoeus::Response.new(response_code: 404, mock: true), nil) }
9
+
10
+ it { expect(response_success).to be_success }
11
+ it { expect(response_error).not_to be_success }
12
+ end
13
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rails_helper'
4
+
5
+ describe LHC::Response do
6
+ context 'time' do
7
+ let(:time) { 1.3 }
8
+
9
+ let(:raw_response) { OpenStruct.new(time: time) }
10
+
11
+ it 'provides response time in seconds' do
12
+ response = LHC::Response.new(raw_response, nil)
13
+ expect(response.time).to eq time
14
+ end
15
+
16
+ it 'provides response time in miliseconds' do
17
+ response = LHC::Response.new(raw_response, nil)
18
+ expect(response.time_ms).to eq time * 1000
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'pry'
4
+ require 'webmock/rspec'
5
+ require 'lhc'
6
+ require 'timecop'
7
+
8
+ Dir[File.join(__dir__, "support/**/*.rb")].each { |f| require f }
@@ -0,0 +1,11 @@
1
+ {
2
+ "href": "http://local.ch/v2/feedbacks/-Sc4_pYNpqfsudzhtivfkA",
3
+ "campaign": {
4
+ "href": "http://local.ch/v2/content-ads/51dfc5690cf271c375c5a12d"
5
+ },
6
+ "source_id": "aaa",
7
+ "recommended": true,
8
+ "modified": "2014-09-19T14:03:35.599+02:00",
9
+ "created_date": "2014-09-19T14:03:35.597+02:00",
10
+ "comments": []
11
+ }
@@ -0,0 +1,164 @@
1
+ {
2
+ "href" : "http://local.ch/v2/feedbacks/?exclude_hidden=false&offset=0&limit=10",
3
+ "items" : [ {
4
+ "href" : "http://local.ch/v2/feedbacks/0sdaetZ-OWVg4oBiBJ-7IQ",
5
+ "campaign" : {
6
+ "href" : "http://local.ch/v2/content-ads/51dfc5690cf271c375c5a12d"
7
+ },
8
+ "source_id" : "aaa",
9
+ "recommended" : true,
10
+ "ratings" : {
11
+ "ambiente" : 4,
12
+ "service" : 2,
13
+ "food" : 3
14
+ },
15
+ "modified" : "2014-09-18T16:13:32.987+02:00",
16
+ "created_date" : "2014-09-18T16:13:31.496+02:00",
17
+ "average_rating" : 3.0,
18
+ "comments" : [ ]
19
+ }, {
20
+ "href" : "http://local.ch/v2/feedbacks/QsUOQWNJoB-GFUNsX7z0jg",
21
+ "campaign" : {
22
+ "href" : "http://local.ch/v2/content-ads/51dfc5690cf271c375c5a11f"
23
+ },
24
+ "source_id" : "abcdefghs12345",
25
+ "name" : "Steve",
26
+ "recommended" : true,
27
+ "ratings" : {
28
+ "ambiente" : 3,
29
+ "service" : 5,
30
+ "food" : 2
31
+ },
32
+ "modified" : "2014-09-18T15:43:12.134+02:00",
33
+ "created_date" : "2014-09-18T15:42:57.892+02:00",
34
+ "review_title" : "GUMMYBEARS GUMMYBEARS GUMMYBEARS",
35
+ "review" : "GUMMYBEARS! ... WOAH, STEVE! No, we both know how you get when you eat gummybears!",
36
+ "average_rating" : 3.3333333333333335,
37
+ "comments" : [ ]
38
+ }, {
39
+ "href" : "http://local.ch/v2/feedbacks/QynNtmpXlsEGvUJ0ekDKVw",
40
+ "campaign" : {
41
+ "href" : "http://local.ch/v2/content-ads/51dfc56b0cf271c375c5a14d"
42
+ },
43
+ "source_id" : "abcdefghs12345",
44
+ "name" : "Steve",
45
+ "recommended" : true,
46
+ "ratings" : {
47
+ "ambiente" : 3,
48
+ "service" : 5,
49
+ "food" : 2
50
+ },
51
+ "modified" : "2014-09-17T11:17:39.660+02:00",
52
+ "created_date" : "2014-09-17T11:17:34.234+02:00",
53
+ "review_title" : "GUMMYBEARS GUMMYBEARS GUMMYBEARS",
54
+ "review" : "GUMMYBEARS! ... WOAH, STEVE! No, we both know how you get when you eat gummybears!",
55
+ "average_rating" : 3.3333333333333335,
56
+ "comments" : [ ]
57
+ }, {
58
+ "href" : "http://local.ch/v2/feedbacks/INmminYWNZwW_qNFx5peJQ",
59
+ "campaign" : {
60
+ "href" : "http://local.ch/v2/content-ads/51dfc56b0cf271c375c5a153"
61
+ },
62
+ "source_id" : "abcdefghs12345",
63
+ "name" : "Steve",
64
+ "recommended" : true,
65
+ "ratings" : {
66
+ "ambiente" : 3,
67
+ "service" : 5,
68
+ "food" : 2
69
+ },
70
+ "modified" : "2014-09-16T11:20:32.600+02:00",
71
+ "created_date" : "2014-09-16T11:20:30.194+02:00",
72
+ "review_title" : "GUMMYBEARS GUMMYBEARS GUMMYBEARS",
73
+ "review" : "GUMMYBEARS! ... WOAH, STEVE! No, we both know how you get when you eat gummybears!",
74
+ "average_rating" : 3.3333333333333335,
75
+ "comments" : [ ]
76
+ }, {
77
+ "href" : "http://local.ch/v2/feedbacks/ltgfr0VRYDN2nxyC119wTg",
78
+ "campaign" : {
79
+ "href" : "http://local.ch/v2/content-ads/51dfc56b0cf271c375c5a14c"
80
+ },
81
+ "source_id" : "aaa",
82
+ "recommended" : false,
83
+ "ratings" : {
84
+ "ambiente" : 2,
85
+ "service" : 1,
86
+ "food" : 1
87
+ },
88
+ "modified" : "2014-09-15T16:23:54.898+02:00",
89
+ "created_date" : "2014-09-15T16:23:40.355+02:00",
90
+ "average_rating" : 1.3333333333333333,
91
+ "comments" : [ ]
92
+ }, {
93
+ "href" : "http://local.ch/v2/feedbacks/5dUdQP-kZ6sulN8NtpGXTw",
94
+ "campaign" : {
95
+ "href" : "http://local.ch/v2/content-ads/51dfc56b0cf271c375c5a14c"
96
+ },
97
+ "source_id" : "abcdefghs12345",
98
+ "name" : "Steve",
99
+ "recommended" : true,
100
+ "ratings" : {
101
+ "ambiente" : 3,
102
+ "service" : 5,
103
+ "food" : 2
104
+ },
105
+ "modified" : "2014-09-12T13:10:51.220+02:00",
106
+ "created_date" : "2014-09-12T13:10:48.813+02:00",
107
+ "review_title" : "GUMMYBEARS GUMMYBEARS GUMMYBEARS",
108
+ "review" : "GUMMYBEARS! ... WOAH, STEVE! No, we both know how you get when you eat gummybears!",
109
+ "average_rating" : 3.3333333333333335,
110
+ "comments" : [ ]
111
+ }, {
112
+ "href" : "http://local.ch/v2/feedbacks/Z3KfWzIEQ3ZVCUj2IdrSNQ",
113
+ "campaign" : {
114
+ "href" : "http://local.ch/v2/content-ads/51dfc5690cf271c375c5a12e"
115
+ },
116
+ "source_id" : "abcdefghs",
117
+ "recommended" : true,
118
+ "modified" : "2014-09-10T16:57:36.255+02:00",
119
+ "created_date" : "2014-09-10T16:57:36.254+02:00",
120
+ "comments" : [ ]
121
+ }, {
122
+ "href" : "http://local.ch/v2/feedbacks/ZUUUeiw-Stw5Zb1baHDUzQ",
123
+ "campaign" : {
124
+ "href" : "http://local.ch/v2/content-ads/51dfc5690cf271c375c5a12d"
125
+ },
126
+ "source_id" : "abcdefghs",
127
+ "recommended" : true,
128
+ "modified" : "2014-09-10T16:57:32.792+02:00",
129
+ "created_date" : "2014-09-10T16:57:32.791+02:00",
130
+ "comments" : [ ]
131
+ }, {
132
+ "href" : "http://local.ch/v2/feedbacks/GyeWvhEtU4cYN_5T2FX2UA",
133
+ "campaign" : {
134
+ "href" : "http://local.ch/v2/content-ads/539266ec0cf2cd754583cfa0"
135
+ },
136
+ "source_id" : "abcdefghs",
137
+ "name" : "aa",
138
+ "recommended" : true,
139
+ "ratings" : {
140
+ "ambiente" : 2,
141
+ "service" : 4,
142
+ "food" : 3
143
+ },
144
+ "modified" : "2014-09-11T09:48:19.096+02:00",
145
+ "created_date" : "2014-09-10T16:35:39.201+02:00",
146
+ "review_title" : "bbb",
147
+ "review" : "fff",
148
+ "average_rating" : 3.0,
149
+ "comments" : [ ]
150
+ }, {
151
+ "href" : "http://local.ch/v2/feedbacks/o-qTRqQGFS3Z_RPJm1f8SA",
152
+ "campaign" : {
153
+ "href" : "http://local.ch/v2/content-ads/51dfc56c0cf271c375c5a160"
154
+ },
155
+ "source_id" : "abcdefghs12345",
156
+ "recommended" : true,
157
+ "modified" : "2014-09-10T16:31:52.493+02:00",
158
+ "created_date" : "2014-09-10T16:31:52.492+02:00",
159
+ "comments" : [ ]
160
+ } ],
161
+ "total" : 98,
162
+ "offset" : 0,
163
+ "limit" : 10
164
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "href": "http://local.ch/v2/content-ads/51dfc5690cf271c375c5a12d",
3
+ "id": "51dfc5690cf271c375c5a12d",
4
+ "product": "BKE",
5
+ "hidden": false,
6
+ "contract_type": "published",
7
+ "source_id": "123",
8
+ "phone_number": "0041562227764",
9
+ "type": "LOCALINA",
10
+ "feedbacks": {
11
+ "href": "http://local.ch/v2/content-ads/51dfc5690cf271c375c5a12d/feedbacks?exclude_hidden=false&offset=0&limit=10"
12
+ },
13
+ "aggregated_feedback": {
14
+ "recommendation": 1,
15
+ "number_of_feedbacks": 2,
16
+ "number_of_reviews": 0,
17
+ "number_of_ratings": 0
18
+ },
19
+ "online_booking": {
20
+ "max_persons_plus_sign": true,
21
+ "max_persons_per_reservation": 8
22
+ }
23
+ }