omnievent-api 0.1.0.pre1 → 0.1.0.pre3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- 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 +24 -18
- data/omnievent-api.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 941d3b6b19c8478a4b464277b0dc31902551edf2ab8145ef4747c04e738dbb50
|
4
|
+
data.tar.gz: d33a1365a9ee988d625824c8154ea71e343fbdbaeee332d4529cdd6e594f8832
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a3b6c202b6a908f08f4889ae9b2896a4cc7150556c86dfe5e9be3de0543bd8013925d236559f04327e713c2d1485a09dca2ee0fbeeab8492fd677b184c5feea
|
7
|
+
data.tar.gz: d7c05c829b4a20bcecd5b24bafdf313841ead51b88958e921f78c2011ed830297d7d6c5c443200182841848170a560789816a3d5d7d98c9ece6fed202d9bf7ab
|
data/.rubocop.yml
CHANGED
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,36 @@ module OmniEvent
|
|
57
54
|
request_response = request_connection.get(request_opts)
|
58
55
|
end
|
59
56
|
|
60
|
-
|
57
|
+
request_succeeded = [200, 201, 202, 204].include?(request_response.status)
|
58
|
+
unless request_succeeded
|
59
|
+
message = "Failed to retrieve events from #{options.name}"
|
60
|
+
message += ": #{request_response.body[0...300]}" if request_response.body
|
61
|
+
log(:error, message)
|
62
|
+
end
|
61
63
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
64
|
+
if opts[:raw_response]
|
65
|
+
request_response
|
66
|
+
elsif !request_response.body.to_s.empty?
|
67
|
+
begin
|
68
|
+
parsed_request_body = JSON.parse(request_response.body)
|
69
|
+
rescue JSON::ParserError
|
70
|
+
log(:error, "Failed to parse response body from #{options.name}")
|
71
|
+
parsed_request_body = nil
|
72
|
+
end
|
73
|
+
|
74
|
+
parsed_request_body
|
75
|
+
else
|
76
|
+
request_succeeded
|
66
77
|
end
|
67
78
|
end
|
68
79
|
|
69
80
|
def request_connection
|
70
81
|
@request_connection ||= Excon.new(
|
71
82
|
request_url,
|
72
|
-
headers: request_headers
|
83
|
+
headers: request_headers,
|
84
|
+
debug: options.debug
|
73
85
|
)
|
74
86
|
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
87
|
end
|
82
88
|
end
|
83
89
|
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.pre3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Angus McLeod
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-09-03 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: []
|
@@ -110,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
110
110
|
- !ruby/object:Gem::Version
|
111
111
|
version: 1.3.1
|
112
112
|
requirements: []
|
113
|
-
rubygems_version: 3.
|
113
|
+
rubygems_version: 3.3.26
|
114
114
|
signing_key:
|
115
115
|
specification_version: 4
|
116
116
|
summary: OmniEvent API strategy
|