openassets-ruby 0.4.7 → 0.4.8

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
  SHA1:
3
- metadata.gz: 373d3c6333cae6c3f7b59ab0c5b655016d97a246
4
- data.tar.gz: f2893fc9d18904df4ea8120d6d9cf88a955021e9
3
+ metadata.gz: eb5b3172c23e5d191c18aa42e79e1de8e48a21d7
4
+ data.tar.gz: 8c87ab5668d6d74bb0c26c55d76860a1c595ac42
5
5
  SHA512:
6
- metadata.gz: 1eded75af7ea679718ce74292b4cd2c4a74fa0e84788ec760061d587d2d729d00fe43ca0dfd046991cf56c225384d3ecb5010ba4a53540dd9e6f612fe81bf952
7
- data.tar.gz: 24180dbf44cdadd4ccf2daf36bdce9e3fcf9abcab72654a677dbaa58e6cf02af1335a0f4b4c6f9273c7dca4827d1409961ca4aab2bb333742291c2af3465be95
6
+ metadata.gz: 18c7d2be10311c301263af5669bf58548dccfae38101540bbd6722a78c0f73963b1013daf15846896c371eac62204c9cecd434eeedb0e62d14da845bc0f89567
7
+ data.tar.gz: 02d1eccbeb770aaadc29082629264f283959def62ace6d3ade800d1fb7f83b5ad29e2083d20411a64fe8757dbd7a7f786b5fc92e586f3371b4a153d1bcced68d
@@ -0,0 +1,9 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.3.0
4
+ - 2.2.2
5
+
6
+ bundler_args: --jobs=2
7
+
8
+ script:
9
+ - bundle exec rake spec
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # openassets-ruby
1
+ # openassets-ruby [![Build Status](https://travis-ci.org/haw-itn/openassets-ruby.svg?branch=master)](https://travis-ci.org/haw-itn/openassets-ruby) [![Gem Version](https://badge.fury.io/rb/openassets-ruby.svg)](https://badge.fury.io/rb/openassets-ruby) [![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](LICENSE)
2
2
  The implementation of the Open Assets Protocol for Ruby.
3
3
 
4
4
  ## Install
@@ -18,7 +18,7 @@ require 'openassets'
18
18
  api = OpenAssets::Api.new({:network => 'mainnet',
19
19
  :provider => 'bitcoind', :cache => 'cache.db',
20
20
  :dust_limit => 600, :default_fees => 10000, :min_confirmation => 1, :max_confirmation => 9999999,
21
- :rpc => {:user => 'xxx', :password => 'xxx', :schema => 'http', :port => 8332, :host => 'localhost'}})
21
+ :rpc => {:user => 'xxx', :password => 'xxx', :schema => 'http', :port => 8332, :host => 'localhost', :timeout => 60, :open_timeout => 60}})
22
22
  ```
23
23
 
24
24
  * **use testnet**
@@ -29,7 +29,7 @@ require 'openassets'
29
29
  api = OpenAssets::Api.new({:network => 'testnet',
30
30
  :provider => 'bitcoind', :cache => 'testnet.db',
31
31
  :dust_limit => 600, :default_fees => 10000, :min_confirmation => 1, :max_confirmation => 9999999,
32
- :rpc => {:user => 'xxx', :password => 'xxx', :schema => 'http', :port => 18332, :host => 'localhost'}})
32
+ :rpc => {:user => 'xxx', :password => 'xxx', :schema => 'http', :port => 18332, :host => 'localhost', :timeout => 60, :open_timeout => 60}})
33
33
  ```
34
34
 
35
35
  The configuration options are as follows:
data/Rakefile CHANGED
@@ -1,5 +1,6 @@
1
1
  require "bundler/gem_tasks"
2
2
  require "rspec/core/rake_task"
3
+ require "octorelease"
3
4
 
4
5
  RSpec::Core::RakeTask.new("spec")
5
6
  task :default => :spec
@@ -18,7 +18,7 @@ module OpenAssets
18
18
  @config = {:network => 'mainnet',
19
19
  :provider => 'bitcoind', :cache => 'cache.db',
20
20
  :dust_limit => 600, :default_fees => 10000, :min_confirmation => 1, :max_confirmation => 9999999,
21
- :rpc => { :host => 'localhost', :port => 8332 , :user => '', :password => '', :schema => 'https'}}
21
+ :rpc => { :host => 'localhost', :port => 8332 , :user => '', :password => '', :schema => 'https', :timeout => 60, :open_timeout => 60}}
22
22
  if config
23
23
  @config.update(config)
24
24
  end
@@ -64,6 +64,12 @@ module OpenAssets
64
64
  request('sendrawtransaction', tx)
65
65
  end
66
66
 
67
+ # Adds an address or pubkey script to the wallet without the associated private key, allowing you to watch for transactions affecting that address or pubkey script without being able to spend any of its outputs.
68
+ # @param [String] address Either a P2PKH or P2SH address encoded in base58check, or a pubkey script encoded as hex.
69
+ def import_address(address)
70
+ request('importaddress', address)
71
+ end
72
+
67
73
  def method_missing(method, *params)
68
74
  super unless RPC_API.include?(method)
69
75
  request(method, *params)
@@ -105,13 +111,17 @@ module OpenAssets
105
111
  :params => params,
106
112
  :id => 'jsonrpc'
107
113
  }
108
- RestClient.post(server_url, data.to_json, content_type: :json) do |respdata, request, result|
114
+ post(server_url, @config[:timeout], @config[:open_timeout], data.to_json, content_type: :json) do |respdata, request, result|
109
115
  response = JSON.parse(respdata.gsub(/\\u([\da-fA-F]{4})/) { [$1].pack('H*').unpack('n*').pack('U*').encode('ISO-8859-1').force_encoding('UTF-8') })
110
116
  raise ApiError, response['error'] if response['error']
111
117
  response['result']
112
118
  end
113
119
  end
114
120
 
121
+ def post(url, timeout, open_timeout, payload, headers={}, &block)
122
+ RestClient::Request.execute(:method => :post, :url => url, :timeout => timeout, :open_timeout => open_timeout, :payload => payload, :headers => headers, &block)
123
+ end
124
+
115
125
  end
116
126
  end
117
127
  end
@@ -1,3 +1,3 @@
1
1
  module OpenAssets
2
- VERSION = '0.4.7'
2
+ VERSION = '0.4.8'
3
3
  end
@@ -27,4 +27,6 @@ Gem::Specification.new do |spec|
27
27
  spec.add_development_dependency "rake", "~> 10.0"
28
28
  spec.add_development_dependency "rspec"
29
29
  spec.add_development_dependency "timecop"
30
+ spec.add_development_dependency "octorelease"
31
+
30
32
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openassets-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.7
4
+ version: 0.4.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - azuchi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-06-10 00:00:00.000000000 Z
11
+ date: 2016-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bitcoin-ruby
@@ -136,6 +136,20 @@ dependencies:
136
136
  - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: octorelease
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
139
153
  description: The implementation of the Open Assets Protocol for Ruby.
140
154
  email:
141
155
  - azuchi@haw.co.jp
@@ -148,6 +162,7 @@ files:
148
162
  - ".rspec"
149
163
  - ".ruby-gemset"
150
164
  - ".ruby-version"
165
+ - ".travis.yml"
151
166
  - CODE_OF_CONDUCT.md
152
167
  - Gemfile
153
168
  - LICENSE