algorand 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 90b286f7ac722bc1816cade5b6c48840e3043e8d0c1154e4215c6aa6c4cde5aa
4
+ data.tar.gz: e7b892d2d980bd8c1dce003bf974d5bf7701a8b5207b9b0b98b57fcd8847b3e3
5
+ SHA512:
6
+ metadata.gz: 1a84b32bbcbab5b916e0099fa11ebe6317e59e8b82fe766264b136c4451c528f73eead2127d991618449d6efbfc0f424429282db2411cc640f7e2dcf95ee1987
7
+ data.tar.gz: 5051eca984539670f300b722f13f72781163225b7504e38eccfc91de52a487feadf83760a2eccbbbba3db0bfd847b80ff898f1eb566e640218a96a69a664320b
data/CHANGELOG.md ADDED
File without changes
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 Shawn McBride
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # Algorand
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/algorand`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'algorand'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install algorand
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/algorand. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
+
37
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
40
+
41
+ ## Code of Conduct
42
+
43
+ Everyone interacting in the Algorand project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/algorand/blob/master/CODE_OF_CONDUCT.md).
@@ -0,0 +1,25 @@
1
+ require 'httparty'
2
+
3
+ module Algorand
4
+ class AlgodClient
5
+ attr_reader :host, :token
6
+
7
+ def initialize(host: Configuration.algod_host, token:)
8
+ @host = host
9
+ @token = token
10
+ end
11
+
12
+ def test
13
+ HTTParty.get("http://#{host}/v2/status", headers: headers)
14
+ end
15
+
16
+ private
17
+
18
+
19
+ def headers
20
+ {
21
+ 'X-Algo-API-Token' => token
22
+ }
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,34 @@
1
+ require 'singleton'
2
+
3
+ module Algorand
4
+ class Configuration
5
+ include Singleton
6
+ attr_reader :algod_host, :indexer_host, :kmd_host
7
+
8
+ DEFAULT_ALGOD_HOST='localhost:4001'
9
+ DEFAUT_INDEXER_HOST='localhost:8980'
10
+ DEFAULT_KMD_HOST='localhost:4002'
11
+
12
+ def self.set_defaults
13
+ instance.set_defaults
14
+ end
15
+
16
+ def initialize
17
+ set_defaults
18
+ end
19
+
20
+ def configure(options)
21
+ @algod_host = options[:algod_host]
22
+ @indexer_host = options[:indexer_host]
23
+ @kmd_host = options[:kmd_host]
24
+ end
25
+
26
+ private
27
+
28
+ def set_defaults
29
+ @algod_host = DEFAULT_ALGOD_HOST
30
+ @indexer_host = DEFAUT_INDEXER_HOST
31
+ @kmd_host = DEFAULT_KMD_HOST
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,5 @@
1
+ {
2
+ "dev": {
3
+ "name": "value"
4
+ }
5
+ }
@@ -0,0 +1,3 @@
1
+ module Algorand
2
+ VERSION = '0.0.1'
3
+ end
data/lib/algorand.rb ADDED
@@ -0,0 +1,11 @@
1
+ require 'algorand/configuration'
2
+ require 'algorand/algod_client'
3
+ require 'algorand/version'
4
+
5
+ module Algorand
6
+ def self.configure(options = nil)
7
+ if !options.nil?
8
+ Configuration.instance.configure(options)
9
+ end
10
+ end
11
+ end
metadata ADDED
@@ -0,0 +1,65 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: algorand
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Shawn McBride
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2022-01-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: httparty
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.20'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.20'
27
+ description:
28
+ email:
29
+ - smmcbride@gmail.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - CHANGELOG.md
35
+ - LICENSE.txt
36
+ - README.md
37
+ - lib/algorand.rb
38
+ - lib/algorand/algod_client.rb
39
+ - lib/algorand/configuration.rb
40
+ - lib/algorand/http-client.env.json
41
+ - lib/algorand/version.rb
42
+ homepage: https://github.com/smmcbride/ruby-algorand-sdk
43
+ licenses:
44
+ - MIT
45
+ metadata: {}
46
+ post_install_message:
47
+ rdoc_options: []
48
+ require_paths:
49
+ - lib
50
+ required_ruby_version: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ required_rubygems_version: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
60
+ requirements: []
61
+ rubygems_version: 3.2.15
62
+ signing_key:
63
+ specification_version: 4
64
+ summary: A Ruby SDK for the Algorand API
65
+ test_files: []