helloblock-lite 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +5 -0
- data/Rakefile +1 -0
- data/helloblock-lite.gemspec +26 -0
- data/lib/helloblock/addresses.rb +40 -0
- data/lib/helloblock/blocks.rb +0 -0
- data/lib/helloblock/faucet.rb +16 -0
- data/lib/helloblock/request.rb +31 -0
- data/lib/helloblock/rpc.rb +9 -0
- data/lib/helloblock/transactions.rb +25 -0
- data/lib/helloblock/version.rb +3 -0
- data/lib/helloblock/wallet.rb +0 -0
- data/lib/helloblock-lite.rb +41 -0
- metadata +116 -0
    
        checksums.yaml
    ADDED
    
    | @@ -0,0 +1,7 @@ | |
| 1 | 
            +
            ---
         | 
| 2 | 
            +
            SHA1:
         | 
| 3 | 
            +
              metadata.gz: b8318cac2cd9e701dfd82223208f86662d2a6263
         | 
| 4 | 
            +
              data.tar.gz: ac6337cbac7105269722edaeca2577164829f762
         | 
| 5 | 
            +
            SHA512:
         | 
| 6 | 
            +
              metadata.gz: 7ae10bf33ba8209ad7f392c7aa6585a29b32bf98993644b736dacb3881e80b5101ccdfe59f842da4d57bf6cf1f0ba8e019aead47db2ba944dc4b90cdb884321e
         | 
| 7 | 
            +
              data.tar.gz: 2741e5b0464a36396dc48253f3e3a96083b5184bdb308c5b51bc248480d3f661de57533aeb70d99a0656274913e1189c9f595bab378adacab25dd24f5634e3fb
         | 
    
        data/.gitignore
    ADDED
    
    
    
        data/Gemfile
    ADDED
    
    
    
        data/LICENSE.txt
    ADDED
    
    | @@ -0,0 +1,22 @@ | |
| 1 | 
            +
            Copyright (c) 2014 Scott Li
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            MIT License
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            Permission is hereby granted, free of charge, to any person obtaining
         | 
| 6 | 
            +
            a copy of this software and associated documentation files (the
         | 
| 7 | 
            +
            "Software"), to deal in the Software without restriction, including
         | 
| 8 | 
            +
            without limitation the rights to use, copy, modify, merge, publish,
         | 
| 9 | 
            +
            distribute, sublicense, and/or sell copies of the Software, and to
         | 
| 10 | 
            +
            permit persons to whom the Software is furnished to do so, subject to
         | 
| 11 | 
            +
            the following conditions:
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            The above copyright notice and this permission notice shall be
         | 
| 14 | 
            +
            included in all copies or substantial portions of the Software.
         | 
| 15 | 
            +
             | 
| 16 | 
            +
            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
         | 
| 17 | 
            +
            EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
         | 
| 18 | 
            +
            MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
         | 
| 19 | 
            +
            NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
         | 
| 20 | 
            +
            LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
         | 
| 21 | 
            +
            OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
         | 
| 22 | 
            +
            WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
         | 
    
        data/README.md
    ADDED
    
    
    
        data/Rakefile
    ADDED
    
    | @@ -0,0 +1 @@ | |
| 1 | 
            +
            require "bundler/gem_tasks"
         | 
| @@ -0,0 +1,26 @@ | |
| 1 | 
            +
            # coding: utf-8
         | 
| 2 | 
            +
            lib = File.expand_path('../lib', __FILE__)
         | 
| 3 | 
            +
            $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
         | 
| 4 | 
            +
            require 'helloblock/version'
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            Gem::Specification.new do |spec|
         | 
| 7 | 
            +
              spec.name          = "helloblock-lite"
         | 
| 8 | 
            +
              spec.version       = HelloBlock::VERSION
         | 
| 9 | 
            +
              spec.authors       = ["Scott Li"]
         | 
| 10 | 
            +
              spec.email         = ["scottli0101@gmail.com"]
         | 
