paxful_engine-rails 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6e703f7e6fbaf90b7f85cdb26beaf05aa92590fb7f42145c3177870ddffae27c
4
- data.tar.gz: e6029b79a03f1acfee4310b6ae788710836c995dfb0a6a9a51bd2c2ebf448174
3
+ metadata.gz: d817baab866145e535dc28f7cc9a8031448e08ba21f4a9acfc36e0c179106cf9
4
+ data.tar.gz: eb31ac85370223ea2d1236587209da31decd596ade63fb85f9e4d292a34b4be6
5
5
  SHA512:
6
- metadata.gz: 65344157341d2356b8efde3f789a0a2561cbf4283c252888bd826465d7b64df2e92587061913ef2c302ed5d5e0131b9031f9752caa70031b5cce9fc901f22791
7
- data.tar.gz: bed2766b448c783a849a78f6fc069c8f1c0d3822981bbf63a0aa7ffad78ed4c179cc84b0a82e6a84ad57c70605aa55fa1cba5ba30110b1191dadb1e1a5ce517f
6
+ metadata.gz: 804eea2db930ac5c49c68c8c874543c15330423f3465b0cd94542d57e3ad64fbc7d044ec88e3c62b7d128d02369bd5a719d488ed18d86a0e8550efc48c262baf
7
+ data.tar.gz: 7e0b5ce157c1a3f0c0e39946af73e71c8606327ade9c8760f11f6e8fdf7eebfd3c0ad78cddeb24754d7e8f762d022886027207fa6abb8354f4257631754f20f6
data/README.md CHANGED
@@ -54,6 +54,17 @@ class YourCallback
54
54
  end
55
55
  ```
56
56
 
57
+ ### Usage
58
+
59
+ Add this to your scheduler somewhere:
60
+
61
+ ```
62
+ # sidekiq_cron.yml
63
+ refresh_paxful_order_book:
64
+ cron: "*/2 * * * * Asia/Singapore" # runs every 2 minutes
65
+ class: "PaxfulEngine::SyncOrderBookJob"
66
+ ```
67
+
57
68
  ### Development
58
69
 
59
70
  ```
@@ -0,0 +1,13 @@
1
+ module PaxfulEngine
2
+ class TradesController < ApplicationController
3
+
4
+ def index
5
+ @trades = Trade.all
6
+ end
7
+
8
+ def show
9
+ @trade = Trade.find(params[:id])
10
+ end
11
+
12
+ end
13
+ end
@@ -1,15 +1,22 @@
1
1
  <!DOCTYPE html>
2
2
  <html>
3
3
  <head>
4
- <title>Paxful engine</title>
4
+ <title>Paxful Engine</title>
5
5
  <%= csrf_meta_tags %>
6
6
  <%= csp_meta_tag %>
7
7
 
8
- <%= stylesheet_link_tag "paxful_engine/application", media: "all" %>
8
+ <%= stylesheet_link_tag "paxful_engine/application", media: "all" %>
9
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
9
10
  </head>
10
11
  <body>
11
12
 
12
- <%= yield %>
13
+ <nav class="navbar navbar-dark bg-dark">
14
+ <%= link_to "Paxful Trades", paxful_engine.trades_path, class: "navbar-brand" %>
15
+ </nav>
16
+
17
+ <div class="mt-4 mb-4 container-fluid">
18
+ <%= yield %>
19
+ </div>
13
20
 
14
21
  </body>
15
22
  </html>
