blockstream_satellite 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +11 -10
- data/README.md +13 -2
- data/blockstream_satellite.gemspec +1 -1
- data/lib/blockstream_satellite.rb +1 -1
- data/lib/blockstream_satellite/client.rb +2 -2
- data/lib/blockstream_satellite/order.rb +3 -8
- data/lib/blockstream_satellite/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 41b8b2bad983625b55eafad895392edac7e013df9d9baaa38d446e962debcba8
|
4
|
+
data.tar.gz: 2fb2ff56beb68f23e00070f9bc3544f6d3fbe845d26f938b8f554c154e9e0495
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b94d293f3b3494dc365614673c45259a872febd76929cccb5f3d0b8f112e834ddcbdd8f369f25790e7e84533fa99666f942ddd67092185e58d6f7af5c7d118f2
|
7
|
+
data.tar.gz: fa85a0a2705508c51f95206c5ab1416fc84ca63663944deca69d346c440335099aeb9af0d791cee346e1f1c6d2e86aaf82431d31830ca0f2118acedef799e0bc
|
data/Gemfile.lock
CHANGED
@@ -1,36 +1,37 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
blockstream_satellite (0.1.
|
4
|
+
blockstream_satellite (0.1.1)
|
5
5
|
activesupport (>= 5.0.1)
|
6
6
|
faraday (> 0.8)
|
7
7
|
faraday_middleware (> 0.12)
|
8
|
-
lnrpc (>= 0.
|
8
|
+
lnrpc (>= 0.5.2)
|
9
9
|
|
10
10
|
GEM
|
11
11
|
remote: https://rubygems.org/
|
12
12
|
specs:
|
13
|
-
activesupport (5.2.2)
|
13
|
+
activesupport (5.2.2.1)
|
14
14
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
15
15
|
i18n (>= 0.7, < 2)
|
16
16
|
minitest (~> 5.1)
|
17
17
|
tzinfo (~> 1.1)
|
18
|
-
concurrent-ruby (1.1.
|
18
|
+
concurrent-ruby (1.1.5)
|
19
19
|
diff-lcs (1.3)
|
20
20
|
faraday (0.15.4)
|
21
21
|
multipart-post (>= 1.2, < 3)
|
22
22
|
faraday_middleware (0.13.1)
|
23
23
|
faraday (>= 0.7.4, < 1.0)
|
24
|
-
google-protobuf (3.
|
24
|
+
google-protobuf (3.7.0)
|
25
25
|
googleapis-common-protos-types (1.0.3)
|
26
26
|
google-protobuf (~> 3.0)
|
27
|
-
grpc (1.
|
27
|
+
grpc (1.19.0)
|
28
28
|
google-protobuf (~> 3.1)
|
29
29
|
googleapis-common-protos-types (~> 1.0.0)
|
30
|
-
i18n (1.
|
30
|
+
i18n (1.6.0)
|
31
31
|
concurrent-ruby (~> 1.0)
|
32
|
-
lnrpc (0.
|
33
|
-
|
32
|
+
lnrpc (0.5.2)
|
33
|
+
google-protobuf (>= 3.7)
|
34
|
+
grpc (>= 1.19.0)
|
34
35
|
minitest (5.11.3)
|
35
36
|
multipart-post (2.0.0)
|
36
37
|
rake (10.5.0)
|
@@ -61,4 +62,4 @@ DEPENDENCIES
|
|
61
62
|
rspec (~> 3.0)
|
62
63
|
|
63
64
|
BUNDLED WITH
|
64
|
-
1.17.
|
65
|
+
1.17.3
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# Blockstream Satellite - with ruby to space and back
|
2
2
|
|
3
3
|
Ruby gem to interact with the [Blockstream Satellite](https://blockstream.com/satellite/) API.
|
4
4
|
|
@@ -16,12 +16,16 @@ Or install it yourself as:
|
|
16
16
|
|
17
17
|
$ gem install blockstream_satellite
|
18
18
|
|
19
|
+
**Because of an [protobuf issue with Ruby 2.6](https://github.com/protocolbuffers/protobuf/issues/5161) a ruby version < 2.6 is required**
|
20
|
+
|
19
21
|
|
20
22
|
## Usage
|
21
23
|
|
22
24
|
### Quick example
|
23
25
|
|
24
26
|
```ruby
|
27
|
+
require "blockstream_satellite"
|
28
|
+
|
25
29
|
order = BlockstreamSatellite::Order.create(path: '/path/to/file')
|
26
30
|
puts order.status # pending
|
27
31
|
order.pay # sends the lightning payment using the configured lnd client; request is synchronous
|
@@ -81,10 +85,17 @@ order.pay
|
|
81
85
|
puts order.status
|
82
86
|
```
|
83
87
|
|
88
|
+
### Missing endpoints:
|
89
|
+
|
90
|
+
* DELETE /order/:uuid
|
91
|
+
* GET /orders/queued
|
92
|
+
* GET /orders/sent
|
93
|
+
* GET /subscribe/:channels
|
84
94
|
|
85
95
|
## Status
|
86
96
|
|
87
|
-
Currently I consider this gem experimental and
|
97
|
+
Currently I consider this gem **experimental** and the codes needs cleanup and tests and docs are missing at this moment.
|
98
|
+
Will try to get is stable soon!
|
88
99
|
|
89
100
|
|
90
101
|
## Contributing
|
@@ -39,6 +39,6 @@ Gem::Specification.new do |spec|
|
|
39
39
|
spec.add_development_dependency "rspec", "~> 3.0"
|
40
40
|
spec.add_dependency "faraday", "> 0.8"
|
41
41
|
spec.add_dependency "faraday_middleware", ">0.12"
|
42
|
-
spec.add_dependency "lnrpc", ">= 0.
|
42
|
+
spec.add_dependency "lnrpc", ">= 0.5.2"
|
43
43
|
spec.add_dependency "activesupport", ">= 5.0.1"
|
44
44
|
end
|
@@ -9,7 +9,7 @@ module BlockstreamSatellite
|
|
9
9
|
autoload :Configuration, 'blockstream_satellite/configuration'
|
10
10
|
autoload :Response, 'blockstream_satellite/response'
|
11
11
|
|
12
|
-
API_HOST = 'https://
|
12
|
+
API_HOST = 'https://api.blockstream.space'
|
13
13
|
|
14
14
|
def self.lnd_client=(value)
|
15
15
|
@lnd_client = value
|
@@ -19,12 +19,12 @@ module BlockstreamSatellite
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def pay(payreq)
|
22
|
-
self.lnd_client.send_payment_sync(
|
22
|
+
self.lnd_client.send_payment_sync(payment_request: payreq)
|
23
23
|
end
|
24
24
|
|
25
25
|
def request(http_method, path, params=nil, body=nil)
|
26
26
|
response = http_client.send(http_method) do |req|
|
27
|
-
req.url "
|
27
|
+
req.url "/#{path}"
|
28
28
|
req.params = params if params
|
29
29
|
req.body = body if body
|
30
30
|
yield req if block_given?
|
@@ -25,16 +25,11 @@ module BlockstreamSatellite
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def self.create(options)
|
28
|
-
if
|
29
|
-
file =
|
30
|
-
file.write(data)
|
31
|
-
file.rewind
|
32
|
-
options[:file] = file
|
33
|
-
elsif path = options.delete(:path)
|
28
|
+
if path = options.delete(:path)
|
29
|
+
options[:file] = UploadIO.new(options[:file], 'text/plain') # TODO: get rid of this content type here
|
34
30
|
options[:file] = File.open(path)
|
35
31
|
end
|
36
|
-
options[:bid] ||= options[:file].size * 51 # default price
|
37
|
-
options[:file] = UploadIO.new(options[:file], 'text/plain')
|
32
|
+
options[:bid] ||= (options[:file] || options[:message]).size * 51 # default price
|
38
33
|
response = BlockstreamSatellite.client.post('order', options)
|
39
34
|
if response.success?
|
40
35
|
Order.new(response.body).tap { |o| o.file = options[:file] }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blockstream_satellite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Bumann
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-03-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -86,14 +86,14 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 0.
|
89
|
+
version: 0.5.2
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 0.
|
96
|
+
version: 0.5.2
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: activesupport
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|