| 11 | 
            +
              spec.summary       = %q{Lightweight client}
         | 
| 12 | 
            +
              spec.description   = %q{Lightweight client for Helloblock API}
         | 
| 13 | 
            +
              spec.homepage      = "https://github.com/locksley/helloblock-lite"
         | 
| 14 | 
            +
              spec.license       = "MIT"
         | 
| 15 | 
            +
             | 
| 16 | 
            +
              spec.files         = `git ls-files`.split($/)
         | 
| 17 | 
            +
              spec.executables   = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
         | 
| 18 | 
            +
              spec.test_files    = spec.files.grep(%r{^(test|spec|features)/})
         | 
| 19 | 
            +
              spec.require_paths = ["lib"]
         | 
| 20 | 
            +
             | 
| 21 | 
            +
              spec.add_development_dependency "bundler", "~> 1.5"
         | 
| 22 | 
            +
              spec.add_development_dependency "rake"
         | 
| 23 | 
            +
              spec.add_development_dependency "pry"
         | 
| 24 | 
            +
             | 
| 25 | 
            +
              spec.add_dependency 'httparty', '~> 0.12.0'
         | 
| 26 | 
            +
            end
         | 
| @@ -0,0 +1,40 @@ | |
| 1 | 
            +
            module HelloBlock::Addresses
         | 
| 2 | 
            +
              extend self
         | 
| 3 | 
            +
             | 
| 4 | 
            +
              RESOURCE = "/addresses"
         | 
| 5 | 
            +
             | 
| 6 | 
            +
              def get(address)
         | 
| 7 | 
            +
                res = HelloBlock::Request.get("#{RESOURCE}/#{address}")
         | 
| 8 | 
            +
                res["address"]
         | 
| 9 | 
            +
              end
         | 
| 10 | 
            +
             | 
| 11 | 
            +
              def get_transactions(address, queries = {})
         | 
| 12 | 
            +
                res = HelloBlock::Request.get("#{RESOURCE}/#{address}/transactions", query: queries)
         | 
| 13 | 
            +
                res["transactions"]
         | 
| 14 | 
            +
              end
         | 
| 15 | 
            +
             | 
| 16 | 
            +
              def get_unspents(address, queries = {})
         | 
| 17 | 
            +
                res = HelloBlock::Request.get("#{RESOURCE}/#{address}/unspents", query: queries)
         | 
| 18 | 
            +
                res["unspents"]
         | 
| 19 | 
            +
              end
         | 
| 20 | 
            +
             | 
| 21 | 
            +
              module Batch
         | 
| 22 | 
            +
                extend self
         | 
| 23 | 
            +
             | 
| 24 | 
            +
                def get(queries = {})
         | 
| 25 | 
            +
                  res = HelloBlock::Request.get("#{RESOURCE}", query: queries)
         | 
| 26 | 
            +
                  res["addresses"]
         | 
| 27 | 
            +
                end
         | 
| 28 | 
            +
             | 
| 29 | 
            +
                def get_transactions(queries = {})
         | 
| 30 | 
            +
                  res = HelloBlock::Request.get("#{RESOURCE}/transactions", query: queries)
         | 
| 31 | 
            +
                  res["transactions"]
         | 
| 32 | 
            +
                end
         | 
| 33 | 
            +
             | 
| 34 | 
            +
                def get_unspents(queries = {})
         | 
| 35 | 
            +
                  res = HelloBlock::Request.get("#{RESOURCE}/unspents", query: queries)
         | 
| 36 | 
            +
                  res["unspents"]
         | 
| 37 | 
            +
                end
         | 
| 38 | 
            +
              end
         | 
| 39 | 
            +
             | 
| 40 | 
            +
            end
         | 
| 
            File without changes
         | 
| @@ -0,0 +1,16 @@ | |
| 1 | 
            +
            module HelloBlock::Faucet
         | 
| 2 | 
            +
              extend self
         | 
| 3 | 
            +
             | 
| 4 | 
            +
              RESOURCE = "/faucet"
         | 
