Class: CryptoApis::ManageSubscriptionsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/crypto_apis/api/manage_subscriptions_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ ManageSubscriptionsApi

Returns a new instance of ManageSubscriptionsApi.



19
20
21
# File 'lib/crypto_apis/api/manage_subscriptions_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/crypto_apis/api/manage_subscriptions_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#activate_blockchain_event_subscription(reference_id, opts = {}) ⇒ ActivateBlockchainEventSubscriptionR

Activate Blockchain Event Subscription Through this endpoint customers can reactivate an event subscription (callback) which has been deactivated by the system. Deactivations could happen due to various reasons, most often "maximum retry attempts reached".

Parameters:

  • reference_id (String)

    Represents a unique ID used to reference the specific callback subscription.

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

    the optional parameters

Options Hash (opts):

  • :context (String)

    In batch situations the user can use the context to correlate responses with requests. This property is present regardless of whether the response was successful or returned as an error. `context` is specified by the user.

  • :activate_blockchain_event_subscription_rb (ActivateBlockchainEventSubscriptionRB)

Returns:



29
30
31
32
# File 'lib/crypto_apis/api/manage_subscriptions_api.rb', line 29

def activate_blockchain_event_subscription(reference_id, opts = {})
  data, _status_code, _headers = activate_blockchain_event_subscription_with_http_info(reference_id, opts)
  data
end

#activate_blockchain_event_subscription_with_http_info(reference_id, opts = {}) ⇒ Array<(ActivateBlockchainEventSubscriptionR, Integer, Hash)>

Activate Blockchain Event Subscription Through this endpoint customers can reactivate an event subscription (callback) which has been deactivated by the system. Deactivations could happen due to various reasons, most often &quot;maximum retry attempts reached&quot;.

Parameters:

  • reference_id (String)

    Represents a unique ID used to reference the specific callback subscription.

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

    the optional parameters

Options Hash (opts):

  • :context (String)

    In batch situations the user can use the context to correlate responses with requests. This property is present regardless of whether the response was successful or returned as an error. &#x60;context&#x60; is specified by the user.

  • :activate_blockchain_event_subscription_rb (ActivateBlockchainEventSubscriptionRB)

Returns:



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
# File 'lib/crypto_apis/api/manage_subscriptions_api.rb', line 41

