bloomberg_currency 1.1.0 → 1.1.1
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/README.md +4 -2
- data/lib/bloomberg_currency.rb +5 -0
- data/lib/bloomberg_currency/api/site.rb +2 -6
- data/lib/bloomberg_currency/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 52251c871972f9221490d20f9d21d5b0169d7a3c7bdda891cf5451d31a4ea39b
|
4
|
+
data.tar.gz: 8a710025b3460c4fe7e2d7734e138a12d1b8d97ab0c815a4c7135ca9c326f9af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 736d3472c878639b025c625aef6eef9ed14060a7a2a334beb2bc92037c7525aa9a2b3a363d3a35c4101a34fb4462d8a8788a85867a71d3e24f785501cf739c7b
|
7
|
+
data.tar.gz: 75fa77f2a4e15285c7a9892491ed54967af80b1674c6d433b61b277dcf5e0ca451b85a35db47ba4b41111470f6ced2b45ae84163ad1aabb8afd2a44ad0038867
|
data/README.md
CHANGED
@@ -24,11 +24,13 @@ Or install it yourself as:
|
|
24
24
|
|
25
25
|
*NOTE*: From version `0.1.0` to `1.0.0` there are mayor breaking changes. Please make sure you read the docs before installing/upgrading to the newest version.
|
26
26
|
|
27
|
-
The gem usability has been improved in version 1.0. Now you only need to create an instance of the class `BC::Quote`, passing the two currencies you'd like to get information about, like this:
|
27
|
+
The gem usability has been improved in version 1.0.0. Now you only need to create an instance of the class `BC::Quote`, passing the two currencies you'd like to get information about, like this:
|
28
28
|
|
29
29
|
```
|
30
30
|
quote = BC::Quote.new('USD', 'EUR')
|
31
|
-
=> #<BC::Quote:
|
31
|
+
=> #<BC::Quote:0x00007fd5858f1620 @price=0.8303, @datetime="", @detail=#<BC::QuoteDetail:0x00007fd583330238 @open=0.8307, @day_range=0.8299..0.8307, @previous_close=0.8306, @last_52_weeks_range=0.8098..0.94, @ytd_return=1.43>, @available=true>
|
32
|
+
quote.detail
|
33
|
+
=> #<BC::QuoteDetail:0x00007fd583330238 @open=0.8307, @day_range=0.8299..0.8307, @previous_close=0.8306, @last_52_weeks_range=0.8098..0.94, @ytd_return=1.43>
|
32
34
|
```
|
33
35
|
|
34
36
|
Then the quote object offers a few accessor methods:
|
data/lib/bloomberg_currency.rb
CHANGED
@@ -1,9 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'faraday'
|
4
|
-
require 'nokogiri'
|
5
|
-
require 'bigdecimal'
|
6
|
-
|
7
3
|
module BC
|
8
4
|
module API
|
9
5
|
# Implements site scrapping
|
@@ -83,9 +79,9 @@ module BC
|
|
83
79
|
|
84
80
|
def calculate_datetime(datetime_str)
|
85
81
|
if datetime_str.index(':')
|
86
|
-
DateTime.strptime(datetime_str, 'As of %H:%M %p %z %m/%d/%Y')
|
82
|
+
::DateTime.strptime(datetime_str, 'As of %H:%M %p %z %m/%d/%Y')
|
87
83
|
else
|
88
|
-
DateTime.strptime(datetime_str, 'As of %m/%d/%Y').to_date
|
84
|
+
::DateTime.strptime(datetime_str, 'As of %m/%d/%Y').to_date
|
89
85
|
end
|
90
86
|
rescue
|
91
87
|
''
|