blockr-ruby 0.0.3 → 0.0.5
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 +4 -4
- data/README.md +38 -1
- data/blockr-ruby.gemspec +1 -0
- data/bump +70 -0
- data/lib/blockr/api.rb +9 -1
- data/lib/blockr/version.rb +1 -1
- metadata +23 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 2355c0e55358c41920631f28efd4b1c06ec9889e
         | 
| 4 | 
            +
              data.tar.gz: d1978f3f6c1c143049ba95ab4ed921ed04073ecb
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: c72a03f92074a0780f4d873280a08011252cd0d4b1f7ce78a2d6950fd809b003ea92320508264396d15efa55c980593a54d131a55ac3b3a93addf83308d36867
         | 
| 7 | 
            +
              data.tar.gz: ae1aade2bf8511ace12bca61073a19d481d3327f0d73156b261d10e8f94fcccfc0cae2a729e0c2f619f8d1b849722056ece69f127365f2d584b9025f10301394
         | 
    
        data/README.md
    CHANGED
    
    | @@ -2,6 +2,8 @@ | |
| 2 2 |  | 
| 3 3 | 
             
            Ruby SDK for Blockr.io
         | 
| 4 4 |  | 
| 5 | 
            +
            [![Gem Version][gem-version-image]][gem-version-url]
         | 
| 6 | 
            +
             | 
| 5 7 | 
             
            ## Installation
         | 
| 6 8 |  | 
| 7 9 | 
             
            Add this line to your application's Gemfile:
         | 
| @@ -20,12 +22,47 @@ Or install it yourself as: | |
| 20 22 |  | 
| 21 23 | 
             
            ## Usage
         | 
| 22 24 |  | 
| 23 | 
            -
             | 
| 25 | 
            +
            ### Initialize the library
         | 
| 26 | 
            +
              
         | 
| 27 | 
            +
              ```ruby
         | 
| 28 | 
            +
                blockr_api = Blockr::API.new(network:BLOCK_CHAIN, api_version:API_VERSION)
         | 
| 29 | 
            +
              ```
         | 
| 30 | 
            +
             | 
| 31 | 
            +
            Where `BLOCK_CHAIN` can be one of btc, tbtc, ltc, dgc, qrk, ppc, mec or any of the blockchains supported by in https://blockr.io
         | 
| 32 | 
            +
            And `API_VERSION` is v1 for now (optional)
         | 
| 33 | 
            +
             | 
| 34 | 
            +
            You can also change the Blockchain using:
         | 
| 35 | 
            +
              ```ruby
         | 
| 36 | 
            +
                blockr_api.network = 'tbtc'
         | 
| 37 | 
            +
              ```
         | 
| 38 | 
            +
             | 
| 39 | 
            +
            ### Posible Methods
         | 
| 40 | 
            +
             | 
| 41 | 
            +
            You can use any of these methods with the initialized object or simply by calling:
         | 
| 42 | 
            +
             | 
| 43 | 
            +
              ```ruby
         | 
| 44 | 
            +
                Blockr.block(hash)
         | 
| 45 | 
            +
                Blockr.latest_block
         | 
| 46 | 
            +
                Blockr.latest_block_raw
         | 
| 47 | 
            +
                Blockr.transaction(hash)
         | 
| 48 | 
            +
                Blockr.raw_transaction(hash)
         | 
| 49 | 
            +
                Blockr.decode_transaction(hex)
         | 
| 50 | 
            +
                Blockr.push_transaction(hex)
         | 
| 51 | 
            +
                Blockr.address(address)
         | 
| 52 | 
            +
                Blockr.address_balance(address)
         | 
| 53 | 
            +
                Blockr.address_unspent_transactions(address, params)
         | 
| 54 | 
            +
                Blockr.address_unconfirmed
         | 
| 55 | 
            +
              ```
         | 
| 24 56 |  | 
| 25 57 | 
             
            ## Contributing
         | 
| 26 58 |  | 
| 59 | 
            +
            To bump the version you can use the `./bump` python script, just write it in the terminal to see the options.
         | 
| 60 | 
            +
             | 
