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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fb90688726d3d85a6c9f1b0e243955f3977f11483d41886b0ccf43b15dcc4b6e
4
- data.tar.gz: 16de8f670bfdb81d21d3bc0b0e1ff94bb4f7ca0811c0d91d3b714b6ceb0f73d0
3
+ metadata.gz: d2d1a02a0cb8692da174f85cc87d3ce606f053ea601db8639871a9c9fcdaa303
4
+ data.tar.gz: 45ca9095d7a1e3d7c3ffb049a8c6724b83efb58b6c7e4f4f2a98606277dfaea9
5
5
  SHA512:
6
- metadata.gz: b64b219d335b96a57d8419730947f12e1723f9a88e70d9019f9c4f6d763e94406e87d571fef4be875242d0440459322d4d7e14a2db3be481470ef3e8b0b606c1
7
- data.tar.gz: 914858b8aeb7cc2d15260d8e62d2971aff81cda741bc176c69fc62c6c184d21bb38093c68d6544134054651e64b0324988b1f5bf76144a8758b5aec776cf6dd7
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.all
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
@@ -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,16 +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>
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.created_at.strftime("%m/%d/%Y %I:%M%p") %> </td>
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
- <%= 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
 
@@ -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
@@ -1,3 +1,3 @@
1
1
  module PaxfulEngine
2
- VERSION = '0.5.0'
2
+ VERSION = '0.9.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.5.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-10-28 00:00:00.000000000 Z
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: factory_bot
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