auth0 4.14.0 → 4.15.0

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: bc1dbd26961a59010e19ffa75076a5e28080735900aaaf4c9c8537656094809e
4
- data.tar.gz: 27520c6efd37f253b532d6521b5e46599d9a093dd46500d46997ff3e7f9030ad
3
+ metadata.gz: 7d5a0bd117bd194aa40c596db3da2cce8f1d73e155e725408fad834453b9c8bc
4
+ data.tar.gz: bb572e0e64599762214ea303a943dba8f0ac6685c9e2241a6a5381b9a63a8591
5
5
  SHA512:
6
- metadata.gz: a95ccde21a047bd9689f04cb972caf49d7a1cfb409bb72275b0bd0464d6c75f29d1ddb2475ec377b619230c71dfa13f08543557c33a8fc93f40521c322b190d7
7
- data.tar.gz: fe75df00376402b03ba921d0bd7bba8d1df3c725966f282bca92948ba18a7343a1c544edc2b722e98b963678d7469d884204e1579d3bf9056fa65574fd4df851
6
+ metadata.gz: 6905e324867b2d9f5127d05a2bbcbefb00f781bb472c572d0f81903aca19602676b22f05b5933d34364758b1cca72fde4b2ee3474c1299203e18a93e528f84e5
7
+ data.tar.gz: 441bfbbc17cbb148b11a11885f6fe41fd9157a93909b9cbb476aba5fde96419a89eb478d4ead1075d1689068164f4f26d509b0b5c6e8d15c6d6a44f9b1540f3d
@@ -1,5 +1,11 @@
1
1
  # Change Log
2
2
 
