opencomponents 0.3.0 → 0.4.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: 49bcd287db933a16b2e5fde5d71968a7d57daab3
4
- data.tar.gz: 658e8983ff495b5de3d63c1fe321e5f25f71d53d
3
+ metadata.gz: 190e833112bbefb92019537387febb391512e0e2
4
+ data.tar.gz: 93599ce0ec1ca889785a595641101e65554b5640
5
5
  SHA512:
6
- metadata.gz: 9f8b148199b29ece56ac71c906645294b2fb9ff1bd89621f2d108522d032f6e6cdab79edd5d64d29ac471bbdba615917a1d6ad6f0020c1d3be64fa1fed827a95
7
- data.tar.gz: 5b100c9b7ada42b05dde7c278da5986fe9ba265fb7d30bc62781c3602e49ee7f614b7895af4a092a9aae3f09dc367654248f7956ca794f0743f0cfff8c070119
6
+ metadata.gz: 817ce244a59fb0281ff254e66410f26f66b5b7cbcbb723e7416de17322273fbd57c3251d768ecfc6c3d701659919c7a4eb28d71e78828e0d2273e6f0a44f7660
7
+ data.tar.gz: 879765cee795349764cf1537229278377aa022b287aa3349b897684b41bcd7fb2bd831d5df23c544577d005f57322d9c6330158a34584cc5d29bab10be8232c0
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.3.0'
25
+ gem 'opencomponents', '~> 0.4.0'
26
26
  ```
27
27
 
28
28
  By default, the gem will attempt to use a component registry located at
@@ -10,17 +10,20 @@ module OpenComponents
10
10
  # Public: Default OC registry URL (http://localhost:3030).
11
11
  DEFAULT_REGISTRY = 'http://localhost:3030'
12
12
 
13
+ # Public: Default request timeout in seconds (5)
14
+ DEFAULT_TIMEOUT = 5
15
+
13
16
  # Internal: Custom exception class to raise in the event a component cannot be
14
17
  # found in the registry.
15
18
  ComponentNotFound = Class.new(RuntimeError)
16
19
 
17
20
  # Internal: Custom exception class to raise for response timeouts.
18
- RegistryTimeout = Class.new(RestClient::RequestTimeout)
21
+ RegistryTimeout = Class.new(RuntimeError)
19
22
 
20
23
  # Internal: Stores configuration data.
21
24
  #
22
25
  # registry - String for the registry host.
23
- Configuration = Struct.new(:registry)
26
+ Configuration = Struct.new(:registry, :timeout)
24
27
 
25
28
  # Internal: Wrapper object for pre-rendered OC templates.
26
29
  #
@@ -33,7 +36,7 @@ module OpenComponents
33
36
  #
34
37
  # Returns the Configuration if set, a default Configuration if not set.
35
38
  def self.config
36
- @@_config ||= Configuration.new(DEFAULT_REGISTRY)
39
+ @@_config ||= Configuration.new(DEFAULT_REGISTRY, DEFAULT_TIMEOUT)
37
40
  end
38
41
 
39
42
  # Public: Setter for Configuration.
@@ -118,7 +118,7 @@ module OpenComponents
118
118
  RestClient::Request.execute(
119
119
  method: :get,
120
120
  url: url,
121
- timeout: 10,
121
+ timeout: OpenComponents.config.timeout,
122
122
  headers: request_headers
123
123
  )
124
124
  rescue RestClient::ResourceNotFound => e
@@ -1,3 +1,3 @@
1
1
  module OpenComponents
2
- VERSION = '0.3.0' # :nodoc:
2
+ VERSION = '0.4.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.3.0
4
+ version: 0.4.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-08 00:00:00.000000000 Z
11
+ date: 2015-07-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client