everylog_ruby_client 1.0.1 → 1.0.4

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
  SHA256:
3
- metadata.gz: a41febdaeb7e75805abe0fb888b1967757bbeb652ebc6178329f74035a578cfc
4
- data.tar.gz: '08e6751b3e68e5151769e28b6422ef439be51ca215bf9f2761431539ff5f6b53'
3
+ metadata.gz: 8442bcf4e02820f0f7f7f7123d36bea5f3d151be485b722fbb6976690325077a
4
+ data.tar.gz: 03f5023f50b0112fcb799747e3b4485caa2ead5da297761043eac1271cf576be
5
5
  SHA512:
6
- metadata.gz: 0ff1922e485792cae0c20d20c889eed0365f6af4cc297685fb7e0a1ca03fb6ce99983ec7321c947a3b4a190533561f712dd28280113248ddd5fd7b19f88fd70d
7
- data.tar.gz: 072bc8c0756b36d07b110d4bc958f07dc2083c7a19418c2388ac94521474bf4be2f78f10da97bc47443c9e526e513da09744797cc7ae327ae2ca9bc75ad363b9
6
+ metadata.gz: bb5325df0a8340ab4cee5793aa88cf6bf7e525599460bebc56fe674c31b87be34f2fcd9a6b4714f72cb807c2c2ef81fc129f57d62257657d18f0fedcd8f61440
7
+ data.tar.gz: eaf091ad48aa507c6ee7c6495d26a09ac467cfacc12f1b9a277bd5b991e928900065ce657a79702ba169e9f3135018b029b381edd417c417195660d006e65f8f
data/CHANGELOG.md CHANGED
@@ -3,3 +3,17 @@
3
3
  ## [1.0.0] - 2022-04-22
4
4
 
5
5
  - Initial release
6
+
7
+ ## [1.0.2] - 2022-04-22
8
+
9
+ - Bump version
10
+
11
+ ## [1.0.3] - 2022-04-28
12
+
13
+ - pass on setup projectId
14
+ - add possibility to override on notify the projectId
15
+ - update readme
16
+
17
+ ## [1.0.4] - 2022-04-28
18
+
19
+ - fix http call
data/README.md CHANGED
@@ -24,17 +24,18 @@ require 'everylog_ruby_client'
24
24
 
25
25
  # @param [Hash] options
26
26
  # @option options [String] :api_key for authenticate against EveryLog server
27
+ # @option options [String] :projectId name of the project
27
28
  # @option options [String] :everylog_url (https://api.everylog.io/api/v1/log-entries) to reach Everlog server
28
- $EveryLogClient = EveryLog::Client.instance.setup(api_key: <YOUR_API_KEY>)
29
-
30
- # @param [Hash] options
31
- # @option options [String] :projectId name of the project
32
- # @option options [String] :title to display in the application and if enabled in the notification
33
- # @option options [String] :summary is a not so long text to display on the application and if enabled in the notification
34
- # @option options [String] :body it can contain a long text simple formatted, no html to display in the application
35
- # @option options [Array] :tags it can be used to categorize the notification, must be strings
36
- # @option options [String] :link it can be used to display on the application and if enabled in the notification
37
- # @option options [Boolean] :push if True, a push notification is sent to application
29
+ $EveryLogClient = EveryLog::Client.instance.setup(api_key: <YOUR_API_KEY>, projectId: <YOUR_PROJECT_NAME>)
30
+
31
+ # @param [Hash] notify_options
32
+ # @option notify_options [String, options[:projectId]] :projectId name of the project
33
+ # @option notify_options [String] :title to display in the application and if enabled in the notification
34
+ # @option notify_options [String] :summary is a not so long text to display on the application and if enabled in the notification
35
+ # @option notify_options [String] :body it can contain a long text simple formatted, no html to display in the application
36
+ # @option notify_options [Array] :tags it can be used to categorize the notification, must be strings
37
+ # @option notify_options [String] :link it can be used to display on the application and if enabled in the notification
38
+ # @option notify_options [Boolean] :push if True, a push notification is sent to application
38
39
  $EveryLogClient.notify(...)
