parliament-ruby 1.0.0.pre5 → 1.0.0.pre6

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: 296c0c0aa835ccd1ccd468d6a69e175302cee33e
4
- data.tar.gz: 44a5e4602ce21c06829758aecbef61fc0d9692bf
3
+ metadata.gz: c20c1e1ecef5fa146b6209e261b51db12a088d84
4
+ data.tar.gz: 4d78672a08dfb72ccba0302752b90d15ade294a1
5
5
  SHA512:
6
- metadata.gz: ea81f80fd2066531f4cbc9075330483638608c04384102a4739f086a79b8df1aa6e0e7ac72c0593b969c7bf9c9e7404dc494af9aa3b8e5e6248461a16deaeb5a
7
- data.tar.gz: a333b7fa798c5c9d164db4f3f268ddb40e092c23cbe4f69d2e12fd53d8ebad2d88064db9740cc53ff049bb8de3366be7d6d5280c984641f177a58452d3f8b389
6
+ metadata.gz: 5152616ce03a1bf39b73202423b7c36f0ac1360dbc1960895c95c4a7a9000bc6ce4b93354b4fe31d387215344d25bd8e18d8943abaf1e01a3f8ec9b1a5aa070d
7
+ data.tar.gz: b61512c2871d901c32679e6d9f5ff74c1ef61e75bdb3037bbe88830532d4c94aa6623c1df9dee10a6a9c2840983ab8d68cb9ca7c80eeedf0e5452ce12cb283d4
@@ -9,6 +9,9 @@ module Parliament
9
9
  # @attr_reader [String] base_url the base url of our api. (expected: http://example.com - without the trailing slash).
10
10
  # @attr_reader [Hash] headers the headers being sent in the request.
11
11
  class BaseRequest
12
+ TIMEOUT = 40.freeze
13
+ CONNECTTIMEOUT = 5.freeze
14
+
12
15
  attr_reader :base_url, :headers, :query_params
13
16
  # Creates a new instance of Parliament::Request::BaseRequest.
14
17
  #
@@ -87,7 +90,7 @@ module Parliament
87
90
  # @param [Hash] params (optional) additional URI encoded form values to be added to the URI.
88
91
  #
89
92
  # @return [Parliament::Response::BaseResponse] a Parliament::Response::BaseResponse object containing all of the data returned from the URL.
90
- def get(params: nil)
93
+ def get(params: nil, timeout: TIMEOUT, connecttimeout: CONNECTTIMEOUT)
91
94
  Typhoeus::Config.user_agent = 'Ruby'
92
95
 
93
96
  uri_hash = separate_uri(query_url, @query_params, params)
@@ -97,6 +100,8 @@ module Parliament
97
100
  method: :get,
98
101
  params: uri_hash[:params],
99
102
  headers: headers,
103
+ timeout: timeout,
104
+ connecttimeout: connecttimeout,
100
105
  accept_encoding: 'gzip'
101
106
  )
102
107
 
@@ -132,7 +137,7 @@ module Parliament
132
137
  # @param [Integer] timeout (optional) a Net::HTTP.read_timeout value passed suring the post.
133
138
  #
134
139
  # @return [Parliament::Response::BaseResponse] a Parliament::Response::BaseResponse object containing all of the data returned from the URL.
135
- def post(params: nil, body: nil, timeout: 60)
140
+ def post(params: nil, body: nil, timeout: TIMEOUT, connecttimeout: CONNECTTIMEOUT)
136
141
  Typhoeus::Config.user_agent = 'Ruby'
137
142
 
138
143
  uri_hash = separate_uri(query_url, @query_params, params)
@@ -144,6 +149,7 @@ module Parliament
144
149
  headers: headers.merge({ 'Content-Type' => 'application/json' }),
145
150
  accept_encoding: 'gzip',
146
151
  timeout: timeout,
152
+ connecttimeout: connecttimeout,
147
153
  body: body
148
154
  )
149
155
 
@@ -1,3 +1,3 @@
1
1
  module Parliament
2
- VERSION = '1.0.0.pre5'.freeze
2
+ VERSION = '1.0.0.pre6'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parliament-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.pre5
4
+ version: 1.0.0.pre6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Rayner