Class: NewStoreApi::IdentityProvidersController

Inherits:
BaseController show all
Defined in:
lib/new_store_api/controllers/identity_providers_controller.rb

Overview

IdentityProvidersController

Constant Summary

Constants inherited from BaseController

BaseController::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseController

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseController

#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent

Constructor Details

This class inherits a constructor from NewStoreApi::BaseController

Instance Method Details

#create_provider(body) ⇒ IdentityProvidersResponse

Creates and configures a new identity provider for the vendor / protocol combination. configuration

Parameters:

Returns:



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/new_store_api/controllers/identity_providers_controller.rb', line 29

def create_provider(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/iam/providers',
                                 Server::API)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('oauth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(IdentityProvidersResponse.method(:from_hash)))
    .execute
end

#destroy_provider(malias) ⇒ void

This method returns an undefined value.

Deletes the identity provider identified by its alias

Parameters:

  • malias (String)

    Required parameter: identity provider alias



48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/new_store_api/controllers/identity_providers_controller.rb', line 48

def destroy_provider(malias)
  @api_call
    .request(new_request_builder(HttpMethodEnum::DELETE,
                                 '/iam/providers/{alias}',
                                 Server::API)
               .template_param(new_parameter(malias, key: 'alias')
                                .should_encode(true))
               .auth(Single.new('oauth')))
    .response(new_response_handler
                .is_response_void(true))
    .execute
end

#list_providersIdentityProvidersResponse

Returns a list of configured identity providers for the tenant

Returns:



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/new_store_api/controllers/identity_providers_controller.rb', line 11

def list_providers
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/iam/providers',
                                 Server::API)
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('oauth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(IdentityProvidersResponse.method(:from_hash)))
    .execute
end

#list_supported_providersSupportedIdentityProviders

Returns a list of supported identity providers and protocols

Returns:



105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/new_store_api/controllers/identity_providers_controller.rb', line 105

def list_supported_providers
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/iam/supported-providers',
                                 Server::API)
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('oauth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(SupportedIdentityProviders.method(:from_hash)))
    .execute
end

#show_provider(malias) ⇒ IdentityProviderResponse

Returns the identity provider identified by its alias

Parameters:

  • malias (String)

    Required parameter: identity provider alias

Returns:



64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/new_store_api/controllers/identity_providers_controller.rb', line 64

def show_provider(malias)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/iam/providers/{alias}',
                                 Server::API)
               .template_param(new_parameter(malias, key: 'alias')
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('oauth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(IdentityProviderResponse.method(:from_hash)))
    .execute
end

#update_provider(malias, body) ⇒ IdentityProviderResponse

Change the configuration of the identity provider identified by its alias configuration

Parameters:

Returns:



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/new_store_api/controllers/identity_providers_controller.rb', line 84

def update_provider(malias,
                    body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::PATCH,
                                 '/iam/providers/{alias}',
                                 Server::API)
               .template_param(new_parameter(malias, key: 'alias')
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('oauth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(IdentityProviderResponse.method(:from_hash)))
    .execute
end