Class: CryptoApis::GeneratingApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ GeneratingApi

Returns a new instance of GeneratingApi.



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

def api_client
  @api_client
end

Instance Method Details

#generate_deposit_address(blockchain, network, wallet_id, opts = {}) ⇒ GenerateDepositAddressR

Generate Deposit Address Through this endpoint customers can generate a new Receiving/Deposit Addresses into their Wallet.

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. - "mainnet" is the live network with actual data while networks like "testnet", "ropsten" are test networks.

  • wallet_id (String)

    Represents the unique ID of the specific Wallet.

  • 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.

  • :generate_deposit_address_rb (GenerateDepositAddressRB)

Returns:



31
32
33
34
# File 'lib/crypto_apis/api/generating_api.rb', line 31

def generate_deposit_address(blockchain, network, wallet_id, opts = {})
  data, _status_code, _headers = generate_deposit_address_with_http_info(blockchain, network, wallet_id, opts)
  data
end

#generate_deposit_address_with_http_info(blockchain, network, wallet_id, opts = {}) ⇒ Array<(GenerateDepositAddressR, Integer, Hash)>

Generate Deposit Address Through this endpoint customers can generate a new Receiving/Deposit Addresses into their Wallet.

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.

  • wallet_id (String)

    Represents the unique ID of the specific Wallet.

  • 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.

  • :generate_deposit_address_rb (GenerateDepositAddressRB)

Returns:

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

    GenerateDepositAddressR data, response status code and response headers



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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/crypto_apis/api/generating_api.rb', line 45

def generate_deposit_address_with_http_info(blockchain, network, wallet_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: GeneratingApi.generate_deposit_address ...'
  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 GeneratingApi.generate_deposit_address"
  end
  # verify enum value
  allowable_values = ["bitcoin", "bitcoin-cash", "litecoin", "dogecoin", "dash", "ethereum", "ethereum-classic", "xrp", "zcash", "binance-smart-chain"]
  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 GeneratingApi.generate_deposit_address"
  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 'wallet_id' is set
  if @api_client.config.client_side_validation && wallet_id.nil?
    fail ArgumentError, "Missing the required parameter 'wallet_id' when calling GeneratingApi.generate_deposit_address"
  end
  # resource path
  local_var_path = '/wallet-as-a-service/wallets/{walletId}/{blockchain}/{network}/addresses'.sub('{' + 'blockchain' + '}', CGI.escape(blockchain.to_s)).sub('{' + 'network' + '}', CGI.escape(network.to_s)).sub('{' + 'walletId' + '}', CGI.escape(wallet_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[:'generate_deposit_address_rb'])

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

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

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