paxful_engine-rails 0.5.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/paxful_engine/trades_controller.rb +5 -1
- data/app/models/paxful_engine/trade.rb +4 -0
- data/app/views/paxful_engine/trades/index.html.erb +16 -7
- data/app/views/paxful_engine/trades/show.html.erb +2 -2
- data/lib/paxful_engine/factories.rb +16 -0
- data/lib/paxful_engine/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2d1a02a0cb8692da174f85cc87d3ce606f053ea601db8639871a9c9fcdaa303
|
4
|
+
data.tar.gz: 45ca9095d7a1e3d7c3ffb049a8c6724b83efb58b6c7e4f4f2a98606277dfaea9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4ec07d8f1120d59d4586240bca493b93adf3da56a83501a7c3e62f5d6c3986d52e8ecd650a4a4bf647fc38102796777cdf99716e75e5138a952abb77e70509b
|
7
|
+
data.tar.gz: d9615d1975e2f2d02985f65421ecfe3d057e4368b84c006657cd7a44f6d750470e583b1b437b741f40a4436438ce4c70ef222d22e5f5a926b5afe6b6a1d99abc
|
@@ -2,7 +2,11 @@ module PaxfulEngine
|
|
2
2
|
class TradesController < ApplicationController
|
3
3
|
|
4
4
|
def index
|
5
|
-
@trades = Trade.
|
5
|
+
@trades = Trade.order(completed_at: :desc, created_at: :desc)
|
6
|
+
|
7
|
+
if params[:q] != "all"
|
8
|
+
@trades = @trades.where.not(completed_at: nil)
|
9
|
+
end
|
6
10
|
end
|
7
11
|
|
8
12
|
def show
|
@@ -1,16 +1,25 @@
|
|
1
|
-
<span class="font-weight-bold"> Found <%= pluralize(@trades.count, "trade")
|
1
|
+
<span class="font-weight-bold"> Found <%= pluralize(@trades.count, "trade") %>.</span>
|
2
|
+
|
3
|
+
<div>
|
4
|
+
<% if params[:q] == "all" %>
|
5
|
+
<%= link_to "👀 Only show successful trades", trades_path %>
|
6
|
+
<% else %>
|
7
|
+
<%= link_to "👀 Include non-successful trades", trades_path(q: :all) %>
|
8
|
+
<% end %>
|
9
|
+
</div>
|
10
|
+
|
2
11
|
<hr />
|
3
12
|
|
4
13
|
<div class="table-responsive">
|
5
14
|
<table class="table table-striped table-bordered">
|
6
15
|
<thead>
|
7
16
|
<tr>
|
8
|
-
<th scope="col">
|
17
|
+
<th scope="col">Completed Date</th>
|
9
18
|
<th scope="col">Trade hash</th>
|
19
|
+
<th scope="col">Fiat</th>
|
20
|
+
<th scope="col">Crypto</th>
|
10
21
|
<th scope="col">Type</th>
|
11
22
|
<th scope="col">Status</th>
|
12
|
-
<th scope="col">Seller</th>
|
13
|
-
<th scope="col">Buyer</th>
|
14
23
|
<th scope="col"></th>
|
15
24
|
</tr>
|
16
25
|
</thead>
|
@@ -23,14 +32,14 @@
|
|
23
32
|
|
24
33
|
<% @trades.each do |trade| %>
|
25
34
|
<tr scope="row">
|
26
|
-
<td> <%= trade.
|
35
|
+
<td> <%= trade.completed_at&.strftime("%m/%d/%Y %I:%M%p") || "-" %> </td>
|
27
36
|
<td> <%= trade.trade_hash %> </td>
|
37
|
+
<td> <%= number_to_currency(trade.fiat_amount_requested, unit: "#{trade.fiat_currency_code} ") %> </td>
|
38
|
+
<td> <%= trade.crypto_currency_code %> <%= trade.base_crypto_requested %> </td>
|
28
39
|
<td> <%= trade.offer_type.upcase %> </td>
|
29
40
|
<td>
|
30
41
|
<span class="<%= highlight_status(trade) %>"> <%= trade.status.upcase %> </span>
|
31
42
|
</td>
|
32
|
-
<td> <%= trade.seller %> </td>
|
33
|
-
<td> <%= trade.buyer %> </td>
|
34
43
|
<td> <%= link_to "Check trade details", paxful_engine.trade_path(trade) %> </td>
|
35
44
|
</tr>
|
36
45
|
<% end %>
|
@@ -20,8 +20,8 @@
|
|
20
20
|
</div>
|
21
21
|
<div>
|
22
22
|
<strong>Crypto Requested:</strong>
|
23
|
-
<%=
|
24
|
-
(in sats)
|
23
|
+
<%= @trade.crypto_currency_code %> <%= @trade.base_crypto_requested %>
|
24
|
+
(<%= number_to_currency(@trade.crypto_amount_requested, unit: "") %> in sats)
|
25
25
|
</div>
|
26
26
|
</div>
|
27
27
|
|
@@ -0,0 +1,16 @@
|
|
1
|
+
FactoryBot.define do
|
2
|
+
|
3
|
+
factory :paxful_engine_trade, class: "PaxfulEngine::Trade" do
|
4
|
+
trade_hash { "trade-hash" }
|
5
|
+
offer_hash { "offer-hash" }
|
6
|
+
offer_type { "buy" }
|
7
|
+
crypto_amount_requested { 0.05 }
|
8
|
+
crypto_currency_code { "BTC" }
|
9
|
+
fiat_amount_requested { 1_000 }
|
10
|
+
fiat_currency_code { "PHP" }
|
11
|
+
started_at { Time.current }
|
12
|
+
ended_at { Time.current + 2.days }
|
13
|
+
status { "successful" }
|
14
|
+
end
|
15
|
+
|
16
|
+
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.
|
4
|
+
version: 0.9.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-
|
11
|
+
date: 2020-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gem_config
|
@@ -81,7 +81,7 @@ dependencies:
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '2.5'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: factory_bot_rails
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - ">="
|
@@ -194,6 +194,7 @@ files:
|
|
194
194
|
- lib/paxful_engine-rails.rb
|
195
195
|
- lib/paxful_engine.rb
|
196
196
|
- lib/paxful_engine/engine.rb
|
197
|
+
- lib/paxful_engine/factories.rb
|
197
198
|
- lib/paxful_engine/version.rb
|
198
199
|
- lib/tasks/paxful_engine_tasks.rake
|
199
200
|
homepage: https://github.com/bloom-solutions/paxful_engine-rails
|