This repository was archived by the owner on Feb 11, 2025. It is now read-only.
File tree 6 files changed +72
-4
lines changed
6 files changed +72
-4
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ Bundler.require :default
5
5
6
6
require File . dirname ( __FILE__ ) + "/../lib/bitpay-ruby"
7
7
8
+ BitPayRuby ::config = YAML . load_file ( File . dirname ( __FILE__ ) + "/../config/bitpay-ruby.yml" )
9
+
8
10
require "optparse"
9
11
10
12
begin
Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ Bundler.require :default
5
5
6
6
require File . dirname ( __FILE__ ) + "/../lib/bitpay-ruby"
7
7
8
+ BitPayRuby ::config = YAML . load_file ( File . dirname ( __FILE__ ) + "/../config/bitpay-ruby.yml" )
9
+
8
10
require "optparse"
9
11
10
12
begin
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler"
4
+ Bundler . require :default
5
+
6
+ require File . dirname ( __FILE__ ) + "/../lib/bitpay-ruby"
7
+
8
+ BitPayRuby ::config = YAML . load_file ( File . dirname ( __FILE__ ) + "/../config/bitpay-ruby.yml" )
9
+
10
+ require "optparse"
11
+
12
+ begin
13
+ options = { }
14
+ optparse = OptionParser . new do |opts |
15
+ opts . banner = "Usage: #{ $0} [options]"
16
+
17
+ # specify an API key
18
+ opts . on ( "-a" , "--api-key API_KEY" , "Specify an API key." ) do |api_key |
19
+ options [ :api_key ] = api_key
20
+ end
21
+ opts . on ( "-r" , "--receive" , "Receive invoice status updates." ) do
22
+ exit
23
+ end
24
+
25
+ # version
26
+ opts . on ( "-v" , "--version" , "Show the version number." ) do
27
+ $stdout. puts "0.1.0"
28
+ exit
29
+ end
30
+
31
+ # help
32
+ opts . on ( "-h" , "--help" , "Show this help message." ) do
33
+ $stdout. puts opts
34
+ exit
35
+ end
36
+ end
37
+
38
+ optparse . parse!
39
+
40
+ require "sinatra"
41
+ require "webrick/https"
42
+
43
+ class App < Sinatra ::Base
44
+ post "/" do
45
+ params . to_json
46
+ end
47
+ end
48
+
49
+ webrick_options = {
50
+ :server => "webrick" ,
51
+ :Port => 8443 ,
52
+ :SSLEnable => true ,
53
+ :SSLVerifyClient => OpenSSL ::SSL ::VERIFY_NONE ,
54
+ :SSLCertificate => OpenSSL ::X509 ::Certificate . new ( File . open ( "./config/ssl-cert.pem" ) . read ) ,
55
+ :SSLPrivateKey => OpenSSL ::PKey ::RSA . new ( File . open ( "./config/ssl-key.pem" ) . read ) ,
56
+ :SSLCertName => [ [ "CN" , WEBrick ::Utils ::getservername ] ] ,
57
+ :app => App
58
+ }
59
+
60
+ Rack ::Server . start webrick_options
61
+ exit
62
+ rescue BitPayRuby ::BitPayRubyError => e
63
+ $stderr. puts e . message
64
+ exit e . status_code
65
+ rescue Interrupt => e
66
+ exit 1
67
+ end
Original file line number Diff line number Diff line change 1
1
api_endpoint : https://bitpay.com/api
2
- api_key:
2
+ api_key :
Original file line number Diff line number Diff line change @@ -22,8 +22,6 @@ def connection
22
22
end
23
23
end
24
24
25
- BitPayRuby ::config = YAML . load_file ( File . dirname ( __FILE__ ) + "/../config/bitpay-ruby.yml" )
26
-
27
25
require File . join File . dirname ( __FILE__ ) , "bitpay-ruby" , "version"
28
26
require File . join File . dirname ( __FILE__ ) , "bitpay-ruby" , "logging"
29
27
Original file line number Diff line number Diff line change @@ -27,7 +27,6 @@ def create
27
27
"price" => price ,
28
28
"currency" => currency
29
29
}
30
-
31
30
update! response . body
32
31
self
33
32
end
You can’t perform that action at this time.
0 commit comments