Class: GarnetClient::GarnetNotifyController
- Inherits:
-
ActionController::Base
- Object
- ActionController::Base
- GarnetClient::GarnetNotifyController
- Defined in:
- app/controllers/garnet_notify_controller.rb
Instance Method Summary collapse
Instance Method Details
#deposits ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/controllers/garnet_notify_controller.rb', line 12 def deposits rs = request.body.read code = '0' begin msg = JSON.parse(rs) notice = GarnetClient::NoticeDeposit.new notice.coin_type = msg['coin_type'] notice.contract_address = msg['contract_address'] notice.from = msg['from'] notice.tx_hash = msg['tx_hash'] notice.to = msg['to'] notice.value = msg['value'] notice. = msg['timestamp'] notice.status = msg['status'] notice.notify_id = msg['notify_id'] notice.error_msg = msg['error_msg'] notice.save! rescue JSON::ParserError => e puts e. puts e.backtrace.inspect code = '1' end render text: '{"status": {"code": ' + code + '}}' end |
#transactions ⇒ Object
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 |
# File 'app/controllers/garnet_notify_controller.rb', line 68 def transactions rs = request.body.read msg = JSON.parse(rs) code = '0' begin notice = GarnetClient::NoticeTransaction.new notice.coin_type = msg['coin_type'] notice.tx_id = msg['tx_id'] notice.tx_hash = msg['tx_hash'] notice. = msg['timestamp'] notice.from = msg['from'] notice.to = msg['to'] notice.value = msg['value'] notice.contract_address = msg['contractAddress'] notice.status = msg['status'] notice.save! rescue JSON::ParserError => e puts e. puts e.backtrace.inspect code = '1' end render text: '{"status": {"code": ' + code + '}}' end |
#withdraws ⇒ Object
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 |
# File 'app/controllers/garnet_notify_controller.rb', line 40 def withdraws rs = request.body.read code = '0' begin msg = JSON.parse(rs) notice = GarnetClient::NoticeWithdraw.new notice.coin_type = msg['coin_type'] notice.contract_address = msg['contract_address'] notice.from = msg['from'] notice.tx_hash = msg['tx_hash'] notice.to = msg['to'] notice.value = msg['value'] notice. = msg['timestamp'] notice.status = msg['status'] notice.notify_id = msg['notify_id'] notice.error_msg = msg['error_msg'] notice.save! rescue JSON::ParserError => e puts e. puts e.backtrace.inspect code = '1' end render text: '{"status": {"code": ' + code + '}}' end |