renuo-cms-rails 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3fda16518538093c40b2c44a78900bff6163220d
4
- data.tar.gz: b309d93121355109393d8864cebfc9090410eaf6
3
+ metadata.gz: 649de88572b0326d72a66b2515c2c92f4919b79d
4
+ data.tar.gz: 5bbdd15df8a0bb4c04ae2072f1a049bdd0347a0d
5
5
  SHA512:
6
- metadata.gz: a5f49188f3f8718b14255b86a8d3d76c1984a21f2af014ec7e6d756604ac67399a1312660933005c38385943f1243220631262783084506b17f7e33d70698530
7
- data.tar.gz: a0bc61c75aa044511b5d8eada8e1c6828a4002cdf5c31cfdbf180e2d0c5ffeede9d3aa076fc5a8271cb9fc5d4dcd7bca3a780f9c3f39e8b3543bff77de940836
6
+ metadata.gz: 52b81b18e9e08eb931bc64710377fa1b1d2fc57998a917e44278587bf4056cb5c11d4a3e825fdf7b2c5c59b345a4ad98a816281c0fcd6b5568642862c3305fe9
7
+ data.tar.gz: 8fb1e314377242087cfaaa4e5c8a8454985646e9f86a9c82f0d267fca8a4bdf7aa905b35d5591640644950ea4510c231147cf90367cb231a3157e98562b0bdd6
@@ -1,3 +1,7 @@
1
+ ## Version 0.2.1
2
+
3
+ * rescue if there is an error making the http request
4
+
1
5
  ## Version 0.2.0
2
6
 
3
7
  * implement server side caching of cms contents
@@ -27,6 +27,8 @@ module RenuoCmsRails
27
27
  request = Net::HTTP::Get.new uri
28
28
  handle_response(http.request(request))
29
29
  end
30
+ rescue StandardError
31
+ {}
30
32
  end
31
33
 
32
34
  private
@@ -1,3 +1,3 @@
1
1
  module RenuoCmsRails
2
- VERSION = '0.2.0'.freeze
2
+ VERSION = '0.2.1'.freeze
3
3
  end
@@ -71,7 +71,7 @@ describe RenuoCmsRails::API::Contents do
71
71
 
72
72
  it 'returns an empty hash if the JSON is invalid' do
73
73
  config = RenuoCmsRails::Config.new
74
- config.api_host = 'http://example.com'
74
+ config.api_host = 'example.com'
75
75
  config.api_key = 'somekey'
76
76
  config.private_api_key = 'pk'
77
77
  contents_api = RenuoCmsRails::API::Contents.new(config)
@@ -80,7 +80,7 @@ describe RenuoCmsRails::API::Contents do
80
80
 
81
81
  it 'returns an empty hash if the JSON is not complete' do
82
82
  config = RenuoCmsRails::Config.new
83
- config.api_host = 'http://example.com'
83
+ config.api_host = 'example.com'
84
84
  config.api_key = 'somekey'
85
85
  config.private_api_key = 'pk'
86
86
  contents_api = RenuoCmsRails::API::Contents.new(config)
@@ -89,7 +89,7 @@ describe RenuoCmsRails::API::Contents do
89
89
 
90
90
  it 'returns an empty hash if the API request was not successful' do
91
91
  config = RenuoCmsRails::Config.new
92
- config.api_host = 'http://example.com'
92
+ config.api_host = 'example.com'
93
93
  config.api_key = 'somekey'
94
94
  config.private_api_key = 'pk'
95
95
  contents_api = RenuoCmsRails::API::Contents.new(config)
@@ -101,6 +101,40 @@ describe RenuoCmsRails::API::Contents do
101
101
  expect(contents_api.fetch).to eq({})
102
102
  end
103
103
  end
104
+
105
+ it 'returns an empty hash if the API request connection was not successful' do
106
+ config = RenuoCmsRails::Config.new
107
+ config.api_host = 'local-not-existing.renuo:3044'
108
+ config.api_key = 'somekey'
109
+ config.private_api_key = 'pk'
110
+ contents_api = RenuoCmsRails::API::Contents.new(config)
111
+
112
+ Timecop.freeze(Time.at(123).utc) do
113
+ begin
114
+ WebMock.allow_net_connect!
115
+ expect(contents_api.fetch).to eq({})
116
+ ensure
117
+ WebMock.disable_net_connect!
118
+ end
119
+ end
120
+ end
121
+
122
+ it 'returns an empty hash if the API the api host is invalid' do
123
+ config = RenuoCmsRails::Config.new
124
+ config.api_host = 'local-not-existing.renuo'
125
+ config.api_key = '<somekey>'
126
+ config.private_api_key = 'pk'
127
+ contents_api = RenuoCmsRails::API::Contents.new(config)
128
+
129
+ Timecop.freeze(Time.at(123).utc) do
130
+ begin
131
+ WebMock.allow_net_connect!
132
+ expect(contents_api.fetch).to eq({})
133
+ ensure
134
+ WebMock.disable_net_connect!
135
+ end
136
+ end
137
+ end
104
138
  end
105
139
  end
106
140
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: renuo-cms-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lukas Elmer
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-05-26 00:00:00.000000000 Z
11
+ date: 2016-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties