dolarblue 0.5.2 → 0.6.0

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: db002622f68bc52f16d1e51c7a95131948041acf
4
- data.tar.gz: b5fb00c8b9b636408d233600f15e6e312a9b0b21
3
+ metadata.gz: 86d900083c0ef7f966b5b002f6a644bcb0ff73e1
4
+ data.tar.gz: 15a48358ae76a4af430dcb08a15b858b945e7817
5
5
  SHA512:
6
- metadata.gz: 80f86de7d93a84d545667232dcaff593c89dbd8984c87dd539ed356ca5919c7ce61e9345363bf3b2c92d7f80f5503ee2ed36aa8f4e668f25f775fcbea12498f8
7
- data.tar.gz: 66c404455e54522d787164c76e4b968e96317518c54372634f7e8c553b90eafb5fa0501a145d585831d3928893c47aae1e9b5d9a027d38444ec76ba70379701c
6
+ metadata.gz: 0b28e3e5b6ee36200555639b8778caa800c34b0df00ee9ed851d70cb41b31b8c4df7c25b40e6161cfe25861f8c346ba91812df7c91a85ea4aa7c311149ea1f57
7
+ data.tar.gz: 23ddcf646c1c9b5535d40ae216623b00bd464a057cc448c0749cb4d687338296e0e60a936009bcc00e95ee923407ef406ddb4c8499adeb7da4cd51d152697ad7
@@ -1 +1 @@
1
- 2.2.2
1
+ 2.2.4
@@ -1,9 +1,8 @@
1
1
  language: ruby
2
2
 
3
3
  rvm:
4
- - 2.2.2
5
- - jruby-1.7.21
6
- - rbx-2.4.1
4
+ - 2.2.4
5
+ - jruby-9
7
6
 
8
7
  before_install:
9
8
  - travis_retry gem install bundler
@@ -1,4 +1,4 @@
1
- ## [In git](https://github.com/elgalu/dolarblue/compare/v0.5.2...HEAD)
1
+ ## [In git](https://github.com/elgalu/dolarblue/compare/v0.6.0...HEAD)
2
2
 
3
3
  ### New Features
4
4
  * n/a
@@ -9,6 +9,19 @@
9
9
  ### Chores
10
10
  * n/a
11
11
 
12
+ ## [v0.6.0](https://github.com/elgalu/dolarblue/tree/v0.6.0)
13
+
14
+ ### New Features
15
+ * Repalce dollar "card" with "bolsa" aka stock
16
+
17
+ ### Bug Fixes
18
+ * Fix new xpath selectors
19
+ * Remove rubinius from build
20
+
21
+ ### Chores
22
+ * Use latest Ruby 2.2.4
23
+ * Use latest jruby-9 in travis
24
+
12
25
  ## [v0.5.2](https://github.com/elgalu/dolarblue/tree/v0.5.2)
13
26
 
14
27
  ### New Features
@@ -1,57 +1,59 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dolarblue (0.5.2)
4
+ dolarblue (0.6.0)
5
5
  configatron (~> 3.2, >= 3.2.0)
6
6
  nokogiri (~> 1.6, >= 1.6.2)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- addressable (2.3.8)
11
+ addressable (2.4.0)
12
12
  configatron (3.2.0)
13
- coveralls (0.8.2)
13
+ coveralls (0.8.10)
14
14
  json (~> 1.8)
15
15
  rest-client (>= 1.6.8, < 2)
16
- simplecov (~> 0.10.0)
16
+ simplecov (~> 0.11.0)
17
17
  term-ansicolor (~> 1.3)
18
18
  thor (~> 0.19.1)
19
- crack (0.4.2)
19
+ tins (~> 1.6.0)
20
+ crack (0.4.3)
20
21
  safe_yaml (~> 1.0.0)
21
22
  diff-lcs (1.2.5)
22
23
  docile (1.1.5)
23
- domain_name (0.5.24)
24
+ domain_name (0.5.25)
24
25
  unf (>= 0.0.5, < 1.0.0)
26
+ hashdiff (0.2.3)
25
27
  http-cookie (1.0.2)
26
28
  domain_name (~> 0.5)
27
29
  json (1.8.3)
28
- mime-types (2.6.1)
29
- mini_portile (0.6.2)
30
- netrc (0.10.3)
31
- nokogiri (1.6.6.2)
32
- mini_portile (~> 0.6.0)
30
+ mime-types (2.99)
31
+ mini_portile2 (2.0.0)
32
+ netrc (0.11.0)
33
+ nokogiri (1.6.7.1)
34
+ mini_portile2 (~> 2.0.0.rc2)
33
35
  rake (10.4.2)