def activate_blockchain_event_subscription_with_http_info(reference_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ManageSubscriptionsApi.activate_blockchain_event_subscription ...'
  end
  # verify the required parameter 'reference_id' is set
  if @api_client.config.client_side_validation && reference_id.nil?
    fail ArgumentError, "Missing the required parameter 'reference_id' when calling ManageSubscriptionsApi.activate_blockchain_event_subscription"
  end
  # resource path
  local_var_path = '/blockchain-events/subscriptions/{referenceId}/activate'.sub('{' + 'referenceId' + '}', CGI.escape(reference_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'context'] = opts[:'context'] if !opts[:'context'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

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

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'activate_blockchain_event_subscription_rb'])

  # return_type
  return_type = opts[:debug_return_type] || 'ActivateBlockchainEventSubscriptionR'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"ManageSubscriptionsApi.activate_blockchain_event_subscription",
    :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: ManageSubscriptionsApi#activate_blockchain_event_subscription\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_blockchain_event_subscription(blockchain, network, reference_id, opts = {}) ⇒ DeleteBlockchainEventSubscriptionR

Delete Blockchain Event Subscription Through this endpoint the customer can delete blockchain event subscriptions they have by attributes ‘referenceId` and `network`. Currently Crypto APIs 2.0 offers certain Blockchain event endpoints which allow the user to subscribe for one/a few/all and receive callback notifications when the specific event occurs. noteTo have an operational callback subscription, you need to first verify a domain for the Callback URL. Please see more information on Callbacks [here](developers.cryptoapis.io/technical-documentation/general-information/callbacks#callback-url)./note warningCrypto APIs will notify the user **only when** the event occurs. There are cases when the specific event doesn’t happen at all, or takes a long time to do so. A callback notification **will not** be sent if the event does not or cannot occur, or will take long time to occur./warning

Parameters:

  • blockchain (String)

    Represents the specific blockchain protocol name, e.g. Ethereum, Bitcoin, etc.

  • network (String)

    Represents the name of the blockchain network used; blockchain networks are usually identical as technology and software, but they differ in data, e.g. - &quot;mainnet&quot; is the live network with actual data while networks like &quot;testnet&quot;, &quot;ropsten&quot; are test networks.

  • reference_id (String)

    Represents a unique ID used to reference the specific callback subscription.

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

    the optional parameters

Options Hash (opts):

  • :context (String)

    In batch situations the user can use the context to correlate responses with requests. This property is present regardless of whether the response was successful or returned as an error. &#x60;context&#x60; is specified by the user.

Returns:



103
104
105
106
# File 'lib/crypto_apis/api/manage_subscriptions_api.rb', line 103

def delete_blockchain_event_subscription(blockchain, network, reference_id, opts = {})
  data, _status_code, _headers = delete_blockchain_event_subscription_with_http_info(blockchain, network, reference_id, opts)
  data
end

#delete_blockchain_event_subscription_with_http_info(blockchain, network, reference_id, opts = {}) ⇒ Array<(DeleteBlockchainEventSubscriptionR, Integer, Hash)>

Delete Blockchain Event Subscription Through this endpoint the customer can delete blockchain event subscriptions they have by attributes &#x60;referenceId&#x60; and &#x60;network&#x60;. Currently Crypto APIs 2.0 offers certain Blockchain event endpoints which allow the user to subscribe for one/a few/all and receive callback notifications when the specific event occurs. noteTo have an operational callback subscription, you need to first verify a domain for the Callback URL. Please see more information on Callbacks [here](developers.cryptoapis.io/technical-documentation/general-information/callbacks#callback-url)./note warningCrypto APIs will notify the user **only when** the event occurs. There are cases when the specific event doesn&#39;t happen at all, or takes a long time to do so. A callback notification **will not** be sent if the event does not or cannot occur, or will take long time to occur./warning

Parameters:

  • blockchain (String)

    Represents the specific blockchain protocol name, e.g. Ethereum, Bitcoin, etc.

  • network (String)

    Represents the name of the blockchain network used; blockchain networks are usually identical as technology and software, but they differ in data, e.g. - &quot;mainnet&quot; is the live network with actual data while networks like &quot;testnet&quot;, &quot;ropsten&quot; are test networks.

  • reference_id (String)

    Represents a unique ID used to reference the specific callback subscription.

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

    the optional parameters

Options Hash (opts):

  • :context (String)

    In batch situations the user can use the context to correlate responses with requests. This property is present regardless of whether the response was successful or returned as an error. &#x60;context&#x60; is specified by the user.

Returns:



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

def delete_blockchain_event_subscription_with_http_info(blockchain, network, reference_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ManageSubscriptionsApi.delete_blockchain_event_subscription ...'
  end
  # verify the required parameter 'blockchain' is set
  if @api_client.config.client_side_validation && blockchain.nil?
    fail ArgumentError, "Missing the required parameter 'blockchain' when calling ManageSubscriptionsApi.delete_blockchain_event_subscription"
  end
  # verify enum value
  allowable_values = ["bitcoin", "bitcoin-cash", "litecoin", "dogecoin", "dash", "ethereum", "ethereum-classic", "xrp", "zilliqa", "binance-smart-chain", "zcash"]
  if @api_client.config.client_side_validation && !allowable_values.include?(blockchain)
    fail ArgumentError, "invalid value for \"blockchain\", must be one of #{allowable_values}"
  end
  # verify the required parameter 'network' is set
  if @api_client.config.client_side_validation && network.nil?
    fail ArgumentError, "Missing the required parameter 'network' when calling ManageSubscriptionsApi.delete_blockchain_event_subscription"
  end
  # verify enum value
  allowable_values = ["mainnet", "testnet", "ropsten", "mordor"]
  if @api_client.config.client_side_validation && !allowable_values.include?(network)
    fail ArgumentError, "invalid value for \"network\", must be one of #{allowable_values}"
  end
  # verify the required parameter 'reference_id' is set
  if @api_client.config.client_side_validation && reference_id.nil?
    fail ArgumentError, "Missing the required parameter 'reference_id' when calling ManageSubscriptionsApi.delete_blockchain_event_subscription"
  end
  # resource path
  local_var_path = '/blockchain-events/{blockchain}/{network}/subscriptions/{referenceId}'.sub('{' + 'blockchain' + '}', CGI.escape(blockchain.to_s)).sub('{' + 'network' + '}', CGI.escape(network.to_s)).sub('{' + 'referenceId' + '}', CGI.escape(reference_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'context'] = opts[:'context'] if !opts[:'context'].nil?

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

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'DeleteBlockchainEventSubscriptionR'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"ManageSubscriptionsApi.delete_blockchain_event_subscription",
    :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(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ManageSubscriptionsApi#delete_blockchain_event_subscription\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_blockchain_event_subscription_details_by_reference_id(reference_id, opts = {}) ⇒ GetBlockchainEventSubscriptionDetailsByReferenceIDR

Get Blockchain Event Subscription Details By Reference ID Through this endpoint the customer can get detailed information for a callback subscription by providing its reference ID. Currently Crypto APIs 2.0 offers certain Blockchain event endpoints which allow the user to subscribe for one/a few/all and receive callback notifications when the specific event occurs.

Parameters:

  • reference_id (String)

    Represents a unique ID used to reference the specific callback subscription.

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

    the optional parameters

Options Hash (opts):

  • :context (String)

    In batch situations the user can use the context to correlate responses with requests. This property is present regardless of whether the response was successful or returned as an error. &#x60;context&#x60; is specified by the user.

Returns:



189
190
191
192
# File 'lib/crypto_apis/api/manage_subscriptions_api.rb', line 189

def get_blockchain_event_subscription_details_by_reference_id(reference_id, opts = {})
  data, _status_code, _headers = get_blockchain_event_subscription_details_by_reference_id_with_http_info(reference_id, opts)
  data
end

#get_blockchain_event_subscription_details_by_reference_id_with_http_info(reference_id, opts = {}) ⇒ Array<(GetBlockchainEventSubscriptionDetailsByReferenceIDR, Integer, Hash)>

Get Blockchain Event Subscription Details By Reference ID Through this endpoint the customer can get detailed information for a callback subscription by providing its reference ID. Currently Crypto APIs 2.0 offers certain Blockchain event endpoints which allow the user to subscribe for one/a few/all and receive callback notifications when the specific event occurs.

Parameters:

  • reference_id (String)

    Represents a unique ID used to reference the specific callback subscription.

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

    the optional parameters

Options Hash (opts):

  • :context (String)

    In batch situations the user can use the context to correlate responses with requests. This property is present regardless of whether the response was successful or returned as an error. &#x60;context&#x60; is specified by the user.

Returns:



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
244
245
246
247
# File 'lib/crypto_apis/api/manage_subscriptions_api.rb', line 200

def get_blockchain_event_subscription_details_by_reference_id_with_http_info(reference_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ManageSubscriptionsApi.get_blockchain_event_subscription_details_by_reference_id ...'
  end
  # verify the required parameter 'reference_id' is set
  if @api_client.config.client_side_validation && reference_id.nil?
    fail ArgumentError, "Missing the required parameter 'reference_id' when calling ManageSubscriptionsApi.get_blockchain_event_subscription_details_by_reference_id"
  end
  # resource path
  local_var_path = '/blockchain-events/subscriptions/{referenceId}'.sub('{' + 'referenceId' + '}', CGI.escape(reference_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'context'] = opts[:'context'] if !opts[:'context'].nil?

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

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'GetBlockchainEventSubscriptionDetailsByReferenceIDR'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"ManageSubscriptionsApi.get_blockchain_event_subscription_details_by_reference_id",
    :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(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ManageSubscriptionsApi#get_blockchain_event_subscription_details_by_reference_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_blockchain_events_subscriptions(blockchain, network, opts = {}) ⇒ ListBlockchainEventsSubscriptionsR

List Blockchain Events Subscriptions Through this endpoint the customer can obtain a list of their callback subscriptions for the available Blockchain events. Currently Crypto APIs 2.0 offers certain Blockchain event endpoints which allow the user to subscribe for one/a few/all and receive callback notifications when the specific event occurs. noteTo have an operational callback subscription, you need to first verify a domain for the Callback URL. Please see more information on Callbacks [here](developers.cryptoapis.io/technical-documentation/general-information/callbacks#callback-url)./note

Parameters:

  • blockchain (String)

    Represents the specific blockchain protocol name, e.g. Ethereum, Bitcoin, etc.

  • network (String)

    Represents the name of the blockchain network used; blockchain networks are usually identical as technology and software, but they differ in data, e.g. - &quot;mainnet&quot; is the live network with actual data while networks like &quot;testnet&quot;, &quot;ropsten&quot; are test networks.

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

    the optional parameters

Options Hash (opts):

  • :context (String)

    In batch situations the user can use the context to correlate responses with requests. This property is present regardless of whether the response was successful or returned as an error. &#x60;context&#x60; is specified by the user.

  • :limit (Integer)

    Defines how many items should be returned in the response per page basis. (default to 50)

  • :offset (Integer)

    The starting index of the response items, i.e. where the response should start listing the returned items. (default to 0)

Returns:



258
259
260
261
# File 'lib/crypto_apis/api/manage_subscriptions_api.rb', line 258

def list_blockchain_events_subscriptions(blockchain, network, opts = {})
  data, _status_code, _headers = list_blockchain_events_subscriptions_with_http_info(blockchain, network, opts)
  data
end

#list_blockchain_events_subscriptions_with_http_info(blockchain, network, opts = {}) ⇒ Array<(ListBlockchainEventsSubscriptionsR, Integer, Hash)>

List Blockchain Events Subscriptions Through this endpoint the customer can obtain a list of their callback subscriptions for the available Blockchain events. Currently Crypto APIs 2.0 offers certain Blockchain event endpoints which allow the user to subscribe for one/a few/all and receive callback notifications when the specific event occurs. noteTo have an operational callback subscription, you need to first verify a domain for the Callback URL. Please see more information on Callbacks [here](developers.cryptoapis.io/technical-documentation/general-information/callbacks#callback-url)./note

Parameters:

  • blockchain (String)

    Represents the specific blockchain protocol name, e.g. Ethereum, Bitcoin, etc.

  • network (String)

    Represents the name of the blockchain network used; blockchain networks are usually identical as technology and software, but they differ in data, e.g. - &quot;mainnet&quot; is the live network with actual data while networks like &quot;testnet&quot;, &quot;ropsten&quot; are test networks.

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

    the optional parameters

Options Hash (opts):

  • :context (String)

    In batch situations the user can use the context to correlate responses with requests. This property is present regardless of whether the response was successful or returned as an error. &#x60;context&#x60; is specified by the user.

  • :limit (Integer)

    Defines how many items should be returned in the response per page basis. (default to 50)

  • :offset (Integer)

    The starting index of the response items, i.e. where the response should start listing the returned items. (default to 0)

Returns:



272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
# File 'lib/crypto_apis/api/manage_subscriptions_api.rb', line 272

def list_blockchain_events_subscriptions_with_http_info(blockchain, network, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ManageSubscriptionsApi.list_blockchain_events_subscriptions ...'
  end
  # verify the required parameter 'blockchain' is set
  if @api_client.config.client_side_validation && blockchain.nil?
    fail ArgumentError, "Missing the required parameter 'blockchain' when calling ManageSubscriptionsApi.list_blockchain_events_subscriptions"
  end
  # verify enum value
  allowable_values = ["bitcoin", "bitcoin-cash", "litecoin", "dogecoin", "dash", "ethereum", "ethereum-classic", "xrp", "zilliqa", "binance-smart-chain", "zcash"]
  if @api_client.config.client_side_validation && !allowable_values.include?(blockchain)
    fail ArgumentError, "invalid value for \"blockchain\", must be one of #{allowable_values}"
  end
  # verify the required parameter 'network' is set
  if @api_client.config.client_side_validation && network.nil?
    fail ArgumentError, "Missing the required parameter 'network' when calling ManageSubscriptionsApi.list_blockchain_events_subscriptions"
  end
  # verify enum value
  allowable_values = ["mainnet", "testnet", "ropsten", "mordor"]
  if @api_client.config.client_side_validation && !allowable_values.include?(network)
    fail ArgumentError, "invalid value for \"network\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/blockchain-events/{blockchain}/{network}/subscriptions'.sub('{' + 'blockchain' + '}', CGI.escape(blockchain.to_s)).sub('{' + 'network' + '}', CGI.escape(network.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'context'] = opts[:'context'] if !opts[:'context'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?

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

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

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

  # return_type
  return_type = opts[:debug_return_type] || 'ListBlockchainEventsSubscriptionsR'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"ManageSubscriptionsApi.list_blockchain_events_subscriptions",
    :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(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ManageSubscriptionsApi#list_blockchain_events_subscriptions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end