| 5 | 
            +
             | 
| 6 | 
            +
              def unspents(queries = {})
         | 
| 7 | 
            +
                res = HelloBlock::Request.get("#{RESOURCE}", query: queries)
         | 
| 8 | 
            +
                res
         | 
| 9 | 
            +
              end
         | 
| 10 | 
            +
             | 
| 11 | 
            +
              def withdrawal(queries = {})
         | 
| 12 | 
            +
                res = HelloBlock::Request.post("#{RESOURCE}", body: queries)
         | 
| 13 | 
            +
                res["transaction"]
         | 
| 14 | 
            +
              end
         | 
| 15 | 
            +
             | 
| 16 | 
            +
            end
         | 
| @@ -0,0 +1,31 @@ | |
| 1 | 
            +
            module HelloBlock::Request
         | 
| 2 | 
            +
              extend self
         | 
| 3 | 
            +
             | 
| 4 | 
            +
              def base
         | 
| 5 | 
            +
                "https://#{HelloBlock.network}.helloblock.io/#{HelloBlock.version}"
         | 
| 6 | 
            +
              end
         | 
| 7 | 
            +
             | 
| 8 | 
            +
              def post(endpoint, body: {})
         | 
| 9 | 
            +
                # ensure / at end of endpoint
         | 
| 10 | 
            +
                response = HTTParty.post("#{base()}#{endpoint}", body: body.to_query)
         | 
| 11 | 
            +
             | 
| 12 | 
            +
                # TODO: Better Handling
         | 
| 13 | 
            +
                if response.code != 200
         | 
| 14 | 
            +
                  p response.body
         | 
| 15 | 
            +
                  raise Error
         | 
| 16 | 
            +
                end
         | 
| 17 | 
            +
                return response["data"]
         | 
| 18 | 
            +
              end
         | 
| 19 | 
            +
             | 
| 20 | 
            +
              def get(endpoint, query: {})
         | 
| 21 | 
            +
                response = HTTParty.get("#{base()}#{endpoint}", query: query)
         | 
| 22 | 
            +
             | 
| 23 | 
            +
                # TODO: Better Handling
         | 
| 24 | 
            +
                if response.code != 200
         | 
| 25 | 
            +
                  p response.body
         | 
| 26 | 
            +
                  raise Error
         | 
| 27 | 
            +
                end
         | 
| 28 | 
            +
                return response["data"]
         | 
| 29 | 
            +
              end
         | 
| 30 | 
            +
             | 
| 31 | 
            +
            end
         | 
| @@ -0,0 +1,25 @@ | |
| 1 | 
            +
            module HelloBlock::Transactions
         | 
| 2 | 
            +
              extend self
         | 
| 3 | 
            +
             | 
| 4 | 
            +
              RESOURCE = "/transactions"
         | 
| 5 | 
            +
             | 
| 6 | 
            +
              def get(tx_hash)
         | 
| 7 | 
            +
                res = HelloBlock::Request.get("#{RESOURCE}/#{tx_hash}")
         | 
| 8 | 
            +
                res["transaction"]
         | 
| 9 | 
            +
              end
         | 
| 10 | 
            +
             | 
| 11 | 
            +
              def propagate(body = {})
         | 
| 12 | 
            +
                res = HelloBlock::Request.post("#{RESOURCE}", body: body)
         | 
| 13 | 
            +
                res["transaction"]
         | 
| 14 | 
            +
              end
         | 
| 15 | 
            +
             | 
| 16 | 
            +
              module Batch
         | 
| 17 | 
            +
                extend self
         | 
| 18 | 
            +
             | 
| 19 | 
            +
                def get(queries = {})
         | 
| 20 | 
            +
                  res = HelloBlock::Request.get("#{RESOURCE}", query: queries)
         | 
| 21 | 
            +
                  res["transactions"]
         | 
| 22 | 
            +
                end
         | 
| 23 | 
            +
             | 
| 24 | 
            +
              end
         | 
| 25 | 
            +
            end
         | 
