soaspec 0.2.5 → 0.2.7

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
  SHA1:
3
- metadata.gz: 745281f9da86335fb291d91c4546429d77e5850e
4
- data.tar.gz: dedd883ba638f9c70372bad06de044eed127f5a4
3
+ metadata.gz: 53a6648e0e02510021fd5341416a75bb8f97db36
4
+ data.tar.gz: f87ce73642f1d37186a76aeaa9a6fdffd2aaf1e9
5
5
  SHA512:
6
- metadata.gz: bee2a56c5ceb91bdd88d0b117871f30e710bf76c1d06c10416dc761c5fab7bf5f5672369b30bd0d6490449fe8c24fc48dec79d5228c47940b51a3202f4236e21
7
- data.tar.gz: 652a6203bbdd767967399a9141f8ac2c40b80626213c5d38e532def497bc81f0be136bb47740224c3cdffa1d8dbeb5a935cc36971b2189ea0f6883edf464d26f
6
+ metadata.gz: a4a89d0b12f41915e3a47149521f20a3eeea9175b228208aa9d09d5f050628639fd57d351a1cdbd535efa5a9119545ffb58ca577c0d5aed494aeeb3ddd17b6d9
7
+ data.tar.gz: 3cabefa3e283c9c01260cbc025fb87ff9fa8327b7dec70ca3bf82e00a7019e11f21f615ab23c46b607144a0dd86415f8abdb8de75565fb21bc648ac3521c3f33
data/ChangeLog CHANGED
@@ -1,3 +1,11 @@
1
+ Version 0.2.7
2
+ * Bug Fix
3
+ * Fix log issue that was failing in Windows
4
+
5
+ Version 0.2.6
6
+ * Enhancements
7
+ * New log file created with time stamp each time tests are run
8
+
1
9
  Version 0.2.5
2
10
  * Bug fix
3
11
  * Error wasn't throw if checking for element with empty response
@@ -3,8 +3,9 @@ module Soaspec
3
3
  module RestExchangeFactory
4
4
  # Make REST Exchange with 'post' method within this Handler context
5
5
  # @param [Hash, String] params Exchange parameters. If String is used it will be for the request payload
6
+ # @option override_parameters [String] :name Name to appear in traffic logs
6
7
  # @option override_parameters [Hash] :params Extra parameters (E.g. headers)
7
- # @option override_parameters [String] suburl URL appended to base_url of class
8
+ # @option override_parameters [String] :suburl URL appended to base_url of class
8
9
  # @option override_parameters [Hash] :q Query for REST
9
10
  # Following are for the body of the request
10
11
  # @option override_parameters [Hash] :body Hash to be converted to JSON in request body
@@ -17,6 +18,7 @@ module Soaspec
17
18
 
18
19
  # Make REST Exchange with 'patch' method within this Handler context
19
20
  # @param [Hash, String] params Exchange parameters. If String is used it will be for the request payload
21
+ # @option override_parameters [String] :name Name to appear in traffic logs
20
22
  # @option override_parameters [Hash] :params Extra parameters (E.g. headers)
21
23
  # @option override_parameters [String] suburl URL appended to base_url of class
22
24
  # @option override_parameters [Hash] :q Query for REST
@@ -31,8 +33,9 @@ module Soaspec
31
33
 
32
34
  # Make REST Exchange with 'put' method within this Handler context
33
35
  # @param [Hash, String] params Exchange parameters. If String is used it will be for the request payload
36
+ # @option override_parameters [String] :name Name to appear in traffic logs
34
37
  # @option override_parameters [Hash] :params Extra parameters (E.g. headers)
35
- # @option override_parameters [String] suburl URL appended to base_url of class
38
+ # @option override_parameters [String] :suburl URL appended to base_url of class
36
39
  # @option override_parameters [Hash] :q Query for REST
37
40
  # Following are for the body of the request
38
41
  # @option override_parameters [Hash] :body Hash to be converted to JSON in request body
@@ -44,30 +47,24 @@ module Soaspec
44
47
  end
45
48
 
46
49
  # Make REST Exchange with 'get' method within this Handler context.
