brainblocks-rails 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/brainblocks-rails/brainblocks_rails_helper.rb +24 -34
- data/lib/brainblocks-rails/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f37b858188c42062d955c16b8a999c2ff804ea9
|
4
|
+
data.tar.gz: 1fc4891c21acce2922c118715bda37eaed0a48f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8dc2c959d114bab193fc46969696cc6f0be50876999a5441c14e775ba7f4698590913e4e9e28865fdb98cfc0cce0064ffc606a0531724c47a1b9a680f5baaff3
|
7
|
+
data.tar.gz: 7865e3e90cde780fb8c01be3078988a2a6240ce114e247ef6b117687d82bfb2f355f959d05002d3077b184762a66459794b0a319781b1c4456d043642fc690d6
|
@@ -1,34 +1,24 @@
|
|
1
|
-
module BrainblocksHelper
|
2
|
-
def brainblocks(wallet
|
3
|
-
@brainblocks_id ||= -1
|
4
|
-
|
5
|
-
element = "brainblocks-#{@brainblocks_id += 1}"
|
6
|
-
button = tag.div id: element
|
7
|
-
|
8
|
-
script = javascript_tag do
|
9
|
-
<<-END.squish.html_safe
|
10
|
-
brainblocks.Button.render({
|
11
|
-
payment: {
|
12
|
-
destination: '#{wallet}',
|
13
|
-
currency: '#{currency}',
|
14
|
-
amount: #{amount}
|
15
|
-
}, onPayment: function(data) {
|
16
|
-
#{on_success}
|
17
|
-
}
|
18
|
-
}, '##{element}');
|
19
|
-
END
|
20
|
-
end
|
21
|
-
|
22
|
-
button + script
|
23
|
-
end
|
24
|
-
|
25
|
-
def brainblocks_is_fulfilled?(token)
|
26
|
-
uri = URI.parse("https://brainblocks.io/api/session/#{token}/verify")
|
27
|
-
response = Net::HTTP.get_response(uri)
|
28
|
-
|
29
|
-
# url = "https://brainblocks.io/api/session/#{token}/verify"
|
30
|
-
# data = JSON(open(url).read)
|
31
|
-
|
32
|
-
return true if response[:fulfilled] == true
|
33
|
-
end
|
34
|
-
end
|
1
|
+
module BrainblocksHelper
|
2
|
+
def brainblocks(wallet = "xrb_1xau1obw9u14ung8okbstmh4wmc63iw9y5cq3way3pbkj4krh9j15f4j7dnz", amount = 1000, currency = "rai", on_success = "console.log('Payment successful!', data.token);")
|
3
|
+
@brainblocks_id ||= -1
|
4
|
+
|
5
|
+
element = "brainblocks-#{@brainblocks_id += 1}"
|
6
|
+
button = tag.div id: element
|
7
|
+
|
8
|
+
script = javascript_tag do
|
9
|
+
<<-END.squish.html_safe
|
10
|
+
brainblocks.Button.render({
|
11
|
+
payment: {
|
12
|
+
destination: '#{wallet}',
|
13
|
+
currency: '#{currency}',
|
14
|
+
amount: #{amount}
|
15
|
+
}, onPayment: function(data) {
|
16
|
+
#{on_success}
|
17
|
+
}
|
18
|
+
}, '##{element}');
|
19
|
+
END
|
20
|
+
end
|
21
|
+
|
22
|
+
button + script
|
23
|
+
end
|
24
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brainblocks-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mitchel
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-03-
|
11
|
+
date: 2018-03-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|