Class: Coinone::Transaction

Inherits:
Object
  • Object
show all
Defined in:
lib/coinone/transaction.rb,
lib/coinone/transaction/krw_history.rb,
lib/coinone/transaction/coin_history.rb,
lib/coinone/transaction/send_coin_response.rb,
lib/coinone/transaction/krw_history/history.rb,
lib/coinone/transaction/auth_number_response.rb,
lib/coinone/transaction/coin_history/history.rb

Defined Under Namespace

Classes: AuthNumberResponse, CoinHistory, KrwHistory, SendCoinResponse

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}, connection = nil) ⇒ Transaction

Returns a new instance of Transaction.



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

def initialize(options={}, connection=nil)

  @connection = connection || Connection.factory(options)
  @auth_number_response = AuthNumberResponse.new()
  @coin_history = CoinHistory.new()
  @krw_history = KrwHistory.new()
  @send_coin_response = SendCoinResponse.new()

end

Instance Attribute Details

#auth_number_responseObject (readonly)

Returns the value of attribute auth_number_response.



11
12
13
# File 'lib/coinone/transaction.rb', line 11

def auth_number_response
  @auth_number_response
end

#coin_historyObject (readonly)

Returns the value of attribute coin_history.



11
12
13
# File 'lib/coinone/transaction.rb', line 11

def coin_history
  @coin_history
end

#connectionObject (readonly)

Returns the value of attribute connection.



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

def connection
  @connection
end

#krw_historyObject (readonly)

Returns the value of attribute krw_history.



11
12
13
# File 'lib/coinone/transaction.rb', line 11

def krw_history
  @krw_history
end

#send_coin_responseObject (readonly)

Returns the value of attribute send_coin_response.



11
12
13
# File 'lib/coinone/transaction.rb', line 11

def send_coin_response
  @send_coin_response
end

Instance Method Details

#get_auth_number(options = {}) ⇒ Object



24
25
26
27
28
29
30
# File 'lib/coinone/transaction.rb', line 24

def get_auth_number(options={})
  response = @connection.post( "/v2/transaction/auth_number/", options)

  @auth_number_response.update_response(response)
  @auth_number_response

end

#get_coin_history(options = {}) ⇒ Object



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

def get_coin_history(options={})

  response = @connection.post("/v2/transaction/history/", options)

  @coin_history.update_histories(response)
  @coin_history

end

#get_krw_history(options = {}) ⇒ Object



41
42
43
44
45
46
47
48
# File 'lib/coinone/transaction.rb', line 41

def get_krw_history(options={})

  response = @connection.post("/v2/transaction/krw/history/", options)

  @krw_history.update_histories(response)
  @krw_history

end

#send_coin(options = {}) ⇒ Object



50
51
52
53
54
55
56
57
58
# File 'lib/coinone/transaction.rb', line 50

def send_coin(options={})

  response = @connection.post("/v2/transaction/coin/", options)
  #response = {txid: "Txid"}

  @send_coin_response.update_response(response.merge({ currency: options[:currency]}))
  @send_coin_response

end