paxful_engine-rails 0.7.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -2
- data/app/controllers/paxful_engine/trades_controller.rb +5 -1
- data/app/helpers/paxful_engine/application_helper.rb +5 -0
- data/app/models/paxful_engine/trade.rb +4 -0
- data/app/views/paxful_engine/trades/index.html.erb +16 -9
- data/app/views/paxful_engine/trades/show.html.erb +14 -5
- data/lib/paxful_engine/version.rb +1 -1
- metadata +5 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff9e8f4e220dc9d5141eb07a899fd2fbb88116f105ef030808b4436d7f600a38
|
4
|
+
data.tar.gz: ad6e6e4092f4665871cd2a401105203a0bdb183b02368329d1c7254802d38821
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2bda9712a570a0bef6e11f1bdb6e06189d4983c56d32efa1280c5535d14c80cfedc5292ec3b34e68e9e20d9269197e9cc8889523afc73a96c8c041e519c80166
|
7
|
+
data.tar.gz: 27da095e39ac9e7de6e816f5bd50d800622c32310af10499d7fd6248fd4d89a94bc68489d6eb0acf9627aae7bb04ef3ac327b1300794c4c74b1f9540027e5f7d
|
data/README.md
CHANGED
@@ -91,10 +91,11 @@ From the host app:
|
|
91
91
|
### Development
|
92
92
|
|
93
93
|
```
|
94
|
-
$ rails db:migrate
|
95
|
-
$ rails db:migrate db:test:prepare
|
94
|
+
$ rails db:create db:migrate db:test:prepare
|
96
95
|
```
|
97
96
|
|
97
|
+
If you need to re-record cassettes, `cp .env{,.local}` and edit the values.
|
98
|
+
|
98
99
|
### Testing
|
99
100
|
|
100
101
|
```
|
@@ -2,7 +2,11 @@ module PaxfulEngine
|
|
2
2
|
class TradesController < ApplicationController
|
3
3
|
|
4
4
|
def index
|
5
|
-
@trades = Trade.order(
|
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
|
@@ -6,5 +6,10 @@ module PaxfulEngine
|
|
6
6
|
status == "successful" ? "text-success" : "text-danger"
|
7
7
|
end
|
8
8
|
|
9
|
+
def format_datetime(datetime, timezone = "Asia/Manila")
|
10
|
+
return "-" if datetime.nil?
|
11
|
+
datetime.in_time_zone(timezone).strftime("%m/%d/%Y %I:%M%p")
|
12
|
+
end
|
13
|
+
|
9
14
|
end
|
10
15
|
end
|
@@ -1,17 +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">
|
9
|
-
<th scope="col">Completed</th>
|
17
|
+
<th scope="col">Completed Date</th>
|
10
18
|
<th scope="col">Trade hash</th>
|
19
|
+
<th scope="col">Fiat</th>
|
20
|
+
<th scope="col">Crypto</th>
|
11
21
|
<th scope="col">Type</th>
|
12
22
|
<th scope="col">Status</th>
|
13
|
-
<th scope="col">Seller</th>
|
14
|
-
<th scope="col">Buyer</th>
|
15
23
|
<th scope="col"></th>
|
16
24
|
</tr>
|
17
25
|
</thead>
|
@@ -24,15 +32,14 @@
|
|
24
32
|
|
25
33
|
<% @trades.each do |trade| %>
|
26
34
|
<tr scope="row">
|
27
|
-
<td> <%= trade.
|
28
|
-
<td> <%= trade.completed_at&.strftime("%m/%d/%Y %I:%M%p") || "-" %> </td>
|
35
|
+
<td> <%= format_datetime(trade.completed_at) %> </td>
|
29
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>
|
30
39
|
<td> <%= trade.offer_type.upcase %> </td>
|
31
40
|
<td>
|
32
41
|
<span class="<%= highlight_status(trade) %>"> <%= trade.status.upcase %> </span>
|
33
42
|
</td>
|
34
|
-
<td> <%= trade.seller %> </td>
|
35
|
-
<td> <%= trade.buyer %> </td>
|
36
43
|
<td> <%= link_to "Check trade details", paxful_engine.trade_path(trade) %> </td>
|
37
44
|
</tr>
|
38
45
|
<% end %>
|
@@ -20,17 +20,26 @@
|
|
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
|
|
28
28
|
<hr />
|
29
29
|
|
30
30
|
<div>
|
31
|
-
<div>
|
32
|
-
|
33
|
-
|
31
|
+
<div>
|
32
|
+
<strong>Started at:</strong>
|
33
|
+
<%= format_datetime(@trade.started_at) %>
|
34
|
+
</div>
|
35
|
+
<div>
|
36
|
+
<strong>Ended at:</strong>
|
37
|
+
<%= format_datetime(@trade.ended_at) %>
|
38
|
+
</div>
|
39
|
+
<div>
|
40
|
+
<strong>Completed at:</strong>
|
41
|
+
<%= format_datetime(@trade.completed_at) %>
|
42
|
+
</div>
|
34
43
|
</div>
|
35
44
|
|
36
45
|
<hr />
|
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: 1.0.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-
|
11
|
+
date: 2020-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gem_config
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: '1.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: '1.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rails
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -217,8 +217,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
217
217
|
- !ruby/object:Gem::Version
|
218
218
|
version: '0'
|
219
219
|
requirements: []
|
220
|
-
|
221
|
-
rubygems_version: 2.7.6
|
220
|
+
rubygems_version: 3.0.8
|
222
221
|
signing_key:
|
223
222
|
specification_version: 4
|
224
223
|
summary: Mountable engine that fetches completed paxful trades.
|