served 0.1.9 → 0.1.10

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0f60cc4816f9f700e5482733b0be0c1bc9ff2a60
4
- data.tar.gz: d297cddb3b2d302f3cb95ccdc7a1198301e7d4f8
3
+ metadata.gz: 441c7ca5f9f68f1df1cae462d85d60a50b50cdc8
4
+ data.tar.gz: 74b53138ad506df5fb5ad69f95f8218d7aeb1202
5
5
  SHA512:
6
- metadata.gz: 7bfdae6756227d4ee49828765ac51f5a9ea54bdedc9e6ccdac4bc540164fbbc371f099f361fecf76842ba700986e9aff4c5f3cc45c9be251f3db38db979cdcd4
7
- data.tar.gz: 2062eaf3b848fb0ad2bf96427b13bfbf135af5a85c3018cdf77d9b25be5ad56a35f768781de733985aee21ce251924a3bdbcb12f3f84924d9caa7889a733003a
6
+ metadata.gz: 666239cf535c226548af6e029f5c2883da475c4131291167b7ee9482953ef197362fe36489a9f62dd34b17918b42a0f91a1c6bf08434687f845a4e3746d3ce7a
7
+ data.tar.gz: 472b45163683b788ddd9b023a18cd04daf8fe9897d2d31e41c972000d2fd3b1e1e955bd6ed2914f22d8208a0cfc68db309724e2f7178f59da05e7c6af19d5eb4
@@ -5,15 +5,16 @@ module Served
5
5
  HEADERS = { 'Content-type' => 'application/json', 'Accept' => 'application/json' }
6
6
  DEFAULT_TEMPLATE = '{/resource*}{/id}.json{?query*}'
7
7
 
8
- def initialize(host)
8
+ def initialize(host, timeout)
9
9
  host += DEFAULT_TEMPLATE unless host =~ /{.+}/
10
10
  @template = Addressable::Template.new(host)
11
+ @timeout = timeout
11
12
  end
12
13
 
13
14
  def get(endpoint, id, params={})
14
15
  HTTParty.get(@template.expand(id: id, query: params, resource: endpoint).to_s,
15
16
  headers: HEADERS,
16
- timeout: Served.config.timeout
17
+ timeout: @timeout
17
18
  )
18
19
  end
19
20
 
@@ -21,7 +22,7 @@ module Served
21
22
  HTTParty.put(@template.expand(id: id, query: params, resource: endpoint).to_s,
22
23
  body: body,
23
24
  headers: HEADERS,
24
- timeout: Served.config.timeout
25
+ timeout: @timeout
25
26
  )
26
27
  end
27
28
 
@@ -29,7 +30,7 @@ module Served
29
30
  HTTParty.post(@template.expand(query: params, resource: endpoint).to_s,
30
31
  body: body,
31
32
  headers: HEADERS,
32
- timeout: Served.config.timeout
33
+ timeout: @timeout
33
34
  )
34
35
  end
35
36
  end
@@ -53,10 +53,15 @@ module Served
53
53
  Served.config[:hosts][parent.name.underscore.split('/')[-1]]
54
54
  end
55
55
 
56
+ # @return [Integer] allowed timeout in seconds
57
+ def timeout
58
+ Served.config.timeout
59
+ end
60
+
56
61
  # @return [Served::HTTPClient] The connection instance to the service host. Note this is not an active
57
62
  # connection but a passive one.
58
63
  def client
59
- @connection ||= Served::HTTPClient.new(host_config)
64
+ @connection ||= Served::HTTPClient.new(host_config, timeout)
60
65
  end
61
66
 
62
67
  private
@@ -1,3 +1,3 @@
1
1
  module Served
2
- VERSION = '0.1.9'
2
+ VERSION = '0.1.10'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: served
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jarod Reid
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-03-23 00:00:00.000000000 Z
11
+ date: 2016-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -140,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
140
140
  version: '0'
141
141
  requirements: []
142
142
  rubyforge_project:
143
- rubygems_version: 2.4.7
143
+ rubygems_version: 2.4.8
144
144
  signing_key:
145
145
  specification_version: 4
146
146
  summary: Served provides an easy to use model layer for communicating with disributed