soaspec 0.2.28 → 0.2.29
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 +9 -0
- data/lib/soaspec/exchange_handlers/rest_handler.rb +1 -1
- data/lib/soaspec/o_auth2.rb +1 -1
- data/lib/soaspec/spec_logger.rb +24 -5
- data/lib/soaspec/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 85321b628bfe9f5c96477fbbb8b630439332838b4552ce295c00486c94922461
|
4
|
+
data.tar.gz: 9de5454ec0b65ee3442e6f3772d0f61d09463f1ba78751edfb9e9394331aaafb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a6b6e8b16a9c432ea9b8b23e90ec64e9174d96504c2c49089d0a732ddefe6d9d6b67b258dc143887314cf767ff3bd822b4c7a12baebc38824f72947823d9152
|
7
|
+
data.tar.gz: d8cda71cffe34d1df8bae7fa0c701e6360009a70458e62eed88821cafd79ca25c47f6090f27821e4f1fc9c843741601e37ee3fa0e8c86ddcf73cc39680fe13ae
|
data/ChangeLog
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
Version 0.2.29
|
2
|
+
* Enhancement
|
3
|
+
* SpecLogger - change:
|
4
|
+
* Programe name
|
5
|
+
* Date and time format
|
6
|
+
* Accessor internal logger object
|
7
|
+
* Removed unnecessarily severity as it's always INFO
|
8
|
+
* For REST calls log Response under 1 log with headers and body indented on new lines
|
9
|
+
|
1
10
|
Version 0.2.28
|
2
11
|
* Enhancement
|
3
12
|
* Ability to change OAuth2 retry limit as retrying too many times can cause a lock out
|
@@ -107,7 +107,7 @@ module Soaspec
|
|
107
107
|
rescue RestClient::ExceptionWithResponse => e
|
108
108
|
response = e.response
|
109
109
|
end
|
110
|
-
Soaspec::SpecLogger.info(
|
110
|
+
Soaspec::SpecLogger.info("response: \n headers: #{response&.headers}\n body: #{response}\n")
|
111
111
|
after_response(response, self)
|
112
112
|
response
|
113
113
|
end
|
data/lib/soaspec/o_auth2.rb
CHANGED
@@ -105,7 +105,7 @@ module Soaspec
|
|
105
105
|
retry if retry_count < self.class.retry_limit
|
106
106
|
raise error
|
107
107
|
else
|
108
|
-
Soaspec::SpecLogger.info(["
|
108
|
+
Soaspec::SpecLogger.info(["response: \n headers: #{response&.headers}\n body: #{response}\n"]) if debug_oauth?
|
109
109
|
JSON.parse(response)
|
110
110
|
end
|
111
111
|
|
data/lib/soaspec/spec_logger.rb
CHANGED
@@ -27,6 +27,8 @@ module Soaspec
|
|
27
27
|
@time_test_run = Time.now.strftime('%Y-%m-%d_%H_%M_%S')
|
28
28
|
# By default file is based on time
|
29
29
|
@traffic_file = nil
|
30
|
+
# Name of program to include in logs
|
31
|
+
@progname
|
30
32
|
class << self
|
31
33
|
# Folder to put API traffic logs
|
32
34
|
attr_accessor :traffic_folder
|
@@ -34,8 +36,20 @@ module Soaspec
|
|
34
36
|
attr_accessor :terminal_color
|
35
37
|
# Readers for log parameters
|
36
38
|
attr_reader :output_to_terminal, :output_to_file, :time_test_run
|
39
|
+
# @return [String] Name of program to include in logs
|
40
|
+
attr_accessor :progname
|
41
|
+
# @return [String] String representing date format to use for traffic
|
42
|
+
attr_writer :time_format
|
43
|
+
# Logger used to log API requests
|
44
|
+
attr_accessor :logger
|
45
|
+
|
46
|
+
# String representing date format to use for traffic
|
47
|
+
def time_format
|
48
|
+
@time_format || '%H:%M:%S'
|
49
|
+
end
|
37
50
|
|
38
51
|
# Set file to log traffic to
|
52
|
+
# @param [String] file Path to traffic file to use
|
39
53
|
def traffic_file=(file)
|
40
54
|
@traffic_file = file
|
41
55
|
reset_log
|
@@ -83,8 +97,9 @@ module Soaspec
|
|
83
97
|
def create
|
84
98
|
create_log_file
|
85
99
|
@logger = ApiLogger.new(traffic_file) # Where request and responses of APIs are stored
|
86
|
-
@logger.
|
87
|
-
|
100
|
+
@logger.progname = progname || 'SpecLog'
|
101
|
+
@logger.formatter = proc do |_severity, datetime, progname, msg|
|
102
|
+
message = "#{progname}, [#{datetime.strftime(time_format)}] : #{msg}\n"
|
88
103
|
print message.colorize(terminal_color) if @output_to_terminal
|
89
104
|
message if @output_to_file
|
90
105
|
end
|
@@ -94,17 +109,21 @@ module Soaspec
|
|
94
109
|
|
95
110
|
# Log a message using Soaspec logger
|
96
111
|
# Logger (and it's file) will be created if it's not already set
|
97
|
-
# @param [String] message The message to add to the logger
|
112
|
+
# @param [String, Array] message The message to add to the logger or list of messages
|
98
113
|
def info(message)
|
99
114
|
return unless log_api_traffic?
|
100
115
|
|
101
116
|
create unless @logger
|
102
117
|
if message.respond_to? :each
|
103
118
|
message.each do |message_item|
|
104
|
-
|
119
|
+
info(message_item)
|
105
120
|
end
|
106
121
|
else
|
107
|
-
|
122
|
+
if block_given?
|
123
|
+
@logger.info(message) { yield }
|
124
|
+
else
|
125
|
+
@logger.info(message)
|
126
|
+
end
|
108
127
|
end
|
109
128
|
end
|
110
129
|
|
data/lib/soaspec/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: soaspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.29
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SamuelGarrattIQA
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-07-
|
11
|
+
date: 2019-07-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|