rate_man 0.0.6 → 0.0.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.
Files changed (3) hide show
  1. data/lib/rate_man/version.rb +1 -1
  2. data/lib/rate_man.rb +10 -3
  3. metadata +2 -2
@@ -1,3 +1,3 @@
1
1
  module RateMan
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
data/lib/rate_man.rb CHANGED
@@ -30,9 +30,16 @@ module RateMan
30
30
  end
31
31
 
32
32
  def self.query(from_cur, to_cur)
33
- string = JSON.parse(RateMan.raw_response(from_cur, to_cur))['items'].first['snippet'].split('...')[1]
34
- unless string =~ /\d EUR = \d*\.\d* CHF [-\+]?\d*\.\d* \([-\+]?\d*\.\d*\%\)/
35
- puts string
33
+ incorrect = true
34
+ acceptable_time = true
35
+ i = 0
36
+ while incorrect && acceptable_time
37
+ string = JSON.parse(RateMan.raw_response(from_cur, to_cur))['items'].first['snippet'].split('...')[1]
38
+ incorrect = false if string =~ /\d EUR = \d*\.\d* CHF [-\+]?\d*\.\d* \([-\+]?\d*\.\d*\%\)/
39
+ i += 1
40
+ acceptable_time = false if i > 5
41
+ end
42
+ if incorrect
36
43
  raise ArgumentError, "incorrect json"
37
44
  end
38
45
  string.split(' ')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rate_man
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -53,7 +53,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
53
53
  version: '0'
54
54
  segments:
55
55
  - 0
56
- hash: 389294286417664307
56
+ hash: -3656385961126346063
57
57
  required_rubygems_version: !ruby/object:Gem::Requirement
58
58
  none: false
59
59
  requirements: