coinprism 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4917fff1b771112460da3c2380f741e40eb7984f
4
+ data.tar.gz: 36391d759df4e50792e872a4cf1ad3cf0e7e7f28
5
+ SHA512:
6
+ metadata.gz: da2fab6bb5adc563fb3982d7d86c75fbcc4dd8672a203245fcae0772384aad4a00a444bf3683b4c1761437c3adc7787af635a8df1a43e3a6712cb621ffb12153
7
+ data.tar.gz: 89bdda72b9200083876fa1eeaa882feb5e158c74350bdc6447c541ed2d9820128ce5f4eac7d670b486fa58dc3b45a928e80a2315fe3a81990f3317df6d548076
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/Gemfile ADDED
@@ -0,0 +1,37 @@
1
+ source 'https://rubygems.org'
2
+ ruby '2.2.1'
3
+
4
+ gem 'rest-client', '~> 1'
5
+ gem 'rake', '~> 10'
6
+
7
+ group :development do
8
+ gem 'awesome_print', :require => 'ap'
9
+ gem 'guard-rspec', '~> 4.5'
10
+ gem 'guard-bundler'
11
+
12
+ gem 'rb-fchange', :require=>false
13
+ gem 'rb-fsevent', :require=>false
14
+ gem 'rb-inotify', :require=>false
15
+
16
+ gem 'hirb-unicode'
17
+ gem 'pry'
18
+ gem 'redcarpet'
19
+ gem 'wirb'
20
+ gem 'wirble'
21
+ gem 'yard'
22
+ gem 'jeweler'
23
+ end
24
+
25
+
26
+ group :test do
27
+ gem 'coveralls', :require => false
28
+ gem 'json', :platforms => [:jruby]
29
+ gem 'multi_json', '~> 1.11.0'
30
+ gem 'mime-types', '< 2.0.0'
31
+ gem 'netrc', '~> 0.7.7'
32
+ gem 'rspec', '~> 3.0.0'
33
+ gem 'shoulda'
34
+ gem 'simplecov', :require => false
35
+ gem 'vcr', '~> 2.9.2'
36
+ gem 'webmock', '>= 1.9'
37
+ end
@@ -0,0 +1,198 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ activesupport (4.2.5)
5
+ i18n (~> 0.7)
6
+ json (~> 1.7, >= 1.7.7)
7
+ minitest (~> 5.1)
8
+ thread_safe (~> 0.3, >= 0.3.4)
9
+ tzinfo (~> 1.1)
10
+ addressable (2.3.8)
11
+ awesome_print (1.6.1)
12
+ builder (3.2.2)
13
+ coderay (1.1.0)
14
+ coveralls (0.8.9)
15
+ json (~> 1.8)
16
+ rest-client (>= 1.6.8, < 2)
17
+ simplecov (~> 0.10.0)
18
+ term-ansicolor (~> 1.3)
19
+ thor (~> 0.19.1)
20
+ tins (~> 1.6.0)
21
+ crack (0.4.2)
22
+ safe_yaml (~> 1.0.0)
23
+ descendants_tracker (0.0.4)
24
+ thread_safe (~> 0.3, >= 0.3.1)
25
+ diff-lcs (1.2.5)
26
+ docile (1.1.5)
27
+ domain_name (0.5.25)
28
+ unf (>= 0.0.5, < 1.0.0)
29
+ faraday (0.9.2)
30
+ multipart-post (>= 1.2, < 3)
31
+ ffi (1.9.10)
32
+ formatador (0.2.5)
33
+ git (1.2.9.1)
34
+ github_api (0.13.0)
35
+ addressable (~> 2.3)
36
+ descendants_tracker (~> 0.0.4)
37
+ faraday (~> 0.8, < 0.10)
38
+ hashie (>= 3.4)
39
+ multi_json (>= 1.7.5, < 2.0)
40
+ nokogiri (~> 1.6.6)
41
+ oauth2
42
+ guard (2.13.0)
43
+ formatador (>= 0.2.4)
44
+ listen (>= 2.7, <= 4.0)
45
+ lumberjack (~> 1.0)
46
+ nenv (~> 0.1)
47
+ notiffany (~> 0.0)
48
+ pry (>= 0.9.12)
49
+ shellany (~> 0.0)
50
+ thor (>= 0.18.1)
51
+ guard-bundler (2.1.0)
52
+ bundler (~> 1.0)
53
+ guard (~> 2.2)
54
+ guard-compat (~> 1.1)
55
+ guard-compat (1.2.1)
56
+ guard-rspec (4.6.4)
57
+ guard (~> 2.1)
58
+ guard-compat (~> 1.1)
59
+ rspec (>= 2.99.0, < 4.0)
60
+ hashdiff (0.2.3)
61
+ hashie (3.4.3)
62
+ highline (1.7.8)
63
+ hirb (0.7.3)
64
+ hirb-unicode (0.0.5)
65
+ hirb (~> 0.5)
66
+ unicode-display_width (~> 0.1.1)
67
+ http-cookie (1.0.2)
68
+ domain_name (~> 0.5)
69
+ i18n (0.7.0)
70
+ jeweler (2.0.1)
71
+ builder
72
+ bundler (>= 1.0)
73
+ git (>= 1.2.5)
74
+ github_api
75
+ highline (>= 1.6.15)
76
+ nokogiri (>= 1.5.10)
77
+ rake
78
+ rdoc
79
+ json (1.8.3)
80
+ jwt (1.5.2)
81
+ listen (3.0.5)
82
+ rb-fsevent (>= 0.9.3)
83
+ rb-inotify (>= 0.9)
84
+ lumberjack (1.0.9)
85
+ method_source (0.8.2)
86
+ mime-types (1.25.1)
87
+ mini_portile (0.6.2)
88
+ minitest (5.8.3)
89
+ multi_json (1.11.2)
90
+ multi_xml (0.5.5)
91
+ multipart-post (2.0.0)
92
+ nenv (0.2.0)
93
+ netrc (0.7.9)
94
+ nokogiri (1.6.6.4)
95
+ mini_portile (~> 0.6.0)
96
+ notiffany (0.0.8)
97
+ nenv (~> 0.1)
98
+ shellany (~> 0.0)
99
+ oauth2 (1.0.0)
100
+ faraday (>= 0.8, < 0.10)
101
+ jwt (~> 1.0)
102
+ multi_json (~> 1.3)
103
+ multi_xml (~> 0.5)
104
+ rack (~> 1.2)
105
+ paint (1.0.0)
106
+ pry (0.10.3)
107
+ coderay (~> 1.1.0)
108
+ method_source (~> 0.8.1)
109
+ slop (~> 3.4)
110
+ rack (1.6.4)
111
+ rake (10.4.2)
112
+ rb-fchange (0.0.6)
113
+ ffi
114
+ rb-fsevent (0.9.6)
115
+ rb-inotify (0.9.5)
116
+ ffi (>= 0.5.0)
117
+ rdoc (4.2.0)
118
+ redcarpet (3.3.3)
119
+ rest-client (1.8.0)
120
+ http-cookie (>= 1.0.2, < 2.0)
121
+ mime-types (>= 1.16, < 3.0)
122
+ netrc (~> 0.7)
123
+ rspec (3.0.0)
124
+ rspec-core (~> 3.0.0)
125
+ rspec-expectations (~> 3.0.0)
126
+ rspec-mocks (~> 3.0.0)
127
+ rspec-core (3.0.4)
128
+ rspec-support (~> 3.0.0)
129
+ rspec-expectations (3.0.4)
130
+ diff-lcs (>= 1.2.0, < 2.0)
131
+ rspec-support (~> 3.0.0)
132
+ rspec-mocks (3.0.4)
133
+ rspec-support (~> 3.0.0)
134
+ rspec-support (3.0.4)
135
+ safe_yaml (1.0.4)
136
+ shellany (0.0.1)
137
+ shoulda (3.5.0)
138
+ shoulda-context (~> 1.0, >= 1.0.1)
139
+ shoulda-matchers (>= 1.4.1, < 3.0)
140
+ shoulda-context (1.2.1)
141
+ shoulda-matchers (2.8.0)
142
+ activesupport (>= 3.0.0)
143
+ simplecov (0.10.0)
144
+ docile (~> 1.1.0)
145
+ json (~> 1.8)
146
+ simplecov-html (~> 0.10.0)
147
+ simplecov-html (0.10.0)
148
+ slop (3.6.0)
149
+ term-ansicolor (1.3.2)
150
+ tins (~> 1.0)
151
+ thor (0.19.1)
152
+ thread_safe (0.3.5)
153
+ tins (1.6.0)
154
+ tzinfo (1.2.2)
155
+ thread_safe (~> 0.1)
156
+ unf (0.1.4)
157
+ unf_ext
158
+ unf_ext (0.0.7.1)
159
+ unicode-display_width (0.1.1)
160
+ vcr (2.9.3)
161
+ webmock (1.22.3)
162
+ addressable (>= 2.3.6)
163
+ crack (>= 0.3.2)
164
+ hashdiff
165
+ wirb (2.0.0)
166
+ paint (>= 0.9, < 2.0)
167
+ wirble (0.1.3)
168
+ yard (0.8.7.6)
169
+
170
+ PLATFORMS
171
+ ruby
172
+
173
+ DEPENDENCIES
174
+ awesome_print
175
+ coveralls
176
+ guard-bundler
177
+ guard-rspec (~> 4.5)
178
+ hirb-unicode
179
+ jeweler
180
+ json
181
+ mime-types (< 2.0.0)
182
+ multi_json (~> 1.11.0)
183
+ netrc (~> 0.7.7)
184
+ pry
185
+ rake (~> 10)
186
+ rb-fchange
187
+ rb-fsevent
188
+ rb-inotify
189
+ redcarpet
190
+ rest-client (~> 1)
191
+ rspec (~> 3.0.0)
192
+ shoulda
193
+ simplecov
194
+ vcr (~> 2.9.2)
195
+ webmock (>= 1.9)
196
+ wirb
197
+ wirble
198
+ yard
@@ -0,0 +1,70 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ ## Uncomment and set this to only include directories you want to watch
5
+ # directories %w(app lib config test spec features) \
6
+ # .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}
7
+
8
+ ## Note: if you are using the `directories` clause above and you are not
9
+ ## watching the project directory ('.'), then you will want to move
10
+ ## the Guardfile to a watched dir and symlink it back, e.g.
11
+ #
12
+ # $ mkdir config
13
+ # $ mv Guardfile config/
14
+ # $ ln -s config/Guardfile .
15
+ #
16
+ # and, you'll have to watch "config/Guardfile" instead of "Guardfile"
17
+
18
+ # Note: The cmd option is now required due to the increasing number of ways
19
+ # rspec may be run, below are examples of the most common uses.
20
+ # * bundler: 'bundle exec rspec'
21
+ # * bundler binstubs: 'bin/rspec'
22
+ # * spring: 'bin/rspec' (This will use spring if running and you have
23
+ # installed the spring binstubs per the docs)
24
+ # * zeus: 'zeus rspec' (requires the server to be started separately)
25
+ # * 'just' rspec: 'rspec'
26
+
27
+ guard :rspec, cmd: "bundle exec rspec" do
28
+ require "guard/rspec/dsl"
29
+ dsl = Guard::RSpec::Dsl.new(self)
30
+
31
+ # Feel free to open issues for suggestions and improvements
32
+
33
+ # RSpec files
34
+ rspec = dsl.rspec
35
+ watch(rspec.spec_helper) { rspec.spec_dir }
36
+ watch(rspec.spec_support) { rspec.spec_dir }
37
+ watch(rspec.spec_files)
38
+
39
+ # Ruby files
40
+ ruby = dsl.ruby
41
+ dsl.watch_spec_files_for(ruby.lib_files)
42
+
43
+ # Rails files
44
+ rails = dsl.rails(view_extensions: %w(erb haml slim))
45
+ dsl.watch_spec_files_for(rails.app_files)
46
+ dsl.watch_spec_files_for(rails.views)
47
+
48
+ watch(rails.controllers) do |m|
49
+ [
50
+ rspec.spec.("routing/#{m[1]}_routing"),
51
+ rspec.spec.("controllers/#{m[1]}_controller"),
52
+ rspec.spec.("acceptance/#{m[1]}")
53
+ ]
54
+ end
55
+
56
+ # Rails config changes
57
+ watch(rails.spec_helper) { rspec.spec_dir }
58
+ watch(rails.routes) { "#{rspec.spec_dir}/routing" }
59
+ watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" }
60
+
61
+ # Capybara features specs
62
+ watch(rails.view_dirs) { |m| rspec.spec.("features/#{m[1]}") }
63
+ watch(rails.layouts) { |m| rspec.spec.("features/#{m[1]}") }
64
+
65
+ # Turnip features and steps
66
+ watch(%r{^spec/acceptance/(.+)\.feature$})
67
+ watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
68
+ Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
69
+ end
70
+ end
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2015 Project Entropy
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,59 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ require 'rspec/core/rake_task'
7
+ RSpec::Core::RakeTask.new(:spec)
8
+
9
+ Bundler.setup(:default, :development)
10
+ task :default => :spec
11
+ rescue Bundler::BundlerError => e
12
+ $stderr.puts e.message
13
+ $stderr.puts "Run `bundle install` to install missing gems"
14
+ exit e.status_code
15
+ end
16
+ require 'rake'
17
+
18
+ require 'jeweler'
19
+ Jeweler::Tasks.new do |gem|
20
+ # gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
21
+ gem.name = "coinprism"
22
+ gem.homepage = "http://github.com/ProjectEntropy/coinprism"
23
+ gem.license = "MIT"
24
+ gem.summary = "Ruby API Wrapper for CoinPrism Bitcoin Asset API"
25
+ gem.description = "Ruby toolkit for working with the CoinPrism API"
26
+ gem.email = "joran.k@gmail.com"
27
+ gem.authors = ["Joran Kikke"]
28
+
29
+ # Dont bundle specs in gem
30
+ gem.files.exclude 'spec'
31
+ gem.files.exclude '.ruby-version'
32
+ gem.files.exclude '.ruby-gemset'
33
+ end
34
+ Jeweler::RubygemsDotOrgTasks.new
35
+
36
+ require 'rake/testtask'
37
+ Rake::TestTask.new(:test) do |test|
38
+ test.libs << 'lib' << 'test'
39
+ test.pattern = 'test/**/test_*.rb'
40
+ test.verbose = true
41
+ end
42
+
43
+ desc "Code coverage detail"
44
+ task :simplecov do
45
+ ENV['COVERAGE'] = "true"
46
+ Rake::Task['test'].execute
47
+ end
48
+
49
+ task :default => :test
50
+
51
+ require 'rdoc/task'
52
+ Rake::RDocTask.new do |rdoc|
53
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
54
+
55
+ rdoc.rdoc_dir = 'rdoc'
56
+ rdoc.title = "coinprism #{version}"
57
+ rdoc.rdoc_files.include('README*')
58
+ rdoc.rdoc_files.include('lib/**/*.rb')
59
+ end
@@ -0,0 +1,70 @@
1
+ CoinPrism Ruby API
2
+ ===
3
+ [![Build Status](https://img.shields.io/travis/ProjectEntropy/coinprism.svg)](https://travis-ci.org/ProjectEntropy/coinprism)
4
+ [![Code Climate](https://img.shields.io/codeclimate/github/ProjectEntropy/coinprism.svg)](https://codeclimate.com/github/ProjectEntropy/coinprism)
5
+ [![Dependency Status](https://img.shields.io/gemnasium/ProjectEntropy/coinprism.svg)](https://gemnasium.com/ProjectEntropy/coinprism)
6
+
7
+
8
+ Talk to the coin prism blockchain explorer and wallet API
9
+
10
+ ## Quick start
11
+
12
+ Install via Rubygems
13
+
14
+ gem install coinprism
15
+
16
+ ... or add to your Gemfile
17
+
18
+ gem "coinprism"
19
+
20
+
21
+ ### Address info
22
+ ```ruby
23
+ # Addresses
24
+ Coinprism.address_info("akW5d2jL859ELCxvRwtqiiZV8Hg5Bx7Pu19")
25
+ => #<OpenStruct address="1NifqmDXjuoJzi6eGzL9cctDBo8WxNPCgo", asset_address="akYgZ5w2sDPgzrxG1KcSLGUnnXQJgwr8CTE", bitcoin_address="1NifqmDXjuoJzi6eGzL9cctDBo8WxNPCgo", issuable_asset="AGY84vUEXzgnY2QSa4k7UBEq5j54DcEuqo", balance=8824131, unconfirmed_balance=0, assets=[{"id"=>"AbukVhn9rLxcYQmwd4FGWtjRDtWfodcQ3j", "balance"=>"26100", ... } ], ...>
26
+
27
+ info = Coinprism.address_info("akW5d2jL859ELCxvRwtqiiZV8Hg5Bx7Pu19")
28
+ info.balance
29
+ => 8824131 # (Satoshis)
30
+
31
+
32
+
33
+ Coinprism.transactions("akW5d2jL859ELCxvRwtqiiZV8Hg5Bx7Pu19")
34
+ => [ {"hash"=>"dc04cbd2b74d22e23b594c2c40d9106e7d8e67c6ebfef4d64408ec11a0e0f2fe", "block_hash"=>"00000000000000000ef246c814f8cb8c1a26bc3c6cb1286bdbc5f4140ed3fc79", "block_height"=>385510, "block_time"=>"2015-11-26T22:14:11.0000000Z", ... } ]
35
+
36
+ Coinprism.unspents("1NifqmDXjuoJzi6eGzL9cctDBo8WxNPCgo")
37
+ => [ {"transaction_hash"=>"863716f3a8277556b9abbe58ae33d2980c92fca897708d07c82ad3bb85756565", "output_index"=>173, "value"=>8792861, "asset_id"=>nil, "asset_quantity"=>nil, "addresses"=>["1NifqmDXjuoJzi6eGzL9cctDBo8WxNPCgo"], "script_hex"=>"76a914ee3c1e561b43b4522e1dacdeadf822dbf964d8ce88ac", "spent"=>false, "confirmations"=>35}, {"transaction_hash"=>"05a156d42fd94"}, ... } ]
38
+
39
+ ```
40
+
41
+ ### Transaction info
42
+ ```ruby
43
+
44
+ # Transaction
45
+ Coinprism.transaction_info("863716f3a8277556b9abbe58ae33d2980c92fca897708d07c82ad3bb85756565")
46
+ => #<OpenStruct hash="863716f3a8277556b9abbe58ae33d2980c92fca897708d07c82ad3bb85756565", block_hash="00000000000000000ef246c814f8cb8c1a26bc3c6cb1286bdbc5f4140ed3fc79", block_height=385510, block_time="2015-11-26T22:14:11.0000000Z", inputs=[{"transaction_hash"=>"863716f3a8277556b9abbe58ae33d2980c92fca897708d07c82ad3bb85756565", "output_hash"=>"34914f3edb499e7d87d9e89a3b16d9e8175a145e6f43760f5065003c92e85d5e", "output_index"=>1, "value"=>84301030, "addresses"=>["1NpmirYrxqLm1hbDe3BNWmb8dRu2NrXSWv"], ... >
47
+
48
+ ```
49
+
50
+ ### Asset info
51
+ ```ruby
52
+ # Asset
53
+ Coinprism.asset_definition("ALXukPZvZJL3qDZkga2DwcbwS1P3pmyB8f")
54
+ => #<OpenStruct asset_id="ALXukPZvZJL3qDZkga2DwcbwS1P3pmyB8f", metadata_url="https://goo.gl/lQ3zCO", final_metadata_url="https://buckchainstore.com/asset", verified_issuer=true, name="AlphaBuck", contract_url="http://www.buckchainstore.com/a-buck", name_short="A-BUCK", issuer="CN=www.buckchainstore.com, OU=PositiveSSL, OU=Domain Control Validated", description="", description_mime="text/x-markdown; charset=UTF-8", type="Other", divisibility=2, icon_url=nil, image_url=nil>
55
+
56
+ Coinprism.asset_owners("ALXukPZvZJL3qDZkga2DwcbwS1P3pmyB8f")
57
+ => #<OpenStruct block_height=385547, asset_id="ALXukPZvZJL3qDZkga2DwcbwS1P3pmyB8f", owners=[{"script"=>"76a9141023e2a0f6275131ee05819b58261752ebfb989a88ac", "address"=>"12ULoRSnhDycdJnoZ6kuvYDjirdgteNbWx", "asset_quantity"=>"5"}]>
58
+
59
+
60
+ ```
61
+
62
+
63
+ Contributing
64
+ ------------
65
+ Please fork the repo to your own github account, make a new branch for your feature/changes and then make a pull request to have it merged back into this repo.
66
+
67
+ Credits
68
+ -------
69
+
70
+ Joran Kikke (@donkeyscience)