34
- redcarpet (3.3.2)
36
+ redcarpet (3.3.3)
35
37
  rest-client (1.8.0)
36
38
  http-cookie (>= 1.0.2, < 2.0)
37
39
  mime-types (>= 1.16, < 3.0)
38
40
  netrc (~> 0.7)
39
- rspec (3.3.0)
40
- rspec-core (~> 3.3.0)
41
- rspec-expectations (~> 3.3.0)
42
- rspec-mocks (~> 3.3.0)
43
- rspec-core (3.3.1)
44
- rspec-support (~> 3.3.0)
45
- rspec-expectations (3.3.0)
41
+ rspec (3.4.0)
42
+ rspec-core (~> 3.4.0)
43
+ rspec-expectations (~> 3.4.0)
44
+ rspec-mocks (~> 3.4.0)
45
+ rspec-core (3.4.1)
46
+ rspec-support (~> 3.4.0)
47
+ rspec-expectations (3.4.0)
46
48
  diff-lcs (>= 1.2.0, < 2.0)
47
- rspec-support (~> 3.3.0)
48
- rspec-mocks (3.3.1)
49
+ rspec-support (~> 3.4.0)
50
+ rspec-mocks (3.4.0)
49
51
  diff-lcs (>= 1.2.0, < 2.0)
50
- rspec-support (~> 3.3.0)
51
- rspec-support (3.3.0)
52
+ rspec-support (~> 3.4.0)
53
+ rspec-support (3.4.1)
52
54
  rubygems-tasks (0.2.4)
53
55
  safe_yaml (1.0.4)
54
- simplecov (0.10.0)
56
+ simplecov (0.11.1)
55
57
  docile (~> 1.1.0)
56
58
  json (~> 1.8)
57
59
  simplecov-html (~> 0.10.0)
@@ -59,21 +61,22 @@ GEM
59
61
  term-ansicolor (1.3.2)
60
62
  tins (~> 1.0)
61
63
  thor (0.19.1)
62
- tins (1.5.4)
64
+ tins (1.6.0)
63
65
  unf (0.1.4)
64
66
  unf_ext
65
67
  unf_ext (0.0.7.1)
66
68
  vcr (2.9.3)
67
- webmock (1.21.0)
69
+ webmock (1.22.3)
68
70
  addressable (>= 2.3.6)
69
71
  crack (>= 0.3.2)
72
+ hashdiff
70
73
  yard (0.8.7.6)
71
74
 
72
75
  PLATFORMS
73
76
  ruby
74
77
 
75
78
  DEPENDENCIES
76
- bundler (~> 1.10, >= 1.10.5)
79
+ bundler (~> 1.10, >= 1.10.4)
77
80
  coveralls (>= 0.7.12)
78
81
  dolarblue!
79
82
  rake (~> 10.4, >= 10.4.2)
@@ -86,4 +89,4 @@ DEPENDENCIES
86
89
  yard (>= 0.8.7.4)
87
90
 
88
91
  BUNDLED WITH
89
- 1.10.5
92
+ 1.11.2
data/README.md CHANGED
@@ -30,14 +30,14 @@ Query latest values
30
30
  Sample result:
31
31
 
32
32
  Obtaining latest AR$ vs US$ exchange values...Parsing values...
33
- Done: 2013-12-15 19:20:41 -0300
33
+ Done: 2015-12-18 19:50:28 -0300
34
34
 
35
- - Dollar Official....: 9.09 / 9.14
36
- - Dollar Card........: n/a / 12.33
37
- - Dollar Blue........: 13.45 / 13.60
35
+ - Dollar Official....: 13.30 / 13.60
36
+ - Dollar Bolsa.......: n/a / 13.71
37
+ - Dollar Blue........: 14.05 / 14.20
38
38
 
39
- - Gap card.......blue: 10%
40
- - Gap official...blue: 49%
39
+ - Gap bolsa......blue: 4%
40
+ - Gap official...blue: 4%
41
41
 
42
42
  Information source:
43
43
  http://www.ambito.com/economia/mercados/monedas/dolar/
@@ -2,6 +2,6 @@
2
2
  require 'dolarblue'
3
3
 
4
4
  while true