| 27 61 | 
             
            1. Fork it ( https://github.com/[my-github-username]/blockr-ruby/fork )
         | 
| 28 62 | 
             
            2. Create your feature branch (`git checkout -b my-new-feature`)
         | 
| 29 63 | 
             
            3. Commit your changes (`git commit -am 'Add some feature'`)
         | 
| 30 64 | 
             
            4. Push to the branch (`git push origin my-new-feature`)
         | 
| 31 65 | 
             
            5. Create a new Pull Request
         | 
| 66 | 
            +
             
         | 
| 67 | 
            +
            [gem-version-image]: https://badge.fury.io/rb/blockr-ruby.svg
         | 
| 68 | 
            +
            [gem-version-url]: https://badge.fury.io/rb/blockr-ruby
         | 
    
        data/blockr-ruby.gemspec
    CHANGED
    
    
    
        data/bump
    ADDED
    
    | @@ -0,0 +1,70 @@ | |
| 1 | 
            +
            #!/usr/bin/env python
         | 
| 2 | 
            +
            import re, glob, sys, os
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            __USAGE__ = \
         | 
| 5 | 
            +
            """BUMP is a semantic versioning bump script which accepts the following
         | 
| 6 | 
            +
            mutually exclusive arguments:
         | 
| 7 | 
            +
               -m - a "major" version bump equal to +1.0.0
         | 
| 8 | 
            +
               -n - a "minor" version bump equal to +0.1.0
         | 
| 9 | 
            +
               -p - a "patch" version bump equal to +0.0.1
         | 
| 10 | 
            +
               -h - a "hot fix" version bump equal to +0.0.1
         | 
| 11 | 
            +
             | 
| 12 | 
            +
               All of these options allow for the -r flag, which indicates that the state
         | 
| 13 | 
            +
               is a RELEASE not a SNAPSHOT. If -r is not specified, then -SNAPSHOT is
         | 
| 14 | 
            +
               appended to the updated version string."""
         | 
| 15 | 
            +
             | 
| 16 | 
            +
            __INITIAL__ = ['0', '0', '1']
         | 
| 17 | 
            +
             | 
| 18 | 
            +
             | 
| 19 | 
            +
            if __name__ == "__main__":
         | 
| 20 | 
            +
                v = []
         | 
| 21 | 
            +
                try:
         | 
| 22 | 
            +
                    version_file = glob.glob("lib/*/version.rb")[0]
         | 
| 23 | 
            +
                    raw_v = re.search(r'VERSION = \'(.*)\'', open(version_file).read(), re.M|re.I|re.S).group(1)
         | 
| 24 | 
            +
                    v = re.split(re.compile("\.|-"), raw_v)
         | 
| 25 | 
            +
                    v = v[0:3]
         | 
| 26 | 
            +
                    map(int, v)
         | 
| 27 | 
            +
             | 
| 28 | 
            +
                except ValueError:
         | 
| 29 | 
            +
                    print("failed to parse the existing VERSION file, assuming v 0.0.1")
         | 
| 30 | 
            +
                    v = ['0', '0', '1']
         | 
| 31 | 
            +
             | 
| 32 | 
            +
                except FileNotFoundError:
         | 
| 33 | 
            +
                    print("failed to find a VERSION file, assuming v 0.0.0")
         | 
| 34 | 
            +
                    v = ['0', '0', '0']
         | 
| 35 | 
            +
             | 
| 36 | 
            +
                op = ''
         | 
| 37 | 
            +
                try:
         | 
| 38 | 
            +
                    op = sys.argv[1]
         | 
| 39 | 
            +
                except:
         | 
| 40 | 
            +
                    print(__USAGE__)
         | 
| 41 | 
            +
                    sys.exit(-1)
         | 
| 42 | 
            +
             | 
| 43 | 
            +
                if(op == '-m'):
         | 
| 44 | 
            +
                    v = [str(int(v[0])+1), '0', '0']
         | 
| 45 | 
            +
             | 
| 46 | 
            +
                elif(op == '-n'):
         | 
| 47 | 
            +
                    v = [v[0], str(int(v[1])+1), '0']
         | 
| 48 | 
            +
             | 
| 49 | 
            +
                elif(op == '-p' or op == '-h'):
         | 
| 50 | 
            +
                    v = [v[0], v[1], str(int(v[2])+1)]
         | 
| 51 | 
            +
             | 
| 52 | 
            +
                else:
         | 
| 53 | 
            +
                    print(__USAGE__)
         | 
| 54 | 
            +
                    sys.exit(-1)
         | 
| 55 | 
            +
             | 
| 56 | 
            +
                v = '.'.join(v)
         | 
| 57 | 
            +
             | 
| 58 | 
            +
                if(op == '-h'):
         | 
| 59 | 
            +
                  os.system("git checkout -b hotfix/v%s master" % v)
         | 
| 60 | 
            +
             | 
| 61 | 
            +
                else:
         | 
| 62 | 
            +
                  os.system("git checkout -b release/v%s develop" % v)
         | 
| 63 | 
            +
             | 
| 64 | 
            +
                os.system("bump set %s" % v)
         | 
| 65 | 
            +
             | 
| 66 | 
            +
                v += "\n"
         | 
| 67 | 
            +
             | 
| 68 | 
            +
                print(v)
         | 
| 69 | 
            +
             | 
| 70 | 
            +
                sys.exit(0)
         | 
    
        data/lib/blockr/api.rb
    CHANGED
    
    | @@ -23,8 +23,16 @@ module Blockr | |
| 23 23 | 
             
                  @connection.get("/block/info/#{hash}")
         | 
| 24 24 | 
             
                end
         | 
| 25 25 |  | 
| 26 | 
            +
                def block_raw(hash)
         | 
| 27 | 
            +
                  @connection.get("/block/raw/#{hash}")
         | 
| 28 | 
            +
                end
         | 
| 29 | 
            +
             | 
| 26 30 | 
             
                def latest_block
         | 
| 27 | 
            -
                   | 
| 31 | 
            +
                  block('last')
         | 
| 32 | 
            +
                end
         | 
| 33 | 
            +
             | 
| 34 | 
            +
                def latest_block_raw
         | 
| 35 | 
            +
                  block_raw('last')
         | 
| 28 36 | 
             
                end
         | 
| 29 37 |  | 
| 30 38 | 
             
                def transaction(hash)
         | 
    
        data/lib/blockr/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: blockr-ruby
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.0. | 
| 4 | 
            +
              version: 0.0.5
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Genaro Madrid
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2015-12- | 
| 11 | 
            +
            date: 2015-12-12 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: rest-client
         | 
| @@ -94,6 +94,26 @@ dependencies: | |
| 94 94 | 
             
                - - "~>"
         | 
| 95 95 | 
             
                  - !ruby/object:Gem::Version
         | 
| 96 96 | 
             
                    version: '3.0'
         | 
| 97 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 98 | 
            +
              name: bump
         | 
| 99 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 100 | 
            +
                requirements:
         | 
| 101 | 
            +
                - - "~>"
         | 
| 102 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 103 | 
            +
                    version: '0.5'
         | 
| 104 | 
            +
                - - ">="
         | 
| 105 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 106 | 
            +
                    version: 0.5.3
         | 
| 107 | 
            +
              type: :development
         | 
| 108 | 
            +
              prerelease: false
         | 
| 109 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 110 | 
            +
                requirements:
         | 
| 111 | 
            +
                - - "~>"
         | 
| 112 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 113 | 
            +
                    version: '0.5'
         | 
| 114 | 
            +
                - - ">="
         | 
| 115 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 116 | 
            +
                    version: 0.5.3
         | 
| 97 117 | 
             
            description: Ruby SDK for Blockr.io API
         | 
| 98 118 | 
             
            email:
         | 
| 99 119 | 
             
            - genmadrid@gmail.com
         | 
| @@ -110,6 +130,7 @@ files: | |
| 110 130 | 
             
            - README.md
         | 
| 111 131 | 
             
            - Rakefile
         | 
| 112 132 | 
             
            - blockr-ruby.gemspec
         | 
| 133 | 
            +
            - bump
         | 
| 113 134 | 
             
            - lib/blockr.rb
         | 
| 114 135 | 
             
            - lib/blockr/api.rb
         | 
| 115 136 | 
             
            - lib/blockr/connection.rb
         |