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.
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/auth0/branding/themes/client.rb', line 99 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) (response.body.to_s.empty? ? nil : 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.
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 |
# File 'lib/auth0/branding/themes/client.rb', line 209 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.
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 |
# File 'lib/auth0/branding/themes/client.rb', line 172 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) (response.body.to_s.empty? ? nil : 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.
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
# File 'lib/auth0/branding/themes/client.rb', line 136 def get_default(request_options: {}, **_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) (response.body.to_s.empty? ? nil : 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.
316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 |
# File 'lib/auth0/branding/themes/client.rb', line 316 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 = %w[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) (response.body.to_s.empty? ? nil : 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 |