5
- $stdout.puts Dolarblue.get_cardblue_output
5
+ $stdout.puts Dolarblue.get_bolsabolsa_output
6
6
  sleep 60*5 # every 5 minutes
7
7
  end
@@ -2,9 +2,9 @@ base_url: 'http://www.ambito.com/economia/mercados/monedas/dolar/'
2
2
 
3
3
  blue:
4
4
  buy:
5
- xpath: '//*[@id="contenido"]/div[2]/div/div/div[2]/big'
5
+ xpath: '//*[@id="contenido"]/div[1]/div[2]/div/div/div[2]/big'
6
6
  sell:
7
- xpath: '//*[@id="contenido"]/div[2]/div/div/div[3]/big'
7
+ xpath: '//*[@id="contenido"]/div[1]/div[2]/div/div/div[3]/big'
8
8
 
9
9
  official:
10
10
  buy:
@@ -12,6 +12,6 @@ official:
12
12
  sell:
13
13
  xpath: '//*[@id="contenido"]/div[1]/div[1]/div/div/div[3]/big'
14
14
 
15
- card:
15
+ bolsa:
16
16
  sell:
17
17
  xpath: '//*[@id="contenido"]/div[4]/div/div/div[2]/big'
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.summary = %q{Query Argentine Peso vs US$ exchange values with particular interest in official vs. street (blue) reference prices.}
11
11
  spec.description = 'Desc: ' + spec.summary
12
12
 
13
- spec.required_ruby_version = '>= 2.2.2'
13
+ spec.required_ruby_version = '>= 2'
14
14
  spec.required_rubygems_version = '>= 1.8.25'
15
15
 
16
16
  spec.license = 'MIT'
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
32
32
  spec.add_runtime_dependency 'racc' # Solves https://github.com/rubinius/rubinius/issues/2632#issuecomment-26954565
33
33
  end
34
34
 
35
- spec.add_development_dependency 'bundler', '~> 1.10', '>= 1.10.5'
35
+ spec.add_development_dependency 'bundler', '~> 1.10', '>= 1.10.4'
36
36
  spec.add_development_dependency 'rake', '~> 10.4', '>= 10.4.2'
37
37
  spec.add_development_dependency 'rspec', '~> 3.3', '>= 3.3.0'
38
38
  spec.add_development_dependency 'vcr', '~> 2.9', '>= 2.9.3'
@@ -13,12 +13,12 @@ class Dolarblue
13
13
  new.update!.output
14
14
  end
15
15
 
16
- # Returns all the dollar card exchange 'Blue' vs 'Card' info
16
+ # Returns all the dollar bolsa exchange 'Blue' vs 'Bolsa' info
17
17
  # suitable for user printing analysis
18
18
  #
19
- # @return [String] with all dollar exchange 'Blue' vs 'Card' values
20
- def get_cardblue_output
21
- new.update!(false).cardblue_output
19
+ # @return [String] with all dollar exchange 'Blue' vs 'Bolsa' values
20
+ def get_bolsablue_output
21
+ new.update!(false).bolsablue_output
22
22
  end
23
23
  end
24
24
  end
@@ -2,7 +2,7 @@ require 'dolarblue/xchange'
2
2
 
3
3
  class Dolarblue
4
4
  # Class used to hold sell/buy values functionality for dollar "Official"
5
- class Card < XChange
5
+ class Bolsa < XChange
6
6
  # Override extract_values since dollar "tarjeta" only has a sell value
7
7
  #
8
8
  # @param doc [Nokogiri::HTML] the html document to extract values from
@@ -1,7 +1,7 @@
1
1
  require 'dolarblue/configuration'
2
2
  require 'dolarblue/blue'
3
3
  require 'dolarblue/official'
4
- require 'dolarblue/card'
4
+ require 'dolarblue/bolsa'
5
5
 
6
6
  require 'nokogiri' # gem 'nokogiri'
7
7
  require 'open-uri' # stdlib
@@ -17,7 +17,7 @@ class Dolarblue
17
17
  @config = config.defaults
18
18
  @blue = Blue.new
19
19
  @official = Official.new
20
- @card = Card.new
20
+ @bolsa = Bolsa.new
21
21
  self
22
22
  end
23
23
 
@@ -51,9 +51,9 @@ class Dolarblue
51
51
  # Returns the gap percentile between the real (blue) dollar value versus the official
52
52
  #
53
53
  # @return (see #gap_official_percent)
54
- def gap_card_percent
55
- gap_card = @blue.sell / @card.sell - 1
56
- (gap_card * 100).round(0)
54
+ def gap_bolsa_percent
55
+ gap_bolsa = @blue.sell / @bolsa.sell - 1
56
+ (gap_bolsa * 100).round(0)
57
57
  end
58
58
 
59
59
  # Output string to be used by the binary `dolarblue`
@@ -62,10 +62,10 @@ class Dolarblue
62
62
  def output
63
63
  <<-OUTPUT
64
64
  #{@official.output}
65
- #{@card.output}
65
+ #{@bolsa.output}
66
66
  #{@blue.output}
67
67
 
68
- - Gap card.......blue: #{gap_card_percent}%
68
+ - Gap bolsa......blue: #{gap_bolsa_percent}%
69
69
  - Gap official...blue: #{gap_official_percent}%
70
70
 
71
71
  Information source:
@@ -73,24 +73,24 @@ Information source:
73
73
  OUTPUT
74
74
  end
75
75
 
76
- # Output string to be used by the binary `cardblue`
76
+ # Output string to be used by the binary `bolsablue`
77
77
  #
78
- # @return [String] the output with card/dollar exchange info
79
- def cardblue_output
78
+ # @return [String] the output with bolsa/dollar exchange info
79
+ def bolsablue_output
80
80
  n = 27
81
81
  bol_discount = 0.97
82
- card_delay_add = 1.01
82
+ bolsa_delay_add = 1.01
83
83
  payo_discount = 0.967
84
84
  net_ticket = 375
85
85
  sell_ticket = 396.2
86
86
 
87
87
  real = (@blue.sell * bol_discount).round(2)
88
- profit = n * (real * net_ticket * payo_discount - @card.sell * card_delay_add * sell_ticket)
88
+ profit = n * (real * net_ticket * payo_discount - @bolsa.sell * bolsa_delay_add * sell_ticket)
89
89
  now = Time.now.localtime.strftime("%H:%M:%S")
90
90
 
91
91
  <<-OUTPUT
