bytom 1.0.1

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.
@@ -0,0 +1,6 @@
1
+ module Bytom
2
+ module Constants
3
+ # default local node
4
+ API_URL = 'http://127.0.0.1:9888'
5
+ end
6
+ end
@@ -0,0 +1,32 @@
1
+ require 'http'
2
+ module Bytom
3
+ ##
4
+ # @!attribute [r] base_url pass by class client
5
+ # @!attribute [r] token pass by class client
6
+ #
7
+ class Request
8
+ attr_reader :base_url, :token
9
+
10
+ def initialize(
11
+ base_url: nil,
12
+ token: nil
13
+ )
14
+ @base_url = base_url
15
+ @token = token
16
+ end
17
+
18
+ ##
19
+ # send a http request.
20
+ #
21
+ def make_request(path, method = 'get', params: {})
22
+ http_client = HTTP.headers(:accept => "application/json")
23
+ http_client.auth("Bearer " + token) if token
24
+ if method == 'get'
25
+ http_client.get(base_url + path).parse
26
+ elsif method == 'post'
27
+ http_client.post(base_url + path, :json => params).parse
28
+ end
29
+ end
30
+
31
+ end
32
+ end
@@ -0,0 +1,3 @@
1
+ module Bytom
2
+ VERSION = "1.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,143 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bytom
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.1
5
+ platform: ruby
6
+ authors:
7
+ - BitDayOne
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-01-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: http
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: minitest
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '5.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '5.0'
69
+ description: Bytom SDK for ruby
70
+ email:
71
+ - bitdayone@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - ".idea/.rakeTasks"
78
+ - ".idea/bytom.iml"
79
+ - ".idea/codeStyles/codeStyleConfig.xml"
80
+ - ".idea/encodings.xml"
81
+ - ".idea/inspectionProfiles/Project_Default.xml"
82
+ - ".idea/misc.xml"
83
+ - ".idea/modules.xml"
84
+ - ".idea/vcs.xml"
85
+ - ".idea/workspace.xml"
86
+ - ".travis.yml"
87
+ - API-Reference.md
88
+ - CHANGELOG.md
89
+ - CODE_OF_CONDUCT.md
90
+ - Gemfile
91
+ - Gemfile.lock
92
+ - README.md
93
+ - Rakefile
94
+ - bin/console
95
+ - bin/setup
96
+ - bytom.gemspec
97
+ - lib/bytom.rb
98
+ - lib/bytom/api/access_token.rb
99
+ - lib/bytom/api/accounts.rb
100
+ - lib/bytom/api/address.rb
101
+ - lib/bytom/api/asset.rb
102
+ - lib/bytom/api/balances.rb
103
+ - lib/bytom/api/block.rb
104
+ - lib/bytom/api/coinbase.rb
105
+ - lib/bytom/api/core_config.rb
106
+ - lib/bytom/api/keys.rb
107
+ - lib/bytom/api/message.rb
108
+ - lib/bytom/api/other.rb
109
+ - lib/bytom/api/peer.rb
110
+ - lib/bytom/api/transactions.rb
111
+ - lib/bytom/api/wallet.rb
112
+ - lib/bytom/api/work.rb
113
+ - lib/bytom/client.rb
114
+ - lib/bytom/constants.rb
115
+ - lib/bytom/request.rb
116
+ - lib/bytom/version.rb
117
+ homepage: https://bytom.io/
118
+ licenses: []
119
+ metadata:
120
+ homepage_uri: https://bytom.io/
121
+ source_code_uri: https://github.com/bitdayone/bytom-ruby-sdk
122
+ changelog_uri: https://github.com/bitdayone/bytom-ruby-sdk/master/CHANGELOG.md
123
+ post_install_message:
124
+ rdoc_options: []
125
+ require_paths:
126
+ - lib
127
+ required_ruby_version: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ required_rubygems_version: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - ">="
135
+ - !ruby/object:Gem::Version
136
+ version: '0'
137
+ requirements: []
138
+ rubyforge_project:
139
+ rubygems_version: 2.7.8
140
+ signing_key:
141
+ specification_version: 4
142
+ summary: Bytom SDK for ruby
143
+ test_files: []