Class: Auth0::Branding::Phone::Templates::Client
- Inherits:
-
Object
- Object
- Auth0::Branding::Phone::Templates::Client
- Defined in:
- lib/auth0/branding/phone/templates/client.rb
Instance Method Summary collapse
- #create(request_options: {}, **params) ⇒ Auth0::Types::CreatePhoneTemplateResponseContent
- #delete(request_options: {}, **params) ⇒ untyped
- #get(request_options: {}, **params) ⇒ Auth0::Types::GetPhoneTemplateResponseContent
- #initialize(client:) ⇒ void constructor
- #list(request_options: {}, **params) ⇒ Auth0::Types::ListPhoneTemplatesResponseContent
- #reset(request_options: {}, **params) ⇒ Auth0::Types::ResetPhoneTemplateResponseContent
- #test(request_options: {}, **params) ⇒ Auth0::Types::CreatePhoneTemplateTestNotificationResponseContent
- #update(request_options: {}, **params) ⇒ Auth0::Types::UpdatePhoneTemplateResponseContent
Constructor Details
#initialize(client:) ⇒ void
11 12 13 |
# File 'lib/auth0/branding/phone/templates/client.rb', line 11 def initialize(client:) @client = client end |
Instance Method Details
#create(request_options: {}, **params) ⇒ Auth0::Types::CreatePhoneTemplateResponseContent
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/auth0/branding/phone/templates/client.rb', line 66 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/phone/templates", body: Auth0::Branding::Phone::Templates::Types::CreatePhoneTemplateRequestContent.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::CreatePhoneTemplateResponseContent.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
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
# File 'lib/auth0/branding/phone/templates/client.rb', line 137 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/phone/templates/#{URI.encode_uri_component(params[: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::GetPhoneTemplateResponseContent
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/auth0/branding/phone/templates/client.rb', line 102 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/phone/templates/#{URI.encode_uri_component(params[: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::GetPhoneTemplateResponseContent.load(response.body)) else error_class = Auth0::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#list(request_options: {}, **params) ⇒ Auth0::Types::ListPhoneTemplatesResponseContent
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/auth0/branding/phone/templates/client.rb', line 28 def list(request_options: {}, **params) params = Auth0::Internal::Types::Utils.normalize_keys(params) query_params = {} query_params["disabled"] = params[:disabled] if params.key?(:disabled) request = Auth0::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "branding/phone/templates", query: query_params, 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::ListPhoneTemplatesResponseContent.load(response.body)) else error_class = Auth0::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#reset(request_options: {}, **params) ⇒ Auth0::Types::ResetPhoneTemplateResponseContent
215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 |
# File 'lib/auth0/branding/phone/templates/client.rb', line 215 def reset(request_options: {}, **params) params = Auth0::Internal::Types::Utils.normalize_keys(params) path_param_names = %i[id] body_params = params.except(*path_param_names) request = Auth0::Internal::JSON::Request.new( base_url: [:base_url], method: "PATCH", path: "branding/phone/templates/#{URI.encode_uri_component(params[:id].to_s)}/reset", body: body_params, 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::ResetPhoneTemplateResponseContent.load(response.body)) else error_class = Auth0::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#test(request_options: {}, **params) ⇒ Auth0::Types::CreatePhoneTemplateTestNotificationResponseContent
257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 |
# File 'lib/auth0/branding/phone/templates/client.rb', line 257 def test(request_options: {}, **params) params = Auth0::Internal::Types::Utils.normalize_keys(params) request_data = Auth0::Branding::Phone::Templates::Types::CreatePhoneTemplateTestNotificationRequestContent.new(params).to_h non_body_param_names = %w[id] body = request_data.except(*non_body_param_names) request = Auth0::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "branding/phone/templates/#{URI.encode_uri_component(params[:id].to_s)}/try", 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::CreatePhoneTemplateTestNotificationResponseContent.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::UpdatePhoneTemplateResponseContent
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 |
# File 'lib/auth0/branding/phone/templates/client.rb', line 170 def update(request_options: {}, **params) params = Auth0::Internal::Types::Utils.normalize_keys(params) request_data = Auth0::Branding::Phone::Templates::Types::UpdatePhoneTemplateRequestContent.new(params).to_h non_body_param_names = %w[id] body = request_data.except(*non_body_param_names) request = Auth0::Internal::JSON::Request.new( base_url: [:base_url], method: "PATCH", path: "branding/phone/templates/#{URI.encode_uri_component(params[: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::UpdatePhoneTemplateResponseContent.load(response.body)) else error_class = Auth0::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |