eia 1.7.7 → 1.8.7
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/lib/eia/data.rb +7 -34
- data/lib/eia/ibge.rb +3 -1
- data/lib/eia/version.rb +4 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b39f689896df3554aed8dcba31994601e6fb5b44
|
|
4
|
+
data.tar.gz: fb4ee86b9737775a94d01f14fedbf18279565e03
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ac3d266b1d529ce66e1d27350aebea1109013f2bfcff8b2ef08b10940af7466d232b8c3098f3ad1ab5166e06b25797d6e402aaa0db54997b1f0bd88129c158f6
|
|
7
|
+
data.tar.gz: 1a104c1484427a8a5ec6570d6cdf1e92e88a0135e3a7937d955736f5135c1e9d0ca2f170c63bc030e4545b8b8fb251a10096083a0063220c4e2f08c72cfc4955
|
data/lib/eia/data.rb
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
class DataIBGE
|
|
2
|
+
attr_accessor :table_code, :date, :variable, :location, :classification,
|
|
3
|
+
:unit, :value, :periodicity
|
|
4
|
+
|
|
2
5
|
def initialize(table_code, date, variable, location, classification, unit, value, periodicity)
|
|
3
6
|
@table_code = table_code
|
|
4
7
|
@date = standardize_date(date, periodicity)
|
|
@@ -13,8 +16,9 @@ class DataIBGE
|
|
|
13
16
|
|
|
14
17
|
#The standard is:
|
|
15
18
|
# 2 : "Mês"
|
|
16
|
-
# 4 : "
|
|
19
|
+
# 4 : "Trimestre"
|
|
17
20
|
# 5 : "Ano"
|
|
21
|
+
# 6 : "Trimestre Módel"
|
|
18
22
|
@periodicity = periodicity
|
|
19
23
|
end
|
|
20
24
|
|
|
@@ -22,7 +26,8 @@ class DataIBGE
|
|
|
22
26
|
#date is a four digit number
|
|
23
27
|
if periodicity == 5 then
|
|
24
28
|
return "01/01/#{date}"
|
|
25
|
-
|
|
29
|
+
|
|
30
|
+
elsif [2, 4, 6].include?(periodicity) then
|
|
26
31
|
y = date[0..3]
|
|
27
32
|
m = date[4..5]
|
|
28
33
|
|
|
@@ -33,38 +38,6 @@ class DataIBGE
|
|
|
33
38
|
end
|
|
34
39
|
end
|
|
35
40
|
|
|
36
|
-
def table_code
|
|
37
|
-
return @table_code
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
def date
|
|
41
|
-
return @date
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
def variable
|
|
45
|
-
return @variable
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
def location
|
|
49
|
-
return @location
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
def classification
|
|
53
|
-
return @classification
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
def unit
|
|
57
|
-
return @unit
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
def value
|
|
61
|
-
return @value.to_f
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
def periodicity
|
|
65
|
-
return @periodicity
|
|
66
|
-
end
|
|
67
|
-
|
|
68
41
|
def is_valid?
|
|
69
42
|
if @table_code == '' or @table_code == nil or @table_code.to_i <= 0 then
|
|
70
43
|
puts "Invalid table code supplied. Value is #{@table_code}."
|
data/lib/eia/ibge.rb
CHANGED
|
@@ -69,7 +69,9 @@ class IBGE
|
|
|
69
69
|
heading = output.delete_at(0)
|
|
70
70
|
identifier = heading["D1N"]
|
|
71
71
|
|
|
72
|
-
if identifier.include? "Trimestre Móvel"
|
|
72
|
+
if identifier.include? "Trimestre Móvel" then
|
|
73
|
+
periodicity = 6
|
|
74
|
+
elsif identifier.eql? "Trimestre" then
|
|
73
75
|
periodicity = 4
|
|
74
76
|
elsif identifier.include? "Ano" then
|
|
75
77
|
periodicity = 5
|
data/lib/eia/version.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
module Eia
|
|
2
|
-
VERSION = "1.
|
|
2
|
+
VERSION = "1.8.7"
|
|
3
3
|
|
|
4
4
|
#Standard for version: xx.yy.zz
|
|
5
5
|
# xx - release
|
|
@@ -62,4 +62,7 @@ module Eia
|
|
|
62
62
|
|
|
63
63
|
# Version 1.7.7
|
|
64
64
|
# Improves logging by adding backtrace.
|
|
65
|
+
|
|
66
|
+
# Version 1.8.7
|
|
67
|
+
# Indentifies 'Trimestre móvel' as code 6 for periodicity, differing it from 'Trimestre'.
|
|
65
68
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: eia
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.8.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- rCamposCruz
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2018-
|
|
11
|
+
date: 2018-11-22 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|