47
- # If merely a string is passed it will be used as the URL appended to base_url. Otherwise a Hash is expected
50
+ # If merely a string is passed it will be used as the URL appended to base_url (same as suburl). Otherwise a Hash is expected
48
51
  # @param [Hash, String] params Exchange parameters. If String is used it will be for suburl
52
+ # @option override_parameters [String] :name Name to appear in traffic logs
53
+ # @option override_parameters [String] :suburl URL appended to base_url of class
49
54
  # @option override_parameters [Hash] :params Extra parameters (E.g. headers)
50
- # @option override_parameters [String] suburl URL appended to base_url of class
51
55
  # @option override_parameters [Hash] :q Query for REST
52
- # Following are for the body of the request
53
- # @option override_parameters [Hash] :body Hash to be converted to JSON in request body
54
- # @option override_parameters [String] :payload String to be passed directly in request body
55
- # @option override_parameters [String] :template_name Path to file to be read via ERB and passed in request body
56
56
  # @return [Exchange] Instance of Exchange class. Assertions are made by default on the response body
57
57
  def get(params = {})
58
58
  perform_exchange_with(:get, params)
59
59
  end
60
60
 
61
61
  # Make REST Exchange with 'delete' method within this Handler context.
62
- # If merely a string is passed it will be used as the URL appended to base_url. Otherwise a Hash is expected
62
+ # If merely a string is passed it will be used as the URL appended to base_url (same as suburl). Otherwise a Hash is expected
63
63
  # @param [Hash, String] params Exchange parameters. If String is used it will be for suburl
64
- # @option override_parameters [Hash] :params Extra parameters (E.g. headers)
65
- # @option override_parameters [String] suburl URL appended to base_url of class
64
+ # @option override_parameters [String] :name Name to appear in traffic logs
65
+ # @option override_parameters [String] :suburl URL appended to base_url of class
66
66
  # @option override_parameters [Hash] :q Query for REST
67
- # Following are for the body of the request
68
- # @option override_parameters [Hash] :body Hash to be converted to JSON in request body
69
- # @option override_parameters [String] :payload String to be passed directly in request body
70
- # @option override_parameters [String] :template_name Path to file to be read via ERB and passed in request body
67
+ # @option override_parameters [Hash] :params Extra parameters (E.g. headers)
71
68
  # @return [Exchange] Instance of Exchange class. Assertions are made by default on the response body
72
69
  def delete(params = {})
73
70
  perform_exchange_with(:delete, params)
@@ -6,13 +6,26 @@ module Soaspec
6
6
 
7
7
  # Handles logs of API requests and responses
8
8
  class SpecLogger
9
+ @traffic_folder = 'logs' # Folder to put API traffic logs
10
+
9
11
  class << self
12
+ # Folder to put API traffic logs
13
+ attr_accessor :traffic_folder
14
+
15
+ # @return [String] Traffic file to create logs at
16
+ def traffic_file
17
+ filename = "traffic_#{Time.now.strftime('%Y-%m-%d_%H_%M_%S')}.log"
18
+ File.join(traffic_folder, filename)
19
+ end
20
+
21
+ # Create new log file if necessary and setup logging level
22
+ # @return [Logger] Logger class to record API traffic
10
23
  def create
11
- unless File.exist?('logs/traffic.log')
12
- FileUtils.mkdir_p 'logs'
13
- FileUtils.touch File.join('logs', 'traffic.log')
24
+ unless File.exist?(traffic_file)
25
+ FileUtils.mkdir_p traffic_folder
26
+ FileUtils.touch traffic_file
14
27
  end
15
- @logger = Logger.new('logs/traffic.log') # Where request and responses of APIs are stored
28
+ @logger = Logger.new(traffic_file) # Where request and responses of APIs are stored
16
29
  @logger.level = Logger::DEBUG
17
30
  @logger
18
31
  end
@@ -1,3 +1,3 @@
1
1
  module Soaspec
2
- VERSION = '0.2.5'.freeze
2
+ VERSION = '0.2.7'.freeze
3
3
  end
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.5
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - SamuelGarrattIQA
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-12-04 00:00:00.000000000 Z
11
+ date: 2018-12-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler