Class: Coinone::Transaction::SendCoinResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/coinone/transaction/send_coin_response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ SendCoinResponse

Returns a new instance of SendCoinResponse.



11
12
13
14
15
16
17
18
19
20
# File 'lib/coinone/transaction/send_coin_response.rb', line 11

def initialize(options={})

  @result = options[:result] || nil
  @txid = nil
  @currency = options[:currency] || nil

  update_response(options)


end

Instance Attribute Details

#currencyObject (readonly)

Returns the value of attribute currency.



9
10
11
# File 'lib/coinone/transaction/send_coin_response.rb', line 9

def currency
  @currency
end

#resultObject (readonly)

Returns the value of attribute result.



8
9
10
# File 'lib/coinone/transaction/send_coin_response.rb', line 8

def result
  @result
end

#txidObject (readonly)

Returns the value of attribute txid.



9
10
11
# File 'lib/coinone/transaction/send_coin_response.rb', line 9

def txid
  @txid
end

Instance Method Details

#transaction_urlObject



30
31
32
33
34
35
36
37
38
# File 'lib/coinone/transaction/send_coin_response.rb', line 30

def transaction_url

  url = nil
  url = "https://blockchain.info/tx/#{txid}" if @currency == "btc"
  url = "https://etherscan.io/tx/#{txid}" if @currency == "eth"
  url = "https://gastracker.io/tx/#{txid}" if @currency == "etc"

  url
end

#update_response(params = {}) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/coinone/transaction/send_coin_response.rb', line 22

def update_response(params={})

  @result = params[:result] if params.has_key? :result
  @txid = params[:txid] if params.has_key? :txid
  @currency = params[:currency].downcase if params.has_key? :currency

end