Class: MailSlurpClient::OAuthConnectionApi

Inherits:
Object
  • Object
show all
Defined in:
lib/mailslurp_client/api/o_auth_connection_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ OAuthConnectionApi

Returns a new instance of OAuthConnectionApi.



19
20
21
# File 'lib/mailslurp_client/api/o_auth_connection_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/mailslurp_client/api/o_auth_connection_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#create_o_auth_connection(redirect_base, o_auth_connection_type, opts = {}) ⇒ CreateOAuthConnectionResult

Create an OAuth connection Configure an inbox for OAuth sync with MailSlurp

Parameters:

  • redirect_base (String)
  • o_auth_connection_type (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :email_address (String)

Returns:



29
30
31
32
# File 'lib/mailslurp_client/api/o_auth_connection_api.rb', line 29

def create_o_auth_connection(redirect_base, o_auth_connection_type, opts = {})
  data, _status_code, _headers = create_o_auth_connection_with_http_info(redirect_base, o_auth_connection_type, opts)
  data
end

#create_o_auth_connection_with_http_info(redirect_base, o_auth_connection_type, opts = {}) ⇒ Array<(CreateOAuthConnectionResult, Integer, Hash)>

Create an OAuth connection Configure an inbox for OAuth sync with MailSlurp

Parameters:

  • redirect_base (String)
  • o_auth_connection_type (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :email_address (String)

Returns:

  • (Array<(CreateOAuthConnectionResult, Integer, Hash)>)

    CreateOAuthConnectionResult data, response status code and response headers



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/mailslurp_client/api/o_auth_connection_api.rb', line 41

def create_o_auth_connection_with_http_info(redirect_base, o_auth_connection_type, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: OAuthConnectionApi.create_o_auth_connection ...'
  end
  # verify the required parameter 'redirect_base' is set
  if @api_client.config.client_side_validation && redirect_base.nil?
    fail ArgumentError, "Missing the required parameter 'redirect_base' when calling OAuthConnectionApi.create_o_auth_connection"
  end
  # verify the required parameter 'o_auth_connection_type' is set
  if @api_client.config.client_side_validation && o_auth_connection_type.nil?
    fail ArgumentError, "Missing the required parameter 'o_auth_connection_type' when calling OAuthConnectionApi.create_o_auth_connection"
  end
  # verify enum value
  allowable_values = ["GOOGLE", "MICROSOFT"]
  if @api_client.config.client_side_validation && !allowable_values.include?(o_auth_connection_type)
    fail ArgumentError, "invalid value for \"o_auth_connection_type\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/oauth-connection'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'redirectBase'] = redirect_base
  query_params[:'oAuthConnectionType'] = o_auth_connection_type
  query_params[:'emailAddress'] = opts[:'email_address'] if !opts[:'email_address'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['*/*'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'CreateOAuthConnectionResult' 

  # auth_names
  auth_names = opts[:auth_names] || ['API_KEY']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: OAuthConnectionApi#create_o_auth_connection\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#exchange_authorization_token_and_create_or_update_inbox(authorization_code, redirect_uri, opts = {}) ⇒ CreateOAuthExchangeResult

Exchange authorization code for access token and create inbox Exchange an OAuth code for an access token and create an inbox connection in MailSlurp

Parameters:

  • authorization_code (String)
  • redirect_uri (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



106
107
108
109
# File 'lib/mailslurp_client/api/o_auth_connection_api.rb', line 106

def exchange_authorization_token_and_create_or_update_inbox(authorization_code, redirect_uri, opts = {})
  data, _status_code, _headers = exchange_authorization_token_and_create_or_update_inbox_with_http_info(authorization_code, redirect_uri, opts)
  data
end

#exchange_authorization_token_and_create_or_update_inbox_with_http_info(authorization_code, redirect_uri, opts = {}) ⇒ Array<(CreateOAuthExchangeResult, Integer, Hash)>

Exchange authorization code for access token and create inbox Exchange an OAuth code for an access token and create an inbox connection in MailSlurp

Parameters:

  • authorization_code (String)
  • redirect_uri (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(CreateOAuthExchangeResult, Integer, Hash)>)

    CreateOAuthExchangeResult data, response status code and response headers



117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# File 'lib/mailslurp_client/api/o_auth_connection_api.rb', line 117

def exchange_authorization_token_and_create_or_update_inbox_with_http_info(authorization_code, redirect_uri, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: OAuthConnectionApi.exchange_authorization_token_and_create_or_update_inbox ...'
  end
  # verify the required parameter 'authorization_code' is set
  if @api_client.config.client_side_validation && authorization_code.nil?
    fail ArgumentError, "Missing the required parameter 'authorization_code' when calling OAuthConnectionApi.exchange_authorization_token_and_create_or_update_inbox"
  end
  # verify the required parameter 'redirect_uri' is set
  if @api_client.config.client_side_validation && redirect_uri.nil?
    fail ArgumentError, "Missing the required parameter 'redirect_uri' when calling OAuthConnectionApi.exchange_authorization_token_and_create_or_update_inbox"
  end
  # resource path
  local_var_path = '/oauth-connection/oauth-exchange/google'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'authorizationCode'] = authorization_code
  query_params[:'redirectUri'] = redirect_uri

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['*/*'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'CreateOAuthExchangeResult' 

  # auth_names
  auth_names = opts[:auth_names] || ['API_KEY']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: OAuthConnectionApi#exchange_authorization_token_and_create_or_update_inbox\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end