| 
            File without changes
         | 
| @@ -0,0 +1,41 @@ | |
| 1 | 
            +
            require 'httparty'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module HelloBlock
         | 
| 4 | 
            +
             | 
| 5 | 
            +
              def self.api_key
         | 
| 6 | 
            +
                @api_key
         | 
| 7 | 
            +
              end
         | 
| 8 | 
            +
             | 
| 9 | 
            +
              def self.api_key=(obj)
         | 
| 10 | 
            +
                @api_key = obj
         | 
| 11 | 
            +
              end
         | 
| 12 | 
            +
             | 
| 13 | 
            +
              def self.version
         | 
| 14 | 
            +
                @version ||= :v1
         | 
| 15 | 
            +
              end
         | 
| 16 | 
            +
             | 
| 17 | 
            +
              def self.version=(obj)
         | 
| 18 | 
            +
                @version = obj
         | 
| 19 | 
            +
              end
         | 
| 20 | 
            +
             | 
| 21 | 
            +
              def self.network
         | 
| 22 | 
            +
                @network ||= :testnet
         | 
| 23 | 
            +
              end
         | 
| 24 | 
            +
             | 
| 25 | 
            +
              def self.network=(obj)
         | 
| 26 | 
            +
                @network = obj
         | 
| 27 | 
            +
              end
         | 
| 28 | 
            +
             | 
| 29 | 
            +
              def self.configure
         | 
| 30 | 
            +
                yield self if block_given?
         | 
| 31 | 
            +
              end
         | 
| 32 | 
            +
             | 
| 33 | 
            +
            end
         | 
| 34 | 
            +
             | 
| 35 | 
            +
            require 'helloblock/request'
         | 
| 36 | 
            +
            require 'helloblock/addresses'
         | 
| 37 | 
            +
            require 'helloblock/blocks'
         | 
| 38 | 
            +
            require 'helloblock/faucet'
         | 
| 39 | 
            +
            require 'helloblock/rpc'
         | 
| 40 | 
            +
            require 'helloblock/transactions'
         | 
| 41 | 
            +
            require 'helloblock/wallet'
         | 
    
        metadata
    ADDED
    
    | @@ -0,0 +1,116 @@ | |
| 1 | 
            +
            --- !ruby/object:Gem::Specification
         | 
| 2 | 
            +
            name: helloblock-lite
         | 
| 3 | 
            +
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            +
              version: 1.0.0
         | 
| 5 | 
            +
            platform: ruby
         | 
| 6 | 
            +
            authors:
         | 
| 7 | 
            +
            - Scott Li
         | 
| 8 | 
            +
            autorequire: 
         | 
| 9 | 
            +
            bindir: bin
         | 
| 10 | 
            +
            cert_chain: []
         | 
| 11 | 
            +
            date: 2014-03-20 00:00:00.000000000 Z
         | 
| 12 | 
            +
            dependencies:
         | 
| 13 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 14 | 
            +
              name: bundler
         | 
| 15 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 16 | 
            +
                requirements:
         | 
| 17 | 
            +
                - - ~>
         | 
| 18 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 19 | 
            +
                    version: '1.5'
         | 
| 20 | 
            +
              type: :development
         | 
| 21 | 
            +
              prerelease: false
         | 
| 22 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 23 | 
            +
                requirements:
         | 
| 24 | 
            +
                - - ~>
         | 
| 25 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 26 | 
            +
                    version: '1.5'
         | 
| 27 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 28 | 
            +
              name: rake
         | 
| 29 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 30 | 
            +
                requirements:
         | 
| 31 | 
            +
                - - '>='
         | 
| 32 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 33 | 
            +
                    version: '0'
         | 
| 34 | 
            +
              type: :development
         | 
| 35 | 
            +
              prerelease: false
         | 
| 36 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 37 | 
            +
                requirements:
         | 
| 38 | 
            +
                - - '>='
         | 
| 39 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 40 | 
            +
                    version: '0'
         | 
