auth0 4.12.0 → 4.13.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5aa06f59c1696dbadf9345ff1843f247ca305fd5340d84b75252fe5bd465d27a
4
- data.tar.gz: dd3d9c156870dcf9b50a48870aab8a6b44c67b560835de6b52222f217718a5b1
3
+ metadata.gz: c38a319b2eed5120bf74fa4c97ec09cc2f445995216a47e455fddf721b320af3
4
+ data.tar.gz: 025013d61adde5fa27095f50978601851304f3ccd9db40a8826e8a3c0e0857da
5
5
  SHA512:
6
- metadata.gz: 8369176c7e8b3dcf740aa144650d345c4c5803e8718764d278591e13b72327c0cb6bae1b2dde710b48fe0c31991433d0433cbac9a422cbea58359abb0b986764
7
- data.tar.gz: 5ff4c3af66bc7cd480808c98158f1a039eb765eed10ffa19d8a1c5c7bf4c9c8bdc20d8b535dd7ea5efcf934b64e8ffbd3395480b1925b33a8a6aba7550afdaf7
6
+ metadata.gz: 324b485bfdf6d0043aa0344a0f8dfe296edac94dc6ce8ef86a89cd8993a5e7ae3c558051475bd192b9ea8846597f427c7a2b2c8f39c885ac7eb516fd5032fa45
7
+ data.tar.gz: 20eaf5dfe12c4006df1d0746a1ab60143d465a7c39e123a357d614a8717c403dd3ee83d8251012d683a43606a3f5af92a76dc65a1aaf9fb39005de613bac134f
@@ -1,5 +1,17 @@
1
1
  # Change Log
2
2
 
