fyipe 3.0.11963.pre.qa → 3.0.12011.pre.qa

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: 6f16a8e61b9c2a934cdfdedc8b9eb1a7b839d15b3f44165d3eea3b61f6c71319
4
- data.tar.gz: 4be203758307e72ff3b1696cfd77e45eed79e9c0d4b5ee1619138a3e95d37f59
3
+ metadata.gz: f8d3bba726a8b48899ca39958b0dc269f9298893e26a145dfcfbc3dae4c56819
4
+ data.tar.gz: fc43cc610d3821ea7d896e41422e8cc7ddd318e4b79daf1d4af87911b4c473fb
5
5
  SHA512:
6
- metadata.gz: 87fa1d4d960e01c97af88a8827233b035888d5e1035151eaed197e3e6e35c68f923fc4376d1653c09ddbb47f938a4e6836518a30e5f1aa59501f084e8cd23791
7
- data.tar.gz: 2ea235a44d88f2fe5649f82aa172087760a7827464df398d65af2ab6af1cd9b8b9b1ff2dd8b0c956cb7840f3d60981e2604e2cb06e7082a20d0e3843f208824c
6
+ metadata.gz: 5a82dd49932cdb64d345be1e1ee9be2b61d65a1862c93b214730f7c4056242a2d9be69ca00fac395a9cc6240f861c715527bb13bcb79ed0796cb348a8f31d213
7
+ data.tar.gz: 4ab5b065b55c44ce7ff3685442cabcaf07479135e223176ba06efa718c7b13d615779abac03a5547be4fd222372cf7c2ff63c62b33706bf795c5a8625b2a3b94
data/README.md CHANGED
@@ -61,6 +61,72 @@ response = logger.log(item, tags)
61
61
  puts response