92
- Card[#{@card.sell_output}] Blue[#{@blue.sell_output}] Gap[#{gap_card_percent}%] #{now}
93
- #{profit.round(0)}=#{n}*(#{real}*#{net_ticket}*#{payo_discount}-#{@card.sell}*#{card_delay_add}*#{sell_ticket})
92
+ Bolsa[#{@bolsa.sell_output}] Blue[#{@blue.sell_output}] Gap[#{gap_bolsa_percent}%] #{now}
93
+ #{profit.round(0)}=#{n}*(#{real}*#{net_ticket}*#{payo_discount}-#{@bolsa.sell}*#{bolsa_delay_add}*#{sell_ticket})
94
94
  OUTPUT
95
95
  end
96
96
 
@@ -102,7 +102,7 @@ Card[#{@card.sell_output}] Blue[#{@blue.sell_output}] Gap[#{gap_card_percent}%]
102
102
  #
103
103
  # @return [true, false] boolean If parsed successfully or not
104
104
  def parse_values(doc)
105
- [@blue, @official, @card].each do |type|
105
+ [@blue, @official, @bolsa].each do |type|
106
106
  type.extract_values(doc)
107
107
  end
108
108
  end
@@ -1,3 +1,3 @@
1
1
  class Dolarblue
2
- VERSION = "0.5.2"
2
+ VERSION = "0.6.0"
3
3
  end
@@ -3,13 +3,13 @@ require 'dolarblue/inflector'
3
3
 
4
4
  class Dolarblue
5
5
 
6
- # Base class for Blue, Official and Card used to hold sell/buy values functionality
6
+ # Base class for Blue, Official and Bolsa used to hold sell/buy values functionality
7
7
  #
8
8
  # @abstract
9
9
  class XChange
10
10
  attr_reader :buy, :sell
11
11
 
12
- # Create a new Blue / Official / Card instance to work later on
12
+ # Create a new Blue / Official / Bolsa instance to work later on
13
13
  #
14
14
  # @param config [Configuration] the configuration instance
15
15
  #
@@ -70,7 +70,7 @@ class Dolarblue
70
70
  # Extract individual buy/sell values from a Nokogiri::HTML Document
71
71
  #
72
72
  # @param doc [Nokogiri::HTML] the html document to extract values from
73
- # @param type [String] the dollar type, can be 'blue', 'official', 'card'
73
+ # @param type [String] the dollar type, can be 'blue', 'official', 'bolsa'
74
74
  #
75
75
  # @raise [RuntimeError] if unable to proper buy/sell value for current dollar type
76
76
  #
@@ -10,9 +10,9 @@ values = %q{\d+\.\d+\s+\/\s+\d+\.\d+}
10
10
  start = '- '
11
11
  OUTPUT_MATCHERS = [
12
12
  /^#{start}Dollar Official.*#{values}$/,
13
- /^#{start}Dollar Card.*n\/a\s+\/\s+\d+\.\d+$/,
13
+ /^#{start}Dollar Bolsa.*n\/a\s+\/\s+\d+\.\d+$/,
14
14
  /^#{start}Dollar Blue.*#{values}$/,
15
- /^#{start}Gap card/,
15
+ /^#{start}Gap bolsa/,
16
16
  /^#{start}Gap official/,
17
17
  /^Information source:$/
18
18
  ]
@@ -50,7 +50,7 @@ describe Dolarblue do
50
50
  context 'Class Methods' do
51
51
  subject { Dolarblue }
52
52
 
53
- it 'should return all the dollar exchange Blue/Official/Card values and percentiles' do
53
+ it 'should return all the dollar exchange Blue/Official/Bolsa values and percentiles' do
54
54
  OUTPUT_MATCHERS.each do |regex|
55
55
  expect(subject.get_output).to match(regex)
56
56
  end
@@ -14,7 +14,7 @@ describe Dolarblue::Inflector do
14
14
  end
15
15
 
16
16
  it 'demodulizes 2-levels nested classes' do
17
- expect(subject.demodulize('Dolarblue::Card')).to eq('Card')
17
+ expect(subject.demodulize('Dolarblue::Bolsa')).to eq('Bolsa')
18
18
  end
19
19
 
20
20
  it 'demodulizes larger 4-levels nested classes' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dolarblue
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leo Gallucci
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-12 00:00:00.000000000 Z
11
+ date: 2015-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: configatron
@@ -59,7 +59,7 @@ dependencies:
59
59
  version: '1.10'
60
60
  - - ">="
61
61
  - !ruby/object:Gem::Version
62
- version: 1.10.5
62
+ version: 1.10.4
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
@@ -69,7 +69,7 @@ dependencies:
69
69
  version: '1.10'
70
70
  - - ">="
71
71
  - !ruby/object:Gem::Version
72
- version: 1.10.5
72
+ version: 1.10.4
73
73
  - !ruby/object:Gem::Dependency
74
74
  name: rake
75
75
  requirement: !ruby/object:Gem::Requirement
@@ -175,7 +175,7 @@ description: 'Desc: Query Argentine Peso vs US$ exchange values with particular
175
175
  email:
176
176
  - elgalu3@gmail.com
177
177
  executables:
178
- - cardblue
178
+ - bolsablue
179
179
  - dolarblue
180
180
  extensions: []
181
181
  extra_rdoc_files: []
@@ -192,13 +192,13 @@ files:
192
192
  - LICENSE.md
193
193
  - README.md
194
194
  - Rakefile
195
- - bin/cardblue
195
+ - bin/bolsablue
196
196
  - bin/dolarblue
197
197
  - config/xpaths.yml
198
198
  - dolarblue.gemspec
199
199
  - lib/dolarblue.rb
200
200
  - lib/dolarblue/blue.rb
201
- - lib/dolarblue/card.rb
201
+ - lib/dolarblue/bolsa.rb
202
202
  - lib/dolarblue/configuration.rb
203
203
  - lib/dolarblue/inflector.rb
204
204
  - lib/dolarblue/instance_methods.rb
@@ -221,7 +221,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
221
221
  requirements:
222
222
  - - ">="
223
223
  - !ruby/object:Gem::Version
224
- version: 2.2.2
224
+ version: '2'
225
225
  required_rubygems_version: !ruby/object:Gem::Requirement
226
226
  requirements:
227
227
  - - ">="
@@ -229,7 +229,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
229
229
  version: 1.8.25
230
230
  requirements: []
231
231
  rubyforge_project:
232
- rubygems_version: 2.4.6
232
+ rubygems_version: 2.4.8
233
233
  signing_key:
234
234
  specification_version: 4
235
235
  summary: Query Argentine Peso vs US$ exchange values with particular interest in official
@@ -239,4 +239,3 @@ test_files:
239
239
  - spec/dolarblue_spec.rb
240
240
  - spec/inflector_spec.rb
241
241
  - spec/spec_helper.rb
242
- has_rdoc: