Class: Auth0::Branding::Themes::Client
- Inherits:
-
Object
- Object
- Auth0::Branding::Themes::Client
- Defined in:
- lib/auth0/branding/themes/client.rb
Instance Method Summary collapse
-
#create(request_options: {}, **params) ⇒ Auth0::Types::CreateBrandingThemeResponseContent
Create branding theme.
-
#delete(request_options: {}, **params) ⇒ untyped
Delete branding theme.
-
#get(request_options: {}, **params) ⇒ Auth0::Types::GetBrandingThemeResponseContent
Retrieve branding theme.
-
#get_default(request_options: {}, **params) ⇒ Auth0::Types::GetBrandingDefaultThemeResponseContent
Retrieve default branding theme.
- #initialize(client:) ⇒ void constructor
-
#update(request_options: {}, **params) ⇒ Auth0::Types::UpdateBrandingThemeResponseContent
Update branding theme.
Constructor Details
#initialize(client:) ⇒ void
10 11 12 |
# File 'lib/auth0/branding/themes/client.rb', line 10 def initialize(client:) @client = client end |
Instance Method Details
#create(request_options: {}, **params) ⇒ Auth0::Types::CreateBrandingThemeResponseContent
Create branding theme.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/auth0/branding/themes/client.rb', line 25 def create(request_options: {}, **params) params = Auth0::Internal::Types::Utils.normalize_keys(params) request = Auth0::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "branding/themes", body: Auth0::Branding::Themes::Types::CreateBrandingThemeRequestContent.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Auth0::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Auth0::Types::CreateBrandingThemeResponseContent.load(response.body) else error_class = Auth0::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#delete(request_options: {}, **params) ⇒ untyped
Delete branding theme.
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
# File 'lib/auth0/branding/themes/client.rb', line 127 def delete(request_options: {}, **params) params = Auth0::Internal::Types::Utils.normalize_keys(params) request = Auth0::Internal::JSON::Request.new( base_url: [:base_url], method: "DELETE", path: "branding/themes/#{URI.encode_uri_component(params[:theme_id].to_s)}", request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Auth0::Errors::TimeoutError end code = response.code.to_i return if code.between?(200, 299) error_class = Auth0::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end |
#get(request_options: {}, **params) ⇒ Auth0::Types::GetBrandingThemeResponseContent
Retrieve branding theme.
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/auth0/branding/themes/client.rb', line 93 def get(request_options: {}, **params) params = Auth0::Internal::Types::Utils.normalize_keys(params) request = Auth0::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "branding/themes/#{URI.encode_uri_component(params[:theme_id].to_s)}", request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Auth0::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Auth0::Types::GetBrandingThemeResponseContent.load(response.body) else error_class = Auth0::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#get_default(request_options: {}, **params) ⇒ Auth0::Types::GetBrandingDefaultThemeResponseContent
Retrieve default branding theme.
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/auth0/branding/themes/client.rb', line 59 def get_default(request_options: {}, **params) Auth0::Internal::Types::Utils.normalize_keys(params) request = Auth0::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "branding/themes/default", request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Auth0::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Auth0::Types::GetBrandingDefaultThemeResponseContent.load(response.body) else error_class = Auth0::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#update(request_options: {}, **params) ⇒ Auth0::Types::UpdateBrandingThemeResponseContent
Update branding theme.
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
# File 'lib/auth0/branding/themes/client.rb', line 159 def update(request_options: {}, **params) params = Auth0::Internal::Types::Utils.normalize_keys(params) request_data = Auth0::Branding::Themes::Types::UpdateBrandingThemeRequestContent.new(params).to_h non_body_param_names = ["themeId"] body = request_data.except(*non_body_param_names) request = Auth0::Internal::JSON::Request.new( base_url: [:base_url], method: "PATCH", path: "branding/themes/#{URI.encode_uri_component(params[:theme_id].to_s)}", body: body, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Auth0::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Auth0::Types::UpdateBrandingThemeResponseContent.load(response.body) else error_class = Auth0::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |