eltesla 0.0.1 → 0.0.2
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/eltesla/client.rb +8 -7
- data/lib/eltesla/version.rb +1 -1
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe285ae92d66faa2dd75811848c19a3f2822154ac843289022623159ebaa9fd6
|
4
|
+
data.tar.gz: a1a75c68b07739500005ba57fe69d617b8d6d3d05caaca2496d7ec48a2edd777
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ce15a43687eb8602a50071b27f73dde7ab39eb59afb4433f120d7637007f73d2164d53c63066e13968ddb93d0a6e9252032add720fa7e0a877b50f54446287c
|
7
|
+
data.tar.gz: 79604e4f914721f4333437c172b6eb3c67961468715037a8e50b55f8d1320793e5d0963ce48ebbd5281e27b46ade426cf291a44a5328e34edc810559e15055a2
|
data/lib/eltesla/client.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'httparty'
|
4
4
|
require 'uri'
|
5
5
|
require 'json'
|
6
6
|
|
7
|
+
# rb(main):004> HTTParty.post('https://eltesla.dev/metrics', body: { results: []}.to_json, headers: { 'Content-Type' => 'application/json' })
|
7
8
|
module Eltesla
|
8
9
|
# Client for the Eltesla backend
|
9
10
|
class Client
|
@@ -50,14 +51,14 @@ module Eltesla
|
|
50
51
|
private
|
51
52
|
|
52
53
|
def http_post!
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
{
|
54
|
+
result = HTTParty.post(
|
55
|
+
'https://eltesla.dev/metrics',
|
56
|
+
headers: { 'Content-Type' => 'application/json' },
|
57
|
+
body: { results: queue.map(&:to_h) }.to_json
|
57
58
|
)
|
58
|
-
|
59
|
+
return if result.success?
|
59
60
|
|
60
|
-
|
61
|
+
raise "HTTP error: code #{result.response.code}"
|
61
62
|
end
|
62
63
|
end
|
63
64
|
end
|
data/lib/eltesla/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eltesla
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexandre Ignjatovic
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: httparty
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.21'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.21'
|
27
41
|
description: Client for the Eltesla service, for easier refactoring
|
28
42
|
email: alexandre.ignjatovic@gmail.com
|
29
43
|
executables: []
|