3
+ ## [v4.13.0](https://github.com/auth0/ruby-auth0/tree/v4.13.0) (2020-06-18)
4
+
5
+ [Full Changelog](https://github.com/auth0/ruby-auth0/compare/v4.12.0...v4.13.0)
6
+
7
+ **Added**
8
+
9
+ - Add prompts endpoints [\#205](https://github.com/auth0/ruby-auth0/pull/205) ([unhappychoice](https://github.com/unhappychoice))
10
+
11
+ **Fixed**
12
+
13
+ - Fix missing to_json [\#212](https://github.com/auth0/ruby-auth0/pull/212) ([qortex](https://github.com/qortex))
14
+
3
15
  ## [v4.12.0](https://github.com/auth0/ruby-auth0/tree/v4.12.0) (2020-06-10)
4
16
 
5
17
  [Full Changelog](https://github.com/auth0/ruby-auth0/compare/v4.11.0...v4.12.0)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- auth0 (4.12.0)
4
+ auth0 (4.13.0)
5
5
  jwt (~> 2.2.0)
6
6
  rest-client (~> 2.0.0)
7
7
  zache (~> 0.12.0)
@@ -9,20 +9,20 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- actionpack (6.0.3.1)
13
- actionview (= 6.0.3.1)
14
- activesupport (= 6.0.3.1)
12
+ actionpack (6.0.3.2)
13
+ actionview (= 6.0.3.2)
14
+ activesupport (= 6.0.3.2)
15
15
  rack (~> 2.0, >= 2.0.8)
16
16
  rack-test (>= 0.6.3)
17
17
  rails-dom-testing (~> 2.0)
18
18
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
19
- actionview (6.0.3.1)
20
- activesupport (= 6.0.3.1)
19
+ actionview (6.0.3.2)
20
+ activesupport (= 6.0.3.2)
21
21
  builder (~> 3.1)
22
22
  erubi (~> 1.4)
23
23
  rails-dom-testing (~> 2.0)
24
24
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
25
- activesupport (6.0.3.1)
25
+ activesupport (6.0.3.2)
26
26
  concurrent-ruby (~> 1.0, >= 1.0.2)
27
27
  i18n (>= 0.7, < 2)
28
28
  minitest (~> 5.1)
@@ -88,7 +88,7 @@ GEM
88
88
  listen (3.2.1)
89
89
  rb-fsevent (~> 0.10, >= 0.10.3)
90
90
  rb-inotify (~> 0.9, >= 0.9.10)
91
- loofah (2.5.0)
91
+ loofah (2.6.0)
92
92
  crass (~> 1.0.2)
93
93
  nokogiri (>= 1.5.9)
94
94
  lumberjack (1.2.5)
@@ -106,7 +106,7 @@ GEM
106
106
  notiffany (0.1.3)
107
107
  nenv (~> 0.1)
108
108
  shellany (~> 0.0)
109
- parallel (1.19.1)
109
+ parallel (1.19.2)
110
110
  parser (2.7.1.3)
111
111
  ast (~> 2.4.0)
112
112
  pry (0.10.4)
@@ -116,7 +116,7 @@ GEM
116
116
  pry-nav (0.2.4)
117
117
  pry (>= 0.9.10, < 0.11.0)
118
118
  public_suffix (4.0.5)
119
- rack (2.1.3)
119
+ rack (2.1.4)
120
120
  rack-test (0.8.3)
121
121
  rack (>= 1.0, < 3)
122
122
  rails-dom-testing (2.0.3)
@@ -124,9 +124,9 @@ GEM
124
124
  nokogiri (>= 1.6)
125
125
  rails-html-sanitizer (1.3.0)
126
126
  loofah (~> 2.3)
127
- railties (6.0.3.1)
128
- actionpack (= 6.0.3.1)
129
- activesupport (= 6.0.3.1)
127
+ railties (6.0.3.2)
128
+ actionpack (= 6.0.3.2)
129
+ activesupport (= 6.0.3.2)
130
130
  method_source
131
131
  rake (>= 0.8.7)
132
132
  thor (>= 0.20.3, < 2.0)
@@ -6,6 +6,7 @@ require 'auth0/api/v2/connections'
6
6
  require 'auth0/api/v2/device_credentials'
7
7
  require 'auth0/api/v2/emails'
8
8
  require 'auth0/api/v2/jobs'
9
+ require 'auth0/api/v2/prompts'
9
10
  require 'auth0/api/v2/rules'
10
11
  require 'auth0/api/v2/roles'
11
12
  require 'auth0/api/v2/stats'
@@ -30,6 +31,7 @@ module Auth0
30
31
  include Auth0::Api::V2::DeviceCredentials
31
32
  include Auth0::Api::V2::Emails
32
33
  include Auth0::Api::V2::Jobs
34
+ include Auth0::Api::V2::Prompts
33
35
  include Auth0::Api::V2::Rules
34
36
  include Auth0::Api::V2::Roles
35
37
  include Auth0::Api::V2::Stats
@@ -0,0 +1,70 @@
1
+ module Auth0
2
+ module Api
3
+ module V2
4
+ module Prompts
5
+ attr_reader :prompts_path
6
+
7
+ # Get prompts settings.
8
+ # @see https://auth0.com/docs/api/management/v2#!/Prompts/get_prompts
9
+ # @return [json] Returns the prompts setting.
10
+ def prompts
11
+ get(prompts_path)
12
+ end
13
+ alias get_prompts prompts
14
+
15
+ # Update prompts settings.
16
+ # @see https://auth0.com/docs/api/management/v2#!/Prompts/patch_prompts
17
+ # @param options [hash]
18
+ # * :universal_login_experience [string] Should be any of: new, classic.
19
+ #
20
+ # @return [json] Returns the prompts settings.
21
+ def patch_prompts(options = {})
22
+ request_params = {
23
+ universal_login_experience: options.fetch(:universal_login_experience, nil)
24
+ }
25
+ patch(prompts_path, request_params)
26
+ end
27
+ alias update_prompts patch_prompts
28
+
29
+ # Get custom text for a prompt
30
+ # Retrieve custom text for a specific prompt and language.
31
+ # @see https://auth0.com/docs/api/management/v2#!/Prompts/get_custom_text_by_language
32
+ # @param prompt [string] Prompt of custom texts to update.
33
+ # @param language [string] Language of custom texts to update.
34
+ #
35
+ # @return [json] Returns the custom texts.
36
+ def custom_text(prompt, language)
37
+ raise Auth0::InvalidParameter, 'Must supply a valid prompt' if prompt.to_s.empty?
38
+ raise Auth0::InvalidParameter, 'Must supply a valid language' if language.to_s.empty?
39
+
40
+ path = "#{prompts_path}/#{prompt}/custom-text/#{language}"
41
+ get(path)
42
+ end
43
+ alias get_custom_text custom_text
44
+
45
+ # Set custom text for a specific prompt
46
+ # Existing texts will be overwritten.
47
+ # @see https://auth0.com/docs/api/management/v2#!/Prompts/put_custom_text_by_language
48
+ # @param prompt [string] Prompt of custom texts to update.
49
+ # @param language [string] Language of custom texts to update.
50
+ # @param body [hash] Custom texts.
51
+ #
52
+ # @return [json] Returns the custom texts.
53
+ def put_custom_text(prompt, language, body)
54
+ raise Auth0::InvalidParameter, 'Must supply a valid prompt' if prompt.to_s.empty?
55
+ raise Auth0::InvalidParameter, 'Must supply a valid language' if language.to_s.empty?
56
+
57
+ path = "#{prompts_path}/#{prompt}/custom-text/#{language}"
58
+ put(path, body)
59
+ end
60
+ alias update_custom_text put_custom_text
61
+
62
+ private
63
+
64
+ def prompts_path
65
+ @prompts_path ||= '/api/v2/prompts'
66
+ end
67
+ end
68
+ end
69
+ end
70
+ end
@@ -21,7 +21,7 @@ module Auth0
21
21
  elsif method == :delete
22
22
  call(:delete, url(safe_path), timeout, add_headers({params: body}))
23
23
  elsif method == :delete_with_body
24
- call(:delete, url(safe_path), timeout, headers, body)
24
+ call(:delete, url(safe_path), timeout, headers, body.to_json)
25
25
  elsif method == :post_file
26
26
  body.merge!(multipart: true)
27
27
  call(:post, url(safe_path), timeout, headers, body)
@@ -1,4 +1,4 @@
1
1
  # current version of gem
2
2
  module Auth0
3
- VERSION = '4.12.0'.freeze
3
+ VERSION = '4.13.0'.freeze
4
4
  end
@@ -0,0 +1,88 @@
1
+ require 'spec_helper'
2
+ describe Auth0::Api::V2::Prompts do
3
+ before :all do
4
+ dummy_instance = DummyClass.new
5
+ dummy_instance.extend(Auth0::Api::V2::Prompts)
6
+ @instance = dummy_instance
7
+ end
8
+
9
+ context '.prompts' do
10
+ it 'is expected to respond to a prompts method' do
11
+ expect(@instance).to respond_to(:prompts)
12
+ end
13
+
14
+ it 'is expected to respond to a get_prompts method' do
15
+ expect(@instance).to respond_to(:get_prompts)
16
+ end
17
+
18
+ it 'is expected to get /api/v2/prompts' do
19
+ expect(@instance).to receive(:get).with('/api/v2/prompts')
20
+
21
+ expect { @instance.prompts }.not_to raise_error
22
+ end
23
+ end
24
+
25
+ context '.update_prompts' do
26
+ it 'is expected to respond to an update_prompts method' do
27
+ expect(@instance).to respond_to(:update_prompts)
28
+ end
29
+
30
+ it 'is expected to respond to a patch_prompts method' do
31
+ expect(@instance).to respond_to(:patch_prompts)
32
+ end
33
+
34
+ it 'is expected to call patch /api/v2/prompts' do
35
+ expect(@instance).to receive(:patch).with('/api/v2/prompts', { universal_login_experience: 'new' })
36
+
37
+ expect { @instance.update_prompts(universal_login_experience: 'new') }.not_to raise_error
38
+ end
39
+ end
40
+
41
+ context '.custom_text' do
42
+ it 'is expected to respond to a custom_text method' do
43
+ expect(@instance).to respond_to(:custom_text)
44
+ end
45
+
46
+ it 'is expected to respond to a get_custom_text method' do
47
+ expect(@instance).to respond_to(:get_custom_text)
48
+ end
49
+
50
+ it 'is expected to get /api/v2/prompts/PROMPT_NAME/language/LANGUAGE' do
51
+ expect(@instance).to receive(:get).with('/api/v2/prompts/PROMPT_NAME/custom-text/LANGUAGE')
52
+
53
+ expect { @instance.custom_text('PROMPT_NAME', 'LANGUAGE') }.not_to raise_error
54
+ end
55
+
56
+ it 'is expected to raise an exception when the prompt is empty' do
57
+ expect { @instance.custom_text(nil, 'language') }.to raise_exception(Auth0::InvalidParameter)
58
+ end
59
+
60
+ it 'is expected to raise an exception when the language is empty' do
61
+ expect { @instance.custom_text('prompt_name', nil) }.to raise_exception(Auth0::InvalidParameter)
62
+ end
63
+ end
64
+
65
+ context '.update_custom_text' do
66
+ it 'is expected to respond to an update_custom_text method' do
67
+ expect(@instance).to respond_to(:update_custom_text)
68
+ end
69
+
70
+ it 'is expected to respond to a put_custom_text method' do
71
+ expect(@instance).to respond_to(:put_custom_text)
72
+ end
73
+
74
+ it 'is expected to call put /api/v2/prompts/PROMPT_NAME/language/LANGUAGE' do
75
+ expect(@instance).to receive(:put).with('/api/v2/prompts/PROMPT_NAME/custom-text/LANGUAGE', 'BODY')
76
+
77
+ expect { @instance.update_custom_text('PROMPT_NAME', 'LANGUAGE', 'BODY') }.not_to raise_error
78
+ end
79
+
80
+ it 'is expected to raise an exception when the prompt is empty' do
81
+ expect { @instance.update_custom_text(nil,'language', 'BODY') }.to raise_exception(Auth0::InvalidParameter)
82
+ end
83
+
84
+ it 'is expected to raise an exception when the language is empty' do
85
+ expect { @instance.update_custom_text('prompt_name', nil, 'BODY') }.to raise_exception(Auth0::InvalidParameter)
86
+ end
87
+ end
88
+ 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.12.0
4
+ version: 4.13.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-06-11 00:00:00.000000000 Z
14
+ date: 2020-06-19 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rest-client
@@ -369,6 +369,7 @@ files:
369
369
  - lib/auth0/api/v2/guardian.rb
370
370
  - lib/auth0/api/v2/jobs.rb
371
371
  - lib/auth0/api/v2/logs.rb
372
+ - lib/auth0/api/v2/prompts.rb
372
373
  - lib/auth0/api/v2/resource_servers.rb
373
374
  - lib/auth0/api/v2/roles.rb
374
375
  - lib/auth0/api/v2/rules.rb
@@ -589,6 +590,7 @@ files:
589
590
  - spec/lib/auth0/api/v2/guardian_spec.rb
590
591
  - spec/lib/auth0/api/v2/jobs_spec.rb
591
592
  - spec/lib/auth0/api/v2/logs_spec.rb
593
+ - spec/lib/auth0/api/v2/prompts_spec.rb
592
594
  - spec/lib/auth0/api/v2/resource_servers_spec.rb
593
595
  - spec/lib/auth0/api/v2/roles_spec.rb
594
596
  - spec/lib/auth0/api/v2/rules_spec.rb
@@ -831,6 +833,7 @@ test_files:
831
833
  - spec/lib/auth0/api/v2/guardian_spec.rb
832
834
  - spec/lib/auth0/api/v2/jobs_spec.rb
833
835
  - spec/lib/auth0/api/v2/logs_spec.rb
836
+ - spec/lib/auth0/api/v2/prompts_spec.rb
834
837
  - spec/lib/auth0/api/v2/resource_servers_spec.rb
835
838
  - spec/lib/auth0/api/v2/roles_spec.rb
836
839
  - spec/lib/auth0/api/v2/rules_spec.rb