elchapo 0.1.2 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 90ac66b620839de68e1517a40fc4f40029544b24
4
- data.tar.gz: 092f29394d553bd50980962042ffaaec144c06f0
3
+ metadata.gz: 2606f6b487a32d94dff54491dcd4ac9181d8ca0a
4
+ data.tar.gz: c29ed0674b2164586b6d648e73dfc8ccd0c9064a
5
5
  SHA512:
6
- metadata.gz: ed3bd8f6b617a4d3cab2c149f6dc195ad07e7f085acd1b4f5b4e36db9a141810d080704311ad5ff380df3d53373a9b85e30f77f71dbcea2366ccb457509fb504
7
- data.tar.gz: d10f5fdbb29e24f8f58bccec09b156f8e8b1aea28bb593cbb1720bbf2bc9d48d798d3fb70a725da8d3982a4f767126f4395bfe5fe1a1af7d480dc0e329af9ad7
6
+ metadata.gz: cbd2cec362407c38c8b8096ce3704f1346448636007fc97efad148c8f3d4e6552f4a5edc5e47ee5331b0c9f382c2c757055c1fd7bd203a07b4178ade89bed675
7
+ data.tar.gz: 420b363385f88c3a80b4d0f7ceae13fde3940d28f0b636c680b5ab8cf8ba71deebe8161934cc1b7a187772a5c0f32217e694438ed45d88f0486f84d33b23e39d
@@ -23,4 +23,5 @@ Gem::Specification.new do |spec|
23
23
  spec.add_development_dependency "rspec", "~> 3.0"
24
24
  spec.add_dependency "activesupport", "~> 5.0"
25
25
  spec.add_dependency "digest-sha3", "~> 1.1"
26
+ spec.add_dependency "rest-client", "2.0.2"
26
27
  end
@@ -1,37 +1,28 @@
1
- require 'net/http'
2
1
  require 'json'
2
+ require 'rest-client'
3
+
3
4
  module Bitcoin
4
5
  class HttpConnection < Client
5
- attr_accessor :host, :port, :uri, :ssl
6
6
 
7
7
  def initialize(host, user:, pass:)
8
8
  super()
9
- uri = URI.parse(host)
10
- raise ArgumentError unless ['http', 'https'].include? uri.scheme
11
- @host = uri.host
12
- @port = uri.port
13
9
  @user = user
14
10
  @pass = pass
11
+ @url = host
15
12
 
16
- @ssl = uri.scheme == 'https'
17
- if ssl
18
- @uri = URI("https://#{@host}:#{@port}")
19
- else
20
- @uri = URI("http://#{@host}:#{@port}")
21
- end
13
+ @header = {'Content-Type' => 'application/json'}
22
14
  end
23
15
 
24
16
  def send_single(payload)
25
- http = ::Net::HTTP.new(@host, @port)
26
- if @ssl
27
- http.use_ssl = true
28
- end
29
- header = {'Content-Type' => 'application/json'}
30
- request = ::Net::HTTP::Post.new(uri, header)
31
- request.basic_auth(@user, @pass)
32
- request.body = payload
33
- response = http.request(request)
34
- return response.body
17
+ resp = RestClient::Request.execute(
18
+ user: @user,
19
+ password: @pass,
20
+ method: :post,
21
+ url: @url,
22
+ payload: payload,
23
+ headers: @header
24
+ )
25
+ return resp
35
26
  end
36
27
 
37
28
  end
@@ -1,3 +1,3 @@
1
1
  module Elchapo
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elchapo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - DilumN
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-13 00:00:00.000000000 Z
11
+ date: 2018-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '1.1'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rest-client
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '='
88
+ - !ruby/object:Gem::Version
89
+ version: 2.0.2
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '='
95
+ - !ruby/object:Gem::Version
96
+ version: 2.0.2
83
97
  description: This will enable your Ruby application to connect to Ethereum Blockchain
84
98
  email:
85
99
  - dilumnavanjana@gmail.com
@@ -121,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
135
  version: '0'
122
136
  requirements: []
123
137
  rubyforge_project:
124
- rubygems_version: 2.6.13
138
+ rubygems_version: 2.6.8
125
139
  signing_key:
126
140
  specification_version: 4
127
141
  summary: Ruby API for Ethereum Blockchain network