omnievent-api 0.1.0.pre1 → 0.1.0.pre2
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/CHANGELOG.md +6 -0
- data/Gemfile.lock +2 -2
- data/README.md +2 -2
- data/lib/omnievent/api/version.rb +1 -1
- data/lib/omnievent/strategies/api.rb +21 -18
- data/omnievent-api.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f03909646c8909dcac894d052609ec5b0a337b7ade88df690029f30866b1710
|
4
|
+
data.tar.gz: 2ad4e2d181f5bfd005f67515a123d276ed4852382d988844c836694decf0d010
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7d06f35d21485b9a80e006dadff5cf3e3ee78966e501d12a1c2e50a20bd39ea5f25638f1488b030930a4ce883302c8d35d484974ff07e368b1fe4b94dd67fcc
|
7
|
+
data.tar.gz: 8fc5203c01d016483125eef12a3264d7cd5e15fec5b0fd97b7a36f8c88c23919e48228f0085ef28145fcc53db179429757e086fff494c36725a230ca6397f41d
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
omnievent-api (0.1.0.
|
4
|
+
omnievent-api (0.1.0.pre2)
|
5
5
|
excon
|
6
6
|
omnievent
|
7
7
|
|
@@ -16,7 +16,7 @@ GEM
|
|
16
16
|
crack (0.4.5)
|
17
17
|
rexml
|
18
18
|
diff-lcs (1.5.0)
|
19
|
-
excon (0.
|
19
|
+
excon (0.93.0)
|
20
20
|
hashdiff (1.0.1)
|
21
21
|
hashie (5.0.0)
|
22
22
|
iso-639 (0.3.5)
|
data/README.md
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# OmniEvent API (Pre Release)
|
2
2
|
|
3
|
+
> Please note that this gem is pre release and is not yet ready for production.
|
4
|
+
|
3
5
|
This gem contains an generic API strategy for OmniEvent.
|
4
6
|
|
5
7
|
## Usage
|
6
8
|
|
7
|
-
> Please note that this gem is pre release and is not yet ready for production.
|
8
|
-
|
9
9
|
This gem is designed to be a base for other OmniEvent strategies.
|
10
10
|
|
11
11
|
## Development
|
@@ -19,6 +19,7 @@ module OmniEvent
|
|
19
19
|
|
20
20
|
option :name, "api"
|
21
21
|
option :token, ""
|
22
|
+
option :debug, false
|
22
23
|
|
23
24
|
REDIRECT_LIMIT = 5
|
24
25
|
|
@@ -38,17 +39,13 @@ module OmniEvent
|
|
38
39
|
raise NotImplementedError
|
39
40
|
end
|
40
41
|
|
41
|
-
def request_path
|
42
|
-
raise NotImplementedError
|
43
|
-
end
|
44
|
-
|
45
42
|
def request_headers
|
46
43
|
raise NotImplementedError
|
47
44
|
end
|
48
45
|
|
49
46
|
def perform_request(opts = {})
|
50
|
-
request_opts = {
|
51
|
-
request_response = request_connection.
|
47
|
+
request_opts = { method: "GET" }.merge(opts)
|
48
|
+
request_response = request_connection.request(request_opts)
|
52
49
|
|
53
50
|
redirect = 0
|
54
51
|
while redirect < REDIRECT_LIMIT && [301, 302, 303, 307, 308].include?(request_response.status)
|
@@ -57,27 +54,33 @@ module OmniEvent
|
|
57
54
|
request_response = request_connection.get(request_opts)
|
58
55
|
end
|
59
56
|
|
60
|
-
|
57
|
+
unless request_response.status == 200
|
58
|
+
message = "Failed to retrieve events from #{options.name}"
|
59
|
+
message += ": #{request_response.body[0...300]}" if request_response.body
|
60
|
+
log(:error, message)
|
61
|
+
end
|
61
62
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
63
|
+
if opts[:raw_response]
|
64
|
+
request_response
|
65
|
+
else
|
66
|
+
begin
|
67
|
+
parsed_request_body = JSON.parse(request_response.body)
|
68
|
+
rescue JSON::ParserError
|
69
|
+
log(:error, "Failed to parse response body from #{options.name}")
|
70
|
+
parsed_request_body = nil
|
71
|
+
end
|
72
|
+
|
73
|
+
parsed_request_body
|
66
74
|
end
|
67
75
|
end
|
68
76
|
|
69
77
|
def request_connection
|
70
78
|
@request_connection ||= Excon.new(
|
71
79
|
request_url,
|
72
|
-
headers: request_headers
|
80
|
+
headers: request_headers,
|
81
|
+
debug: options.debug
|
73
82
|
)
|
74
83
|
end
|
75
|
-
|
76
|
-
def request_error
|
77
|
-
message = "Failed to retrieve events from #{options.name}"
|
78
|
-
log(:error, message)
|
79
|
-
raise Error, message
|
80
|
-
end
|
81
84
|
end
|
82
85
|
end
|
83
86
|
end
|
data/omnievent-api.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.name = "omnievent-api"
|
9
9
|
spec.version = OmniEvent::API::VERSION
|
10
10
|
spec.authors = ["Angus McLeod"]
|
11
|
-
spec.email = ["
|
11
|
+
spec.email = ["development@pavilion.tech"]
|
12
12
|
|
13
13
|
spec.summary = "OmniEvent API strategy"
|
14
14
|
spec.description = "A generic API strategy for OmniEvent"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omnievent-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0.
|
4
|
+
version: 0.1.0.pre2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Angus McLeod
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-10-
|
11
|
+
date: 2022-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: excon
|
@@ -68,7 +68,7 @@ dependencies:
|
|
68
68
|
version: '0'
|
69
69
|
description: A generic API strategy for OmniEvent
|
70
70
|
email:
|
71
|
-
-
|
71
|
+
- development@pavilion.tech
|
72
72
|
executables: []
|
73
73
|
extensions: []
|
74
74
|
extra_rdoc_files: []
|