| 41 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 42 | 
            +
              name: pry
         | 
| 43 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 44 | 
            +
                requirements:
         | 
| 45 | 
            +
                - - '>='
         | 
| 46 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 47 | 
            +
                    version: '0'
         | 
| 48 | 
            +
              type: :development
         | 
| 49 | 
            +
              prerelease: false
         | 
| 50 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 51 | 
            +
                requirements:
         | 
| 52 | 
            +
                - - '>='
         | 
| 53 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 54 | 
            +
                    version: '0'
         | 
| 55 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 56 | 
            +
              name: httparty
         | 
| 57 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 58 | 
            +
                requirements:
         | 
| 59 | 
            +
                - - ~>
         | 
| 60 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 61 | 
            +
                    version: 0.12.0
         | 
| 62 | 
            +
              type: :runtime
         | 
| 63 | 
            +
              prerelease: false
         | 
| 64 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 65 | 
            +
                requirements:
         | 
| 66 | 
            +
                - - ~>
         | 
| 67 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 68 | 
            +
                    version: 0.12.0
         | 
| 69 | 
            +
            description: Lightweight client for Helloblock API
         | 
| 70 | 
            +
            email:
         | 
| 71 | 
            +
            - scottli0101@gmail.com
         | 
| 72 | 
            +
            executables: []
         | 
| 73 | 
            +
            extensions: []
         | 
| 74 | 
            +
            extra_rdoc_files: []
         | 
| 75 | 
            +
            files:
         | 
| 76 | 
            +
            - .gitignore
         | 
| 77 | 
            +
            - Gemfile
         | 
| 78 | 
            +
            - LICENSE.txt
         | 
| 79 | 
            +
            - README.md
         | 
| 80 | 
            +
            - Rakefile
         | 
| 81 | 
            +
            - helloblock-lite.gemspec
         | 
| 82 | 
            +
            - lib/helloblock-lite.rb
         | 
| 83 | 
            +
            - lib/helloblock/addresses.rb
         | 
| 84 | 
            +
            - lib/helloblock/blocks.rb
         | 
| 85 | 
            +
            - lib/helloblock/faucet.rb
         | 
| 86 | 
            +
            - lib/helloblock/request.rb
         | 
| 87 | 
            +
            - lib/helloblock/rpc.rb
         | 
| 88 | 
            +
            - lib/helloblock/transactions.rb
         | 
| 89 | 
            +
            - lib/helloblock/version.rb
         | 
| 90 | 
            +
            - lib/helloblock/wallet.rb
         | 
| 91 | 
            +
            homepage: https://github.com/locksley/helloblock-lite
         | 
| 92 | 
            +
            licenses:
         | 
| 93 | 
            +
            - MIT
         | 
| 94 | 
            +
            metadata: {}
         | 
| 95 | 
            +
            post_install_message: 
         | 
| 96 | 
            +
            rdoc_options: []
         | 
| 97 | 
            +
            require_paths:
         | 
| 98 | 
            +
            - lib
         | 
| 99 | 
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         | 
| 100 | 
            +
              requirements:
         | 
| 101 | 
            +
              - - '>='
         | 
| 102 | 
            +
                - !ruby/object:Gem::Version
         | 
| 103 | 
            +
                  version: '0'
         | 
| 104 | 
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 105 | 
            +
              requirements:
         | 
| 106 | 
            +
              - - '>='
         | 
| 107 | 
            +
                - !ruby/object:Gem::Version
         | 
| 108 | 
            +
                  version: '0'
         | 
| 109 | 
            +
            requirements: []
         | 
| 110 | 
            +
            rubyforge_project: 
         | 
| 111 | 
            +
            rubygems_version: 2.1.11
         | 
| 112 | 
            +
            signing_key: 
         | 
| 113 | 
            +
            specification_version: 4
         | 
| 114 | 
            +
            summary: Lightweight client
         | 
| 115 | 
            +
            test_files: []
         | 
| 116 | 
            +
            has_rdoc: 
         |