tickethub 0.3.49 → 0.3.50
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 +4 -4
- data/lib/tickethub/connection.rb +1 -7
- data/lib/tickethub/request.rb +7 -12
- data/lib/tickethub/reseller/channel.rb +0 -3
- data/lib/tickethub/supplier/channel.rb +0 -3
- data/lib/tickethub/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 57ddcb360af1a24030fa0782912f8d18fba392d8
|
4
|
+
data.tar.gz: 804a1795f1f619a920cdb698aaf96c21bd939e05
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c8330974730cc0820c9215f0a1528d8bc7ca6aed534d47f48077de8947e306a93e194ccc0797155386909dc9fce0a677e808b646ad48138e4c5355c2024a65d
|
7
|
+
data.tar.gz: e534933f6942e2c48b5619882d192bc62d89f641f17486de0f2b1c93cd5426d458f62df964f489308ff29c7d3bdf0959c5330835624b1b7b925543c286722b2f
|
data/lib/tickethub/connection.rb
CHANGED
@@ -113,13 +113,7 @@ module Tickethub
|
|
113
113
|
|
114
114
|
def configure_http(http)
|
115
115
|
http = apply_ssl_options(http)
|
116
|
-
|
117
|
-
# Net::HTTP timeouts default to 60 seconds.
|
118
|
-
if timeout
|
119
|
-
http.open_timeout = timeout
|
120
|
-
http.read_timeout = timeout
|
121
|
-
end
|
122
|
-
|
116
|
+
http.read_timeout = timeout if timeout
|
123
117
|
http
|
124
118
|
end
|
125
119
|
|
data/lib/tickethub/request.rb
CHANGED
@@ -3,18 +3,17 @@ require 'securerandom'
|
|
3
3
|
module Tickethub
|
4
4
|
class Request
|
5
5
|
|
6
|
-
SAFE_TO_RETRY = [408, 502, 503, 504].freeze
|
7
|
-
MAXIMUM_RETRIES = 3.freeze
|
8
|
-
|
9
6
|
attr_reader :options, :format, :url
|
10
7
|
attr_accessor :params, :body, :method, :headers
|
11
8
|
|
12
9
|
# Connection options
|
13
|
-
attr_accessor :proxy, :user, :password, :auth_type, :timeout, :ssl_options
|
10
|
+
attr_accessor :proxy, :user, :password, :auth_type, :timeout, :retries, :ssl_options
|
14
11
|
|
15
12
|
def initialize(url, options = {})
|
16
13
|
@url = url.to_s
|
17
14
|
@id = SecureRandom.uuid
|
15
|
+
@retries = 3
|
16
|
+
@timeout = 10
|
18
17
|
|
19
18
|
@options = options
|
20
19
|
@options.each do |key, val|
|
@@ -59,7 +58,7 @@ module Tickethub
|
|
59
58
|
uri.path
|
60
59
|
end
|
61
60
|
|
62
|
-
def execute
|
61
|
+
def execute
|
63
62
|
if encoded?
|
64
63
|
result = connection.send(method, path, encoded, build_headers)
|
65
64
|
else
|
@@ -68,15 +67,11 @@ module Tickethub
|
|
68
67
|
|
69
68
|
Response.new(result)
|
70
69
|
|
71
|
-
rescue TimeoutError => err
|
72
|
-
raise if retries
|
73
|
-
execute
|
74
|
-
rescue ConnectionError => err
|
75
|
-
raise if ! SAFE_TO_RETRY.member?(err.response.code) || retries == MAXIMUM_RETRIES - 1
|
76
|
-
execute retries + 1
|
70
|
+
rescue TimeoutError, ServerError => err
|
71
|
+
raise err if (@retries -= 1) == 0
|
72
|
+
execute
|
77
73
|
rescue Redirection => error
|
78
74
|
raise error unless error.response['Location']
|
79
|
-
|
80
75
|
location = URI.parse(error.response['Location'])
|
81
76
|
|
82
77
|
# Path is relative
|
@@ -7,9 +7,6 @@ module Tickethub
|
|
7
7
|
require_relative 'product'
|
8
8
|
require_relative '../token'
|
9
9
|
|
10
|
-
association :private_token, Tickethub::Token
|
11
|
-
association :public_token, Tickethub::Token
|
12
|
-
|
13
10
|
association :product, Reseller::Product
|
14
11
|
|
15
12
|
attribute :updated_at, type: :datetime
|
@@ -8,9 +8,6 @@ module Tickethub
|
|
8
8
|
require_relative 'product'
|
9
9
|
require_relative '../token'
|
10
10
|
|
11
|
-
association :private_token, Tickethub::Token
|
12
|
-
association :public_token, Tickethub::Token
|
13
|
-
|
14
11
|
association :product, Supplier::Product
|
15
12
|
association :partner, Supplier::Partner
|
16
13
|
|
data/lib/tickethub/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tickethub
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.50
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oliver Morgan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|