3
+ ## [v4.15.0](https://github.com/auth0/ruby-auth0/tree/v4.15.0) (2020-09-04)
4
+
5
+ **Added**
6
+
7
+ - Add log streaming endpoints [\#233](https://github.com/auth0/ruby-auth0/pull/233) ([davidpatrick](https://github.com/davidpatrick))
8
+
3
9
  ## [v4.14.0](https://github.com/auth0/ruby-auth0/tree/v4.14.0) (2020-07-20)
4
10
 
5
11
  [Full Changelog](https://github.com/auth0/ruby-auth0/compare/v4.13.0...v4.14.0)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- auth0 (4.14.0)
4
+ auth0 (4.15.0)
5
5
  jwt (~> 2.2.0)
6
6
  rest-client (~> 2.0.0)
7
7
  zache (~> 0.12.0)
@@ -32,13 +32,11 @@ GEM
32
32
  public_suffix (>= 2.0.2, < 5.0)
33
33
  ast (2.4.1)
34
34
  builder (3.2.4)
35
- codecov (0.2.2)
36
- colorize
35
+ codecov (0.2.9)
37
36
  json
38
37
  simplecov
39
38
  coderay (1.1.3)
40
- colorize (0.8.1)
41
- concurrent-ruby (1.1.6)
39
+ concurrent-ruby (1.1.7)
42
40
  coveralls (0.7.1)
43
41
  multi_json (~> 1.3)
44
42
  rest-client
@@ -82,23 +80,23 @@ GEM
82
80
  hashdiff (1.0.1)
83
81
  http-cookie (1.0.3)
84
82
  domain_name (~> 0.5)
85
- i18n (1.8.4)
83
+ i18n (1.8.5)
86
84
  concurrent-ruby (~> 1.0)
87
85
  json (2.3.1)
88
- jwt (2.2.1)
86
+ jwt (2.2.2)
89
87
  listen (3.2.1)
90
88
  rb-fsevent (~> 0.10, >= 0.10.3)
91
89
  rb-inotify (~> 0.9, >= 0.9.10)
92
- loofah (2.6.0)
90
+ loofah (2.7.0)
93
91
  crass (~> 1.0.2)
94
92
  nokogiri (>= 1.5.9)
95
- lumberjack (1.2.6)
93
+ lumberjack (1.2.8)
96
94
  method_source (0.8.2)
97
95
  mime-types (3.3.1)
98
96
  mime-types-data (~> 3.2015)
99
97
  mime-types-data (3.2020.0512)
100
98
  mini_portile2 (2.4.0)
101
- minitest (5.14.1)
99
+ minitest (5.14.2)
102
100
  multi_json (1.15.0)
103
101
  nenv (0.3.0)
104
102
  netrc (0.11.0)
@@ -116,7 +114,7 @@ GEM
116
114
  slop (~> 3.4)
117
115
  pry-nav (0.2.4)
118
116
  pry (>= 0.9.10, < 0.11.0)
119
- public_suffix (4.0.5)
117
+ public_suffix (4.0.6)
120
118
  rack (2.1.4)
121
119
  rack-test (0.8.3)
122
120
  rack (>= 1.0, < 3)
@@ -155,25 +153,25 @@ GEM
155
153
  diff-lcs (>= 1.2.0, < 2.0)
156
154
  rspec-support (~> 3.9.0)
157
155
  rspec-support (3.9.3)
158
- rubocop (0.88.0)
156
+ rubocop (0.90.0)
159
157
  parallel (~> 1.10)
160
158
  parser (>= 2.7.1.1)
161
159
  rainbow (>= 2.2.2, < 4.0)
162
160
  regexp_parser (>= 1.7)
163
161
  rexml
164
- rubocop-ast (>= 0.1.0, < 1.0)
162
+ rubocop-ast (>= 0.3.0, < 1.0)
165
163
  ruby-progressbar (~> 1.7)
166
164
  unicode-display_width (>= 1.4.0, < 2.0)
167
- rubocop-ast (0.2.0)
168
- parser (>= 2.7.0.1)
169
- rubocop-rails (2.7.0)
165
+ rubocop-ast (0.3.0)
166
+ parser (>= 2.7.1.4)
167
+ rubocop-rails (2.7.1)
170
168
  activesupport (>= 4.2.0)
171
169
  rack (>= 1.1)
172
170
  rubocop (>= 0.87.0)
173
171
  ruby-progressbar (1.10.1)
174
172
  safe_yaml (1.0.5)
175
173
  shellany (0.0.1)
176
- simplecov (0.18.5)
174
+ simplecov (0.19.0)
177
175
  docile (~> 1.1)
178
176
  simplecov-html (~> 0.11)
179
177
  simplecov-html (0.12.2)
@@ -16,6 +16,7 @@ require 'auth0/api/v2/user_blocks'
16
16
  require 'auth0/api/v2/tenants'
17
17
  require 'auth0/api/v2/tickets'
18
18
  require 'auth0/api/v2/logs'
19
+ require 'auth0/api/v2/log_streams'
19
20
  require 'auth0/api/v2/resource_servers'
20
21
  require 'auth0/api/v2/guardian'
21
22
 
@@ -41,6 +42,7 @@ module Auth0
41
42
  include Auth0::Api::V2::Tenants
42
43
  include Auth0::Api::V2::Tickets
43
44
  include Auth0::Api::V2::Logs
45
+ include Auth0::Api::V2::LogStreams
44
46
  include Auth0::Api::V2::ResourceServers
45
47
  include Auth0::Api::V2::Guardian
46
48
  end
@@ -0,0 +1,78 @@
1
+ module Auth0
2
+ module Api
3
+ module V2
4
+ # Methods to use the log streams endpoints
5
+ module LogStreams
6
+ attr_reader :log_streams_path
7
+
8
+ # Retrieves a list of all log streams.
9
+ # @see https://auth0.com/docs/api/management/v2#!/Log_Streams/get_log_streams
10
+ # @return [json] Returns the log streams.
11
+ def log_streams()
12
+ get(log_streams_path)
13
+ end
14
+ alias get_log_streams log_streams
15
+
16
+ # Retrieves a log stream by its ID.
17
+ # @see https://auth0.com/docs/api/management/v2#!/Log_Streams/get_log_streams_by_id
18
+ # @param id [string] The id of the log stream to retrieve.
19
+ #
20
+ # @return [json] Returns the log stream.
21
+ def log_stream(id)
22
+ raise Auth0::InvalidParameter, 'Must supply a valid log stream id' if id.to_s.empty?
23
+ path = "#{log_streams_path}/#{id}"
24
+ get(path)
25
+ end
26
+ alias get_log_stream log_stream
27
+
28
+ # Creates a new log stream according to the JSON object received in body.
29
+ # @see https://auth0.com/docs/api/management/v2#!/Log_Streams/post_log_streams
30
+ # @param name [string] The name of the log stream.
31
+ # @param type [string] The type of log stream
32
+ # @param options [hash] The Hash options used to define the log streams's properties.
33
+ #
34
+ # @return [json] Returns the log stream.
35
+ def create_log_stream(name, type, options)
36
+ raise Auth0::InvalidParameter, 'Name must contain at least one character' if name.to_s.empty?
37
+ raise Auth0::InvalidParameter, 'Must specify a valid type' if type.to_s.empty?
38
+ raise Auth0::InvalidParameter, 'Must supply a valid hash for options' unless options.is_a? Hash
39
+
40
+ request_params = {}
41
+ request_params[:name] = name
42
+ request_params[:type] = type
43
+ request_params[:sink] = options
44
+ post(log_streams_path, request_params)
45
+ end
46
+
47
+ # Deletes a log stream by its ID.
48
+ # @see https://auth0.com/docs/api/management/v2#!/Log_Streams/delete_log_streams_by_id
49
+ # @param id [string] The id of the log stream to delete.
50
+ def delete_log_stream(id)
51
+ raise Auth0::InvalidParameter, 'Must supply a valid log stream id' if id.to_s.empty?
52
+ path = "#{log_streams_path}/#{id}"
53
+ delete(path)
54
+ end
55
+
56
+ # Updates a log stream.
57
+ # @see https://auth0.com/docs/api/management/v2#!/Log_Streams/patch_log_streams_by_id
58
+ # @param id [string] The id or audience of the log stream to update.
59
+ # @param status [string] The Hash options used to define the log streams's properties.
60
+ def patch_log_stream(id, status)
61
+ raise Auth0::InvalidParameter, 'Must specify a log stream id' if id.to_s.empty?
62
+ raise Auth0::InvalidParameter, 'Must specify a valid status' if status.to_s.empty?
63
+
64
+ request_params = {}
65
+ request_params[:status] = status
66
+ path = "#{log_streams_path}/#{id}"
67
+ patch(path, request_params)
68
+ end
69
+
70
+ private
71
+ # Log Streams API path
72
+ def log_streams_path
73
+ @log_streams_path ||= '/api/v2/log-streams'
74
+ end
75
+ end
76
+ end
77
+ end
78
+ end
@@ -1,4 +1,4 @@
1
1
  # current version of gem
2
2
  module Auth0
3
- VERSION = '4.14.0'.freeze
3
+ VERSION = '4.15.0'.freeze
4
4
  end
@@ -0,0 +1,84 @@
1
+ require 'spec_helper'
2
+ describe Auth0::Api::V2::LogStreams do
3
+ before :all do
4
+ dummy_instance = DummyClass.new
5
+ dummy_instance.extend(Auth0::Api::V2::LogStreams)
6
+ dummy_instance.extend(Auth0::Mixins::Initializer)
7
+ @instance = dummy_instance
8
+ end
9
+
10
+ context '.log_streams' do
11
+ it { expect(@instance).to respond_to(:log_streams) }
12
+ it { expect(@instance).to respond_to(:get_log_streams) }
13
+ it 'is expected to call get /api/v2/log-streams' do
14
+ expect(@instance).to receive(:get).with(
15
+ '/api/v2/log-streams'
16
+ )
17
+ expect { @instance.log_streams }.not_to raise_error
18
+ end
19
+ end
20
+
21
+ context '.log_stream' do
22
+ it { expect(@instance).to respond_to(:log_stream) }
23
+ it 'is expected to call get /api/v2/log-streams/test' do
24
+ expect(@instance).to receive(:get).with('/api/v2/log-streams/test')
25
+ expect { @instance.log_stream('test') }.not_to raise_error
26
+ end
27
+ it 'expect to raise an error when calling with empty log stream id' do
28
+ expect { @instance.log_stream(nil) }.to raise_error 'Must supply a valid log stream id'
29
+ end
30
+ end
31
+
32
+ context '.create_log_stream' do
33
+ it { expect(@instance).to respond_to(:create_log_stream) }
34
+ it 'is expected to call post /api/v2/log-streams' do
35
+ expect(@instance).to receive(:post).with(
36
+ '/api/v2/log-streams',
37
+ name: 'test',
38
+ type: 'https',
39
+ sink: {
40
+ httpEndpoint: "https://mycompany.com",
41
+ httpContentType: "string",
42
+ httpContentFormat: "JSONLINES",
43
+ httpAuthorization: "string"
44
+ }
45
+ )
46
+
47
+ @instance.create_log_stream('test', 'https',
48
+ httpEndpoint: "https://mycompany.com",
49
+ httpContentType: "string",
50
+ httpContentFormat: "JSONLINES",
51
+ httpAuthorization: "string")
52
+ end
53
+ it 'expect to raise an error when calling with empty name' do
54
+ expect { @instance.create_log_stream('', '', '') }.to raise_error 'Name must contain at least one character'
55
+ end
56
+ it 'expect to raise an error when calling with empty type' do
57
+ expect { @instance.create_log_stream('name', '', '') }.to raise_error 'Must specify a valid type'
58
+ end
59
+ it 'expect to raise an error when calling without options' do
60
+ expect { @instance.create_log_stream('name', 'https', nil) }.to raise_error 'Must supply a valid hash for options'
61
+ end
62
+ end
63
+
64
+ context '.delete_log_stream' do
65
+ it { expect(@instance).to respond_to(:delete_log_stream) }
66
+ it 'is expected to call delete /api/v2/log-streams/test' do
67
+ expect(@instance).to receive(:delete).with('/api/v2/log-streams/test')
68
+ expect { @instance.delete_log_stream('test') }.not_to raise_error
69
+ end
70
+ it 'expect to raise an error when calling with empty log stream id' do
71
+ expect { @instance.delete_log_stream(nil) }.to raise_error 'Must supply a valid log stream id'
72
+ end
73
+ end
74
+
75
+ context '.patch_log_stream' do
76
+ it { expect(@instance).to respond_to(:patch_log_stream) }
77
+ it 'is expected to send patch to /api/v2/log_streams/test' do
78
+ expect(@instance).to receive(:patch).with('/api/v2/log-streams/test', status: 'paused')
79
+ expect { @instance.patch_log_stream('test', 'paused') }.not_to raise_error
80
+ end
81
+ it { expect { @instance.patch_log_stream('', nil) }.to raise_error 'Must specify a log stream id' }
82
+ it { expect { @instance.patch_log_stream('test', nil) }.to raise_error 'Must specify a valid status' }
83
+ end
84
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: auth0
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.14.0
4
+ version: 4.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Auth0
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2020-07-22 00:00:00.000000000 Z
14
+ date: 2020-09-03 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rest-client
@@ -143,22 +143,22 @@ dependencies:
143
143
  name: rspec
144
144
  requirement: !ruby/object:Gem::Requirement
145
145
  requirements:
146
- - - ">="
147
- - !ruby/object:Gem::Version
148
- version: 3.1.0
149
146
  - - "~>"
150
147
  - !ruby/object:Gem::Version
151
148
  version: '3.1'
149
+ - - ">="
150
+ - !ruby/object:Gem::Version
151
+ version: 3.1.0
152
152
  type: :development
153
153
  prerelease: false
154
154
  version_requirements: !ruby/object:Gem::Requirement
155
155
  requirements:
156
- - - ">="
157
- - !ruby/object:Gem::Version
158
- version: 3.1.0
159
156
  - - "~>"
160
157
  - !ruby/object:Gem::Version
161
158
  version: '3.1'
159
+ - - ">="
160
+ - !ruby/object:Gem::Version
161
+ version: 3.1.0
162
162
  - !ruby/object:Gem::Dependency
163
163
  name: rack-test
164
164
  requirement: !ruby/object:Gem::Requirement
@@ -368,6 +368,7 @@ files:
368
368
  - lib/auth0/api/v2/emails.rb
369
369
  - lib/auth0/api/v2/guardian.rb
370
370
  - lib/auth0/api/v2/jobs.rb
371
+ - lib/auth0/api/v2/log_streams.rb
371
372
  - lib/auth0/api/v2/logs.rb
372
373
  - lib/auth0/api/v2/prompts.rb
373
374
  - lib/auth0/api/v2/resource_servers.rb
@@ -589,6 +590,7 @@ files:
589
590
  - spec/lib/auth0/api/v2/emails_spec.rb
590
591
  - spec/lib/auth0/api/v2/guardian_spec.rb
591
592
  - spec/lib/auth0/api/v2/jobs_spec.rb
593
+ - spec/lib/auth0/api/v2/log_streams_spec.rb
592
594
  - spec/lib/auth0/api/v2/logs_spec.rb
593
595
  - spec/lib/auth0/api/v2/prompts_spec.rb
594
596
  - spec/lib/auth0/api/v2/resource_servers_spec.rb
@@ -630,7 +632,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
630
632
  - !ruby/object:Gem::Version
631
633
  version: '0'
632
634
  requirements: []
633
- rubygems_version: 3.0.1
635
+ rubygems_version: 3.1.2
634
636
  signing_key:
635
637
  specification_version: 4
636
638
  summary: Auth0 API Client
@@ -832,6 +834,7 @@ test_files:
832
834
  - spec/lib/auth0/api/v2/emails_spec.rb
833
835
  - spec/lib/auth0/api/v2/guardian_spec.rb
834
836
  - spec/lib/auth0/api/v2/jobs_spec.rb
837
+ - spec/lib/auth0/api/v2/log_streams_spec.rb
835
838
  - spec/lib/auth0/api/v2/logs_spec.rb
836
839
  - spec/lib/auth0/api/v2/prompts_spec.rb
837
840
  - spec/lib/auth0/api/v2/resource_servers_spec.rb