@@ -0,0 +1,28 @@
1
+ <div class="table-responsive">
2
+ <table class="table table-striped table-bordered">
3
+ <thead>
4
+ <tr>
5
+ <th scope="col">Created</th>
6
+ <th scope="col">Trade hash</th>
7
+ <th scope="col">Type</th>
8
+ <th scope="col">Status</th>
9
+ <th scope="col">Seller</th>
10
+ <th scope="col">Buyer</th>
11
+ <th scope="col"></th>
12
+ </tr>
13
+ </thead>
14
+ <tbody>
15
+ <% @trades.each do |trade| %>
16
+ <tr scope="row">
17
+ <td> <%= trade.created_at.strftime("%m/%d/%Y %I:%M%p") %> </td>
18
+ <td> <%= trade.trade_hash %> </td>
19
+ <td> <%= trade.offer_type.upcase %> </td>
20
+ <td> <%= trade.status.upcase %> </td>
21
+ <td> <%= trade.seller %> </td>
22
+ <td> <%= trade.buyer %> </td>
23
+ <td> <%= link_to "Check trade details", paxful_engine.trade_path(trade) %> </td>
24
+ </tr>
25
+ <% end %>
26
+ </tbody>
27
+ </table>
28
+ </div>
@@ -0,0 +1,43 @@
1
+ <%= link_to "Back", paxful_engine.trades_path, class: "btn btn-primary" %>
2
+
3
+ <div class="row">
4
+ <div class="col-sm-4">
5
+ <div class="card mt-4">
6
+ <h5 class="card-header">Trade details (<%= @trade.trade_hash %>)</h5>
7
+ <div class="card-body">
8
+ <div>
9
+ <div> <strong>Seller:</strong> <%= @trade.seller %> </div>
10
+ <div> <strong>Buyer:</strong> <%= @trade.buyer %> </div>
11
+ <div> <strong>Type:</strong> <%= @trade.offer_type.upcase %> </div>
12
+ </div>
13
+
14
+ <hr />
15
+
16
+ <div>
17
+ <div>
18
+ <strong>Fiat Requested:</strong>
19
+ <%= number_to_currency(@trade.fiat_amount_requested, unit: "#{@trade.fiat_currency_code} ") %>
20
+ </div>
21
+ <div>
22
+ <strong>Crypto Requested:</strong>
23
+ <%= number_to_currency(@trade.crypto_amount_requested, unit: "#{@trade.crypto_currency_code} ") %>
24
+ (in sats)
25
+ </div>
26
+ </div>
27
+
28
+ <hr />
29
+
30
+ <div>
31
+ <div> <strong>Started at:</strong> <%= @trade.started_at.strftime("%m/%d/%Y %I:%M%p") %> </div>
32
+ <div> <strong>Ended at:</strong> <%= @trade.ended_at.strftime("%m/%d/%Y %I:%M%p") %> </div>
33
+ <div> <strong>Completed at:</strong> <%= @trade.completed_at&.strftime("%m/%d/%Y %I:%M%p") %> </div>
34
+ </div>
35
+
36
+ <hr />
37
+
38
+ <div> <strong>Status:</strong> <%= @trade.status.upcase %> </div>
39
+ <div> <strong>Payment Method:</strong> <%= @trade.payment_method_name %> </div>
40
+ </div>
41
+ </div>
42
+ </div>
43
+ </div>
@@ -1,2 +1,3 @@
1
1
  PaxfulEngine::Engine.routes.draw do
2
+ resources :trades, only: [:index, :show]
2
3
  end
@@ -1,3 +1,3 @@
1
1
  module PaxfulEngine
2
- VERSION = '0.1.0'
2
+ VERSION = '0.2.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paxful_engine-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Chavez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-20 00:00:00.000000000 Z
11
+ date: 2020-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gem_config
@@ -163,6 +163,7 @@ files:
163
163
  - app/assets/config/paxful_engine_manifest.js
164
164
  - app/assets/stylesheets/paxful_engine/application.css
165
165
  - app/controllers/paxful_engine/application_controller.rb
166
+ - app/controllers/paxful_engine/trades_controller.rb
166
167
  - app/helpers/paxful_engine/application_helper.rb
167
168
  - app/jobs/paxful_engine/application_job.rb
168
169
  - app/jobs/paxful_engine/enqueue_create_trade_job.rb
@@ -172,6 +173,8 @@ files:
172
173
  - app/models/paxful_engine/trade.rb
173
174
  - app/services/paxful_engine/create_trade.rb
174
175
  - app/views/layouts/paxful_engine/application.html.erb
176
+ - app/views/paxful_engine/trades/index.html.erb
177
+ - app/views/paxful_engine/trades/show.html.erb
175
178
  - config/routes.rb
176
179
  - db/migrate/20201018043517_create_paxful_engine_trades.rb
177
180
  - lib/paxful_engine-rails.rb