opencomponents 0.2.0 → 0.3.0

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: bad9832ecad1d26ca9511e032e4c85d948f17f18
4
- data.tar.gz: cc277e8e5182192778dec331c80050d3d8dd4c5d
3
+ metadata.gz: 49bcd287db933a16b2e5fde5d71968a7d57daab3
4
+ data.tar.gz: 658e8983ff495b5de3d63c1fe321e5f25f71d53d
5
5
  SHA512:
6
- metadata.gz: f33a1d25e888b0d4ad0a2e158f2b6eebfb93bb2959d3c2965dd8577e1663766dc758fb202d6ba9884f9ec2fe4187bc773a1e6db9e9ae10f62763684150947f37
7
- data.tar.gz: 55f5b8e3d0c2aa0c932951a7ee06539c2d60ca55cba65f0d9d9f9021a8446824c919068e911ca4e3ce941b15a08427e52c0105b96caba31b2734d9f9f97a5699
6
+ metadata.gz: 9f8b148199b29ece56ac71c906645294b2fb9ff1bd89621f2d108522d032f6e6cdab79edd5d64d29ac471bbdba615917a1d6ad6f0020c1d3be64fa1fed827a95
7
+ data.tar.gz: 5b100c9b7ada42b05dde7c278da5986fe9ba265fb7d30bc62781c3602e49ee7f614b7895af4a092a9aae3f09dc367654248f7956ca794f0743f0cfff8c070119
data/README.md CHANGED
@@ -22,7 +22,7 @@ time.
22
22
  ## Getting Started
23
23
  Add the gem to your Gemfile and run `bundle install`:
24
24
  ```ruby
25
- gem 'opencomponents', '~> 0.1.0'
25
+ gem 'opencomponents', '~> 0.3.0'
26
26
  ```
27
27
 
28
28
  By default, the gem will attempt to use a component registry located at
@@ -1,3 +1,5 @@
1
+ require 'rest-client'
2
+
1
3
  require 'opencomponents/component'
2
4
  require 'opencomponents/prerendered_component'
3
5
  require 'opencomponents/rendered_component'
@@ -12,6 +14,9 @@ module OpenComponents
12
14
  # found in the registry.
13
15
  ComponentNotFound = Class.new(RuntimeError)
14
16
 
17
+ # Internal: Custom exception class to raise for response timeouts.
18
+ RegistryTimeout = Class.new(RestClient::RequestTimeout)
19
+
15
20
  # Internal: Stores configuration data.
16
21
  #
17
22
  # registry - String for the registry host.
@@ -1,5 +1,3 @@
1
- require 'rest-client'
2
-
3
1
  module OpenComponents
4
2
  # Wrapper object for a component fetched from an OC registry.
5
3
  class Component
@@ -113,6 +111,7 @@ module OpenComponents
113
111
  # Returns a response body String.
114
112
  # Raises OpenComponents::ComponentNotFound if the registry responds with a
115
113
  # 404.
114
+ # Raises OpenComponents::RegistryTimeout if the request times out.
116
115
  def response
117
116
  request_headers = headers.merge(params: params)
118
117
 
@@ -124,6 +123,8 @@ module OpenComponents
124
123
  )
125
124
  rescue RestClient::ResourceNotFound => e
126
125
  fail ComponentNotFound, e.message
126
+ rescue RestClient::RequestTimeout => e
127
+ fail RegistryTimeout, e.message
127
128
  end
128
129
 
129
130
  # Internal: Helper method for converting and memoizing registry response
@@ -1,3 +1,3 @@
1
1
  module OpenComponents
2
- VERSION = '0.2.0' # :nodoc:
2
+ VERSION = '0.3.0' # :nodoc:
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opencomponents
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Todd Bealmear
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-07 00:00:00.000000000 Z
11
+ date: 2015-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client