62
62
  ```
63
63
 
64
+ ## Basic Usage for Tracking
65
+
66
+ ```ruby
67
+ require 'fyipe'
68
+
69
+ # constructor
70
+
71
+ # set up tracking configurations
72
+ options = {
73
+ "maxTimeline": 50,
74
+ "captureCodeSnippet": true
75
+ }
76
+ tracker = FyipeLogger.new(
77
+ 'API_URL', # https://fyipe.com/api
78
+ 'ERROR_TRACKER_ID',
79
+ 'ERROR_TRACKER_KEY',
80
+ options # optional
81
+ )
82
+
83
+ # capturing a timeline manually
84
+ timelineContent = {}
85
+
86
+ timelineContent["account"] = "debit"
87
+ timelineContent["amount"] = "6000.00"
88
+ timelineContent["userId"] = 471
89
+ tracker.addToTimeline('payment', timelineContent, 'info')
90
+
91
+ # setting custom tags
92
+ tracker.setTag('category', 'QA Tester') # a single tag
93
+
94
+ # multiple tags
95
+ tags = []
96
+
97
+ # create two tags
98
+ tagOne = {}
99
+ tagOne["key"] = 'type'
100
+ tagOne["value"] = 'notification'
101
+ tagTwo = {}
102
+ tagTwo["key"] = 'location'
103
+ tagTwo["value"] = 'Oslo'
104
+
105
+ # add the two items to the array
106
+ tags = [tagOne, tagTwo]
107
+
108
+ # setting the array of tags
109
+ tracker.setTags(tags)
110
+
111
+
112
+ # all error exception captured are sent to your fyipe dashboard
113
+
114
+ # capturing errors in a begin and rescue
115
+ begin
116
+ # some code that might fail
117
+ result = 5/0 # Should throw a division by zero error
118
+ rescue => ex
119
+ tracker.captureException(ex)
120
+ end
121
+
122
+ # capturing errors using the message signature
123
+ tracker.captureMessage('some error text')
124
+
125
+ # capturing errors authomatically
126
+ NonExistingMethod() # calling this will trigger an error and its sent to your fyipe dashboard
127
+
128
+ ```
129
+
64
130
  ## API Documentation
65
131
 
66
132
  Main API to send logs to the server.
@@ -71,11 +137,20 @@ Main API to send logs to the server.
71
137
  - [Installation](#installation)
72
138
  - [Gem Install](#gem-install)
73
139
  - [Basic Usage for Logging](#basic-usage-for-logging)
140
+ - [Basic Usage for Tracking](#basic-usage-for-tracking)
74
141
  - [API Documentation](#api-documentation)
75
142
  - [FyipeLogger.new(apiUrl, applicationId, applicationKey)](#fyipeloggernewapiurl-applicationid-applicationkey)
76
143
  - [logger.log(log, \tags)](#loggerloglog-tags)
77
144
  - [logger.warning(warning, \tags)](#loggerwarningwarning-tags)
78
145
  - [logger.error(error, \tags)](#loggererrorerror-tags)
146
+ - [FyipeTracker.new(apiUrl, errorTrackerId, errorTrackerKey)](#fyipetrackernewapiurl-errortrackerid-errortrackerkey)
147
+ - [options](#options)
148
+ - [tracker.setTag(key, value)](#trackersettagkey-value)
149
+ - [tracker.setTags([{key, value}])](#trackersettagskey-value)
150
+ - [tracker.setFingerprint(fingerprint)](#trackersetfingerprintfingerprint)
151
+ - [tracker.addToTimeline(category, content, type)](#trackeraddtotimelinecategory-content-type)
152
+ - [tracker.captureMessage(message)](#trackercapturemessagemessage)
153
+ - [tracker.captureException(error)](#trackercaptureexceptionerror)
79
154
  - [Contribution](#contribution)
80
155
 
81
156
  <a name="logger_api--logger"></a>
@@ -129,6 +204,99 @@ Logs a request of type `error` to the server.
129
204
  | \error | <code>string</code> \| <code>Object</code> | The content to the logged on the server. |
130
205
  | \tags | <code>string</code> \| <code>Array</code> | The tag(s) to be attached to the logged item on the server. |
131
206
 
207
+ <a name="tracker_api--tracker"></a>
208
+
209
+ ### FyipeTracker.new(apiUrl, errorTrackerId, errorTrackerKey)
210
+
211
+ Create a constructor from the class, which will be used to track errors sent to the server.
212
+
213
+ **Kind**: Constructor
214
+ **Returns**: <code>null</code>
215
+
216
+ | Param | Type | Description |
217
+ | --------------- | ------------------- | ------------------------------------------- |
218
+ | apiUrl | <code>string</code> | The Server URL. |
219
+ | errorTrackerId | <code>string</code> | The Error Tracker ID. |
220
+ | errorTrackerKey | <code>string</code> | The Error Tracker Key. |
221
+ | option | <code>object</code> | The options to be considred by the tracker. |
222
+
223
+ #### options
224
+
225
+ | Param | Type | Description |
226
+ | ------------------ | -------------------- | ----------------------------------------------------------------------------------------------------- |
227
+ | maxTimeline | <code>int</code> | The total amount of timeline that should be captured, defaults to 5 |
228
+ | captureCodeSnippet | <code>boolean</code> | When set as `true` stack traces are automatically attached to all error sent to your fyipe dashboard. |
229
+
230
+ #### tracker.setTag(key, value)
231
+
232
+ Set tag for the error to be sent to the server.
233
+
234
+ **Kind**: method of [<code>FyipeTracker</code>](#tracker_api--tracker)
235
+ **Returns**: <code>null</code>
236
+
237
+ | Param | Type | Description |
238
+ | ----- | ------------------- | ---------------------- |
239
+ | key | <code>string</code> | The key for the tag. |
240
+ | value | <code>string</code> | The value for the tag. |
241
+
242
+ #### tracker.setTags([{key, value}])
243
+
244
+ Set multiple tags for the error to be sent to the server. Takes in a list
245
+
246
+ **Kind**: method of [<code>FyipeTracker</code>](#tracker_api--tracker)
247
+ **Returns**: <code>null</code>
248
+
249
+ | Param | Type | Description |
250
+ | ----- | ------------------- | ---------------------- |
251
+ | key | <code>string</code> | The key for the tag. |
252
+ | value | <code>string</code> | The value for the tag. |
253
+
254
+ #### tracker.setFingerprint(fingerprint)
255
+
256
+ Set fingerprint for the next error to be captured.
257
+
258
+ **Kind**: method of [<code>FyipeTracker</code>](#tracker_api--tracker)
259
+ **Returns**: <code>null</code>
260
+
261
+ | Param | Type | Description |
262
+ | ----------- | --------------------------------------------------- | ------------------------------------------------------------- |
263
+ | fingerprint | <code>string</code> \| <code>list of strings</code> | The set of string used to group error messages on the server. |
264
+
265
+ #### tracker.addToTimeline(category, content, type)
266
+
267
+ Add a custom timeline element to the next error to be sent to the server
268
+
269
+ **Kind**: method of [<code>FyipeTracker</code>](#tracker_api--tracker)
270
+ **Returns**: <code>null</code>
271
+
272
+ | Param | Type | Description |
273
+ | -------- | ------------------------------------------ | ----------------------------------- |
274
+ | category | <code>string</code> | The category of the timeline event. |
275
+ | content | <code>string</code> \| <code>object</code> | The content of the timeline event. |
276
+ | type | <code>string</code> | The type of timeline event. |
277
+
278
+ #### tracker.captureMessage(message)
279
+
280
+ Capture a custom error message to be sent to the server
281
+
282
+ **Kind**: method of [<code>FyipeTracker</code>](#tracker_api--tracker)
283
+ **Returns**: <code>Promise</code>
284
+
285
+ | Param | Type | Description |
286
+ | ------- | ------------------- | ------------------------------------- |
287
+ | message | <code>string</code> | The message to be sent to the server. |
288
+
289
+ #### tracker.captureException(error)
290
+
291
+ Capture a custom error object to be sent to the server
292
+
293
+ **Kind**: method of [<code>FyipeTracker</code>](#tracker_api--tracker)
294
+ **Returns**: <code>Promise</code>
295
+
296
+ | Param | Type | Description |
297
+ | ----- | ----------------------------- | ------------------------------------------ |
298
+ | error | <code>Exception object</code> | The Error Object to be sent to the server. |
299
+
132
300
  ## Contribution
133
301
 
134
302
  - Clone repository
data/lib/fyipe.rb ADDED
@@ -0,0 +1,2 @@
1
+ require_relative 'fyipeLogger'
2
+ require_relative 'fyipeTracker'
data/lib/fyipe/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Fyipe
2
2
  NAME = 'fyipe'
3
- VERSION = '3.0.11963-qa'
3
+ VERSION = '3.0.12011-qa'
4
4
  end
data/lib/fyipeTracker.rb CHANGED
@@ -4,7 +4,7 @@ require_relative 'fyipe/fyipeTransport'
4
4
  require File.expand_path('./fyipe/version', __dir__)
5
5
 
6
6
  class FyipeTracker
7
- # FyipeLogger constructor.
7
+ # FyipeTracker constructor.
8
8
  # @param string apiUrl
9
9
  # @param string errorTrackerId
10
10
  # @param string errorTrackerKey
@@ -27,7 +27,7 @@ class FyipeTracker
27
27
  setEventId()
28
28
  @listenerObj = FyipeListener.new(getEventId(), @options)
29
29
  @apiTransport = FyipeTransport.new(@apiUrl)
30
- # setUpExceptionHandlerListener()
30
+ setUpExceptionHandlerListener()
31
31
  end
32
32
 
33
33
  def setApiUrl(apiUrl)
@@ -1,5 +1,5 @@
1
1
  # spec/fyipe_logger_spec.rb
2
- require_relative '../lib/fyipeLogger'
2
+ require_relative '../lib/fyipe'
3
3
  require_relative 'helper'
4
4
 
5
5
  RSpec.configure do |config|
@@ -55,7 +55,7 @@ RSpec.describe FyipeLogger do
55
55
  logger = FyipeLogger.new($apiUrl, $applicationLog["_id"], $applicationLog["key"])
56
56
  response = logger.log(log)
57
57
  expect(response['content']).to eql log
58
- expect(response['content'].class.to_s).to eql "String"
58
+ expect(response['content']).to be_an_instance_of(String)
59
59
  expect(response['type']).to eql "info"
60
60
  end
61
61
  it 'test_valid_object_content_of_type_info_is_logged' do
@@ -66,7 +66,7 @@ RSpec.describe FyipeLogger do
66
66
  logger = FyipeLogger.new($apiUrl, $applicationLog["_id"], $applicationLog["key"])
67
67
  response = logger.log(log)
68
68
  expect(response['content']["location"]).to eql log["location"]
69
- expect(response['content'].class.to_s).to eql "Hash"
69
+ expect(response['content']).to be_an_instance_of(Hash)
70
70
  expect(response['type']).to eql "info"
71
71
  end
72
72
  it 'test_valid_string_content_of_type_error_is_logged' do
@@ -74,7 +74,7 @@ RSpec.describe FyipeLogger do
74
74
  logger = FyipeLogger.new($apiUrl, $applicationLog["_id"], $applicationLog["key"])
75
75
  response = logger.error(log)
76
76
  expect(response['content']).to eql log
77
- expect(response['content'].class.to_s).to eql "String"
77
+ expect(response['content']).to be_an_instance_of(String)
78
78
  expect(response['type']).to eql "error"
79
79
  end
80
80
  it 'test_valid_object_content_of_type_warning_is_logged' do
@@ -85,7 +85,7 @@ RSpec.describe FyipeLogger do
85
85
  logger = FyipeLogger.new($apiUrl, $applicationLog["_id"], $applicationLog["key"])
86
86
  response = logger.warning(log)
87
87
  expect(response['content']["location"]).to eql log["location"]
88
- expect(response['content'].class.to_s).to eql "Hash"
88
+ expect(response['content']).to be_an_instance_of(Hash)
89
89
  expect(response['type']).to eql "warning"
90
90
  end
91
91
  it 'test_valid_object_content_of_type_warning_with_one_tag_is_logged' do
@@ -97,9 +97,9 @@ RSpec.describe FyipeLogger do
97
97
  logger = FyipeLogger.new($apiUrl, $applicationLog["_id"], $applicationLog["key"])
98
98
  response = logger.warning(log, tag)
99
99
  expect(response['content']["location"]).to eql log["location"]
100
- expect(response['content'].class.to_s).to eql "Hash"
100
+ expect(response['content']).to be_an_instance_of(Hash)
101
101
  expect(response['type']).to eql "warning"
102
- expect(response['tags'].class.to_s).to eql "Array"
102
+ expect(response['tags']).to be_an_instance_of(Array)
103
103
  expect(response['tags'].find { |item| item == tag }).to_not be_nil
104
104
  end
105
105
  it 'test_valid_object_content_of_type_error_with_no_tag_is_logged' do
@@ -107,10 +107,8 @@ RSpec.describe FyipeLogger do
107
107
  logger = FyipeLogger.new($apiUrl, $applicationLog["_id"], $applicationLog["key"])
108
108
  response = logger.error(log)
109
109
  expect(response['content']).to eql log
110
- expect(response['content'].class.to_s).to eql "String"
110
+ expect(response['content']).to be_an_instance_of(String)
111
111
  expect(response['type']).to eql "error"
112
- expect(response['tags'].class.to_s).to eql "Array"
113
- expect(response['tags']).to eql []
114
112
  end
115
113
  it 'test_valid_object_content_of_type_warning_with_four_tags_is_logged' do
116
114
  log = {
@@ -121,9 +119,9 @@ RSpec.describe FyipeLogger do
121
119
  logger = FyipeLogger.new($apiUrl, $applicationLog["_id"], $applicationLog["key"])
122
120
  response = logger.warning(log, tags)
123
121
  expect(response['content']["location"]).to eql log["location"]
124
- expect(response['content'].class.to_s).to eql "Hash"
122
+ expect(response['content']).to be_an_instance_of(Hash)
125
123
  expect(response['type']).to eql "warning"
126
- expect(response['tags'].class.to_s).to eql "Array"
124
+ expect(response['tags']).to be_an_instance_of(Array)
127
125
  tags.each {
128
126
  |tag| expect(response['tags'].find { |item| item == tag }).to_not be_nil
129
127
  }
@@ -1,5 +1,5 @@
1
1
  # spec/fyipe_tracker_spec.rb
2
- require_relative '../lib/fyipeTracker'
2
+ require_relative '../lib/fyipe'
3
3
  require_relative 'helper'
4
4
 
5
5
  RSpec.configure do |config|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fyipe
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.11963.pre.qa
4
+ version: 3.0.12011.pre.qa
5
5
  platform: ruby
6
6
  authors:
7
7
  - HackerBay, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-29 00:00:00.000000000 Z
11
+ date: 2021-06-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -154,6 +154,7 @@ files:
154
154
  - README.md
155
155
  - RakeFile
156
156
  - fyipe.gemspec
157
+ - lib/fyipe.rb
157
158
  - lib/fyipe/fyipeListener.rb
158
159
  - lib/fyipe/fyipeTransport.rb
159
160
  - lib/fyipe/logtype.rb