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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e1b07c79152a0e9d297bd7bd4e6895f3e594cd4b308028a4bc0a67ffe685075f
4
- data.tar.gz: 880e805c345090fccc40d0555f4b07254d8375977693ff2f1228ffe79795e190
3
+ metadata.gz: ff9e8f4e220dc9d5141eb07a899fd2fbb88116f105ef030808b4436d7f600a38
4
+ data.tar.gz: ad6e6e4092f4665871cd2a401105203a0bdb183b02368329d1c7254802d38821
5
5
  SHA512:
6
- metadata.gz: 5a8cafa05d39f5b146b5220032498c67cda837844653a47f5c649eca38e0011b01a8098b822d62b02cda45fb8c517e06c01e54a17a3177b96de04e8063dfc383
7
- data.tar.gz: 1faf67ac478fc2b17a0b257be6486c3389749c867cc003de0ba37aff4abee9f08a4cc2dabb7fee60b9d48adce9336777b45c78391dae1cf41488fe08a468e56d
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("completed_at DESC, created_at DESC")
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
@@ -29,5 +29,9 @@ module PaxfulEngine
29
29
  offer_type.downcase == "sell"
30
30
  end
31
31
 
32
+ def base_crypto_requested
33
+ BigDecimal(crypto_amount_requested) / 100_000_000
34
+ end
35
+
32
36
  end
33
37
  end
@@ -1,17 +1,25 @@
1
- <span class="font-weight-bold"> Found <%= pluralize(@trades.count, "trade") %></span>
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">Created</th>
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.created_at.strftime("%m/%d/%Y %I:%M%p") %> </td>
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
- <%= number_to_currency(@trade.crypto_amount_requested, unit: "#{@trade.crypto_currency_code} ") %>
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> <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>
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 />
@@ -1,3 +1,3 @@
1
1
  module PaxfulEngine
2
- VERSION = '0.7.0'
2
+ VERSION = '1.0.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.7.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-05 00:00:00.000000000 Z
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: 0.3.0
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: 0.3.0
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
- rubyforge_project:
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.