39
40
  ```
40
41
  ## Contributing
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EveryLogRubyClient
4
- VERSION = "1.0.1"
4
+ VERSION = "1.0.4"
5
5
  end
@@ -10,14 +10,14 @@ module EveryLog
10
10
 
11
11
  SETUP_DEFAULTS = {
12
12
  api_key: nil,
13
+ projectId: nil,
13
14
  everylog_url: "https://api.everylog.io/api/v1/log-entries"
14
15
  }.freeze
15
16
 
16
17
  NOTIFY_DEFAULTS = {
17
- projectId: nil,
18
- title: nil,
19
- summary: nil,
20
- body: nil,
18
+ title: "Empty notification",
19
+ summary: "Empty summary",
20
+ body: "Empty body",
21
21
  tags: [],
22
22
  link: "",
23
23
  push: false
@@ -27,31 +27,31 @@ module EveryLog
27
27
 
28
28
  # @param [Hash] options
29
29
  # @option options [String] :api_key for authenticate against Everylog server
30
+ # @option options [String] :projectId name of the project
30
31
  # @option options [String] :everylog_url (https://api.everylog.io/api/v1/log-entries) to reach Everlog server
31
32
  def setup(options = {})
32
33
  @options = _parse_options(options, SETUP_DEFAULTS)
33
34
  self
34
35
  end
35
36
 
36
- # @param [Hash] options
37
- # @option options [String] :projectId name of the project
38
- # @option options [String] :title to display in the application and if enabled in the notification
39
- # @option options [String] :summary is a not so long text to display on the application and if enabled in the notification
40
- # @option options [String] :body it can contain a long text simple formatted, no html to display in the application
41
- # @option options [Array] :tags it can be used to categorize the notification, must be strings
42
- # @option options [String] :link it can be used to display on the application and if enabled in the notification
43
- # @option options [Boolean] :push if True, a push notification is sent to application
37
+ # @param [Hash] notify_options
38
+ # @option notify_options [String, options[:projectId]] :projectId name of the project
39
+ # @option notify_options [String] :title to display in the application and if enabled in the notification
40
+ # @option notify_options [String] :summary is a not so long text to display on the application and if enabled in the notification
41
+ # @option notify_options [String] :body it can contain a long text simple formatted, no html to display in the application
42
+ # @option notify_options [Array] :tags it can be used to categorize the notification, must be strings
43
+ # @option notify_options [String] :link it can be used to display on the application and if enabled in the notification
44
+ # @option notify_options [Boolean] :push if True, a push notification is sent to application
45
+
44
46
  def notify(notify_options = {})
45
47
  @notify_options = _parse_options(notify_options, NOTIFY_DEFAULTS)
46
- uri = URI(options[:everylog_url])
47
- req = Net::HTTP::Post.new(uri, {
48
- "Content-Type": "application/json",
49
- "Authorization": "Bearer #{options[:api_key]}"
50
- })
51
- req.body = @notify_options.to_json
52
- res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
53
- http.request(req)
54
- end
48
+ merged_options = { projectId: options[:projectId] }.merge(@notify_options)
49
+ uri = URI(options[:everylog_url])
50
+ http = Net::HTTP.new(uri.host, uri.port)
51
+ http.use_ssl = true
52
+ req = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json', "Authorization": "Bearer #{options[:api_key]}")
53
+ req.body = merged_options.to_json
54
+ res = http.request(req)
55
55
  res.body
56
56
  end
57
57
 
@@ -72,5 +72,5 @@ module EveryLog
72
72
 
73
73
  result_parsed_options
74
74
  end
75
- end
76
- end
75
+ end
76
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: everylog_ruby_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gilberto Maccacaro
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-04-22 00:00:00.000000000 Z
11
+ date: 2022-05-25 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: " A simple Ruby with no external dependencies, to easily integrate
14
14
  with Everylog API\n"
@@ -28,9 +28,9 @@ licenses:
28
28
  metadata:
29
29
  bug_tracker_uri: https://github.com/everylogsaas/everylog_ruby_client/issues
30
30
  changelog_uri: https://github.com/everylogsaas/everylog_ruby_client/blob/master/CHANGELOG.md
31
- documentation_uri: https://www.rubydoc.info/gems/everylog_ruby_client/1.0.1
31
+ documentation_uri: https://www.rubydoc.info/gems/everylog_ruby_client/1.0.4
32
32
  homepage_uri: https://github.com/everylogsaas/everylog_ruby_client
33
- source_code_uri: https://github.com/everylogsaas/everylog_ruby_client/tree/v1.0.1
33
+ source_code_uri: https://github.com/everylogsaas/everylog_ruby_client/tree/v1.0.4
34
34
  post_install_message:
35
35
  rdoc_options: []
36
36
  require_paths: