Class: SubskribeSandboxClient::NotificationsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/subskribe_sandbox/api/notifications_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ NotificationsApi

Returns a new instance of NotificationsApi.



19
20
21
# File 'lib/subskribe_sandbox/api/notifications_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/subskribe_sandbox/api/notifications_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#add_target_and_events_subscriptions(body, opts = {}) ⇒ NotificationTargetAndSubscriptions

Add a notification target Adds a notification target and events according to the specified parameters

Parameters:

  • body

    json representing the notification details

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



27
28
29
30
# File 'lib/subskribe_sandbox/api/notifications_api.rb', line 27

def add_target_and_events_subscriptions(body, opts = {})
  data, _status_code, _headers = add_target_and_events_subscriptions_with_http_info(body, opts)
  data
end

#add_target_and_events_subscriptions_with_http_info(body, opts = {}) ⇒ Array<(NotificationTargetAndSubscriptions, Fixnum, Hash)>

Add a notification target Adds a notification target and events according to the specified parameters

Parameters:

  • body

    json representing the notification details

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



37
38
39
40
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
# File 'lib/subskribe_sandbox/api/notifications_api.rb', line 37

def add_target_and_events_subscriptions_with_http_info(body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: NotificationsApi.add_target_and_events_subscriptions ...'
  end
  # verify the required parameter 'body' is set
  if @api_client.config.client_side_validation && body.nil?
    fail ArgumentError, "Missing the required parameter 'body' when calling NotificationsApi.add_target_and_events_subscriptions"
  end
  # resource path
  local_var_path = '/notifications'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(body)
  auth_names = ['ApiKeyAuth']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'NotificationTargetAndSubscriptions')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: NotificationsApi#add_target_and_events_subscriptions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_all_notification_subscriptions_for_tenant(opts = {}) ⇒ Array<NotificationTargetAndSubscriptions>

Get all notifications Returns all notification subscriptions for your tenant

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



78
79
80
81
# File 'lib/subskribe_sandbox/api/notifications_api.rb', line 78

def get_all_notification_subscriptions_for_tenant(opts = {})
  data, _status_code, _headers = get_all_notification_subscriptions_for_tenant_with_http_info(opts)
  data
end

#get_all_notification_subscriptions_for_tenant_with_http_info(opts = {}) ⇒ Array<(Array<NotificationTargetAndSubscriptions>, Fixnum, Hash)>

Get all notifications Returns all notification subscriptions for your tenant

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/subskribe_sandbox/api/notifications_api.rb', line 87

def get_all_notification_subscriptions_for_tenant_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: NotificationsApi.get_all_notification_subscriptions_for_tenant ...'
  end
  # resource path
  local_var_path = '/notifications'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['ApiKeyAuth']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Array<NotificationTargetAndSubscriptions>')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: NotificationsApi#get_all_notification_subscriptions_for_tenant\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#subscribe_existing_notification_target_to_event(notification_id, notification_event_type, opts = {}) ⇒ nil

Attach an event to a notification Attaches a notification event to the target specified by the notification id

Parameters:

  • notification_id

    id of the notification target

  • notification_event_type

    type of event

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


126
127
128
129
# File 'lib/subskribe_sandbox/api/notifications_api.rb', line 126

def subscribe_existing_notification_target_to_event(notification_id, notification_event_type, opts = {})
  subscribe_existing_notification_target_to_event_with_http_info(notification_id, notification_event_type, opts)
  nil
end

#subscribe_existing_notification_target_to_event_with_http_info(notification_id, notification_event_type, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Attach an event to a notification Attaches a notification event to the target specified by the notification id

Parameters:

  • notification_id

    id of the notification target

  • notification_event_type

    type of event

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(nil, Fixnum, Hash)>)

    nil, response status code and response headers



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
169
170
171
172
173
174
175
176
177
178
179
180
181
# File 'lib/subskribe_sandbox/api/notifications_api.rb', line 137

def subscribe_existing_notification_target_to_event_with_http_info(notification_id, notification_event_type, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: NotificationsApi.subscribe_existing_notification_target_to_event ...'
  end
  # verify the required parameter 'notification_id' is set
  if @api_client.config.client_side_validation && notification_id.nil?
    fail ArgumentError, "Missing the required parameter 'notification_id' when calling NotificationsApi.subscribe_existing_notification_target_to_event"
  end
  # verify the required parameter 'notification_event_type' is set
  if @api_client.config.client_side_validation && notification_event_type.nil?
    fail ArgumentError, "Missing the required parameter 'notification_event_type' when calling NotificationsApi.subscribe_existing_notification_target_to_event"
  end
  # verify enum value
  if @api_client.config.client_side_validation && !['INVOICE_POSTED', 'SUBSCRIPTION_CREATED', 'ORDER_SUBMITTED', 'ORDER_EXECUTED'].include?(notification_event_type)
    fail ArgumentError, "invalid value for 'notification_event_type', must be one of INVOICE_POSTED, SUBSCRIPTION_CREATED, ORDER_SUBMITTED, ORDER_EXECUTED"
  end
  # resource path
  local_var_path = '/notifications/{notificationId}'.sub('{' + 'notificationId' + '}', notification_id.to_s)

  # query parameters
  query_params = {}
  query_params[:'notificationEventType'] = notification_event_type

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['ApiKeyAuth']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: NotificationsApi#subscribe_existing_notification_target_to_event\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#unsubscribe_target_or_event(notification_id, notification_event_type, opts = {}) ⇒ nil

Unsubscribe from an event Unsubscribes the specified notification target from the specified event

Parameters:

  • notification_id

    id of the notification target

  • notification_event_type

    type of event

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


188
189
190
191
# File 'lib/subskribe_sandbox/api/notifications_api.rb', line 188

def unsubscribe_target_or_event(notification_id, notification_event_type, opts = {})
  unsubscribe_target_or_event_with_http_info(notification_id, notification_event_type, opts)
  nil
end

#unsubscribe_target_or_event_with_http_info(notification_id, notification_event_type, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Unsubscribe from an event Unsubscribes the specified notification target from the specified event

Parameters:

  • notification_id

    id of the notification target

  • notification_event_type

    type of event

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(nil, Fixnum, Hash)>)

    nil, response status code and response headers



199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
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
240
241
242
243
# File 'lib/subskribe_sandbox/api/notifications_api.rb', line 199

def unsubscribe_target_or_event_with_http_info(notification_id, notification_event_type, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: NotificationsApi.unsubscribe_target_or_event ...'
  end
  # verify the required parameter 'notification_id' is set
  if @api_client.config.client_side_validation && notification_id.nil?
    fail ArgumentError, "Missing the required parameter 'notification_id' when calling NotificationsApi.unsubscribe_target_or_event"
  end
  # verify the required parameter 'notification_event_type' is set
  if @api_client.config.client_side_validation && notification_event_type.nil?
    fail ArgumentError, "Missing the required parameter 'notification_event_type' when calling NotificationsApi.unsubscribe_target_or_event"
  end
  # verify enum value
  if @api_client.config.client_side_validation && !['INVOICE_POSTED', 'SUBSCRIPTION_CREATED', 'ORDER_SUBMITTED', 'ORDER_EXECUTED'].include?(notification_event_type)
    fail ArgumentError, "invalid value for 'notification_event_type', must be one of INVOICE_POSTED, SUBSCRIPTION_CREATED, ORDER_SUBMITTED, ORDER_EXECUTED"
  end
  # resource path
  local_var_path = '/notifications/unsubscribe/{notificationId}'.sub('{' + 'notificationId' + '}', notification_id.to_s)

  # query parameters
  query_params = {}
  query_params[:'notificationEventType'] = notification_event_type

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['ApiKeyAuth']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: NotificationsApi#unsubscribe_target_or_event\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end