bovesparb 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bovesparb.gemspec +2 -2
- data/lib/bovesparb/client.rb +22 -3
- data/lib/bovesparb/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6eec17b1f7d3bceb581182be9f9ca0e93b5703b9717dc7ed2aa2c93714aee982
|
4
|
+
data.tar.gz: d689b70c2483eaeac81f20c17dc38c8aa865ad95a523cbd035a1d4f4db168186
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8e830a4b3d171ec9fdc480ca1b94317b7f80a9f6cc49a39d33cd4d05463dbb22814f802827717ca444e170b1889aaa199b59268c9cf9e3468244813d2247af2
|
7
|
+
data.tar.gz: 378356dbe2a2db9c78b27f587863f2cf7268922a78d0371570a5f129064d9a66838bc95f228e5a9c24d746591f2754264dc950b00e4e9c9677ea7acc1165ac9b
|
data/bovesparb.gemspec
CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
|
|
7
7
|
spec.name = "bovesparb"
|
8
8
|
spec.version = Bovesparb::VERSION
|
9
9
|
spec.authors = ["Hugo Lyra"]
|
10
|
-
spec.email = ["
|
10
|
+
spec.email = ["me@hugolyra.com"]
|
11
11
|
|
12
12
|
spec.summary = %q{BovespaRB}
|
13
13
|
spec.description = %q{A Ruby library to query the bovespa stocks.}
|
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
|
|
26
26
|
|
27
27
|
spec.require_paths = ["lib"]
|
28
28
|
|
29
|
-
spec.add_development_dependency "bundler", "
|
29
|
+
spec.add_development_dependency "bundler", "> 1.17"
|
30
30
|
spec.add_development_dependency "rake", "~> 12.3", ">= 12.3.3"
|
31
31
|
spec.add_development_dependency "rspec", "~> 3.0"
|
32
32
|
|
data/lib/bovesparb/client.rb
CHANGED
@@ -1,15 +1,34 @@
|
|
1
1
|
module Bovesparb
|
2
2
|
class Client
|
3
|
-
API_ENDPOINT =
|
3
|
+
API_ENDPOINT = "http://bvmf.bmfbovespa.com.br".freeze
|
4
|
+
DICTIONARY = {
|
5
|
+
Codigo: :ticket,
|
6
|
+
Nome: :name,
|
7
|
+
Data: :date,
|
8
|
+
Abertura: :open,
|
9
|
+
Minimo: :low,
|
10
|
+
Maximo: :high,
|
11
|
+
Medio: :average,
|
12
|
+
Ultimo: :close,
|
13
|
+
Oscilacao: :variation,
|
14
|
+
}
|
4
15
|
|
5
16
|
def quotes(stocks)
|
6
|
-
request
|
17
|
+
response = request(params: { strListaCodigos: stocks })
|
18
|
+
parser(response)
|
7
19
|
end
|
8
20
|
|
9
21
|
private
|
10
22
|
|
23
|
+
def parser(response)
|
24
|
+
tickets = response[:ComportamentoPapeis][:Papel].flatten
|
25
|
+
tickets.collect do |ticket|
|
26
|
+
ticket.transform_keys { |key| DICTIONARY[key] || key }
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
11
30
|
def client
|
12
|
-
@_client ||= Faraday.new(API_ENDPOINT) do |client|
|
31
|
+
@_client ||= Faraday.new(API_ENDPOINT, request: { open_timeout: 3, timeout: 5 }) do |client|
|
13
32
|
client.request :url_encoded
|
14
33
|
client.adapter Faraday.default_adapter
|
15
34
|
end
|
data/lib/bovesparb/version.rb
CHANGED
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bovesparb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hugo Lyra
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.17'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.17'
|
27
27
|
- !ruby/object:Gem::Dependency
|
@@ -94,7 +94,7 @@ dependencies:
|
|
94
94
|
version: '2.11'
|
95
95
|
description: A Ruby library to query the bovespa stocks.
|
96
96
|
email:
|
97
|
-
-
|
97
|
+
- me@hugolyra.com
|
98
98
|
executables: []
|
99
99
|
extensions: []
|
100
100
|
extra_rdoc_files: []
|