ttsttb 0.0.1 → 0.0.2

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
  SHA256:
3
- metadata.gz: f916b02b86d132784599993ad65e6ca0d5b6497f3fb9718e958186a2ad2f5937
4
- data.tar.gz: 14bcdc784fa817afcc583ffde6a4206b94e7cb42c4dfb4f54a0c2ce4de468af6
3
+ metadata.gz: c64ead79b53e522b03905ca4201eb0ca0aae343dbe1b651403bc59c5eae83faf
4
+ data.tar.gz: '03760922b03c8179709651a8a0fe8e8f30c9c6907a9993550f217923bc050cbb'
5
5
  SHA512:
6
- metadata.gz: 6d1d2881696bd9621131bfa5492d639328be05dcc946361b9f7d8a9ed9d37cf56ce32419a82d75e8ae9559807ca3a1cdd0fb77b16fad71b02f5fc346a463589e
7
- data.tar.gz: 7201d447f742941bd7b60b36f9192a159fd1046ab68b4fd5830e723658a1b381ddf6a24668ccd770af8dcf2169aa487d167bd63c1f61db4f4920964a412e03b9
6
+ metadata.gz: cced5dc5b6220ea62e8f161ff49ae513cb0a78c40411dc76305db86a3f49f69ef921f8899095492a1ddba141f1cdac71aaffd652ed67602274e3efa7675b0cb1
7
+ data.tar.gz: 36567e5174a43ea6878cfe1792eea0fdd9cfdcbeaddf231109fc04b49e2fddc5744891bca2197fc505fc591dd45f8d36852716ce291d88bc987b945fa1ef947b
data/README.md CHANGED
@@ -1,8 +1,11 @@
1
- # Ttsttb
1
+ # TTS TTB library
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/ttsttb`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ [TTS and TTB value of Forex](http://www.murc-kawasesouba.jp/fx/past_3month.php) is provided by MUFG. Major information provider of TTS and TTB is MUFG in Japan but the data is not provided by commonly used data format like CSV and JSON to handle by program for ease.
4
+
5
+ I created Ruby gem to get the TTS and TTB corresponding to the passed date. You can get hash of currency code key and value of TTS and TTB.
6
+
7
+ __Caution__ : This library has no test and exception handling is not tested to cover all the source data.
4
8
 
5
- TODO: Delete this and the text above, and describe your gem
6
9
 
7
10
  ## Installation
8
11
 
@@ -22,9 +25,18 @@ Or install it yourself as:
22
25
 
23
26
  ## Usage
24
27
 
28
+ - Common error
29
+ - `find` method throws `OpenURI::HTTPRedirect` exception if data source is not found.
30
+
25
31
  ```ruby
26
- % irb
27
- irb(main):011:0> pp Ttsttb.find(Date.new(2018,1,1)); nil
32
+ % bin/console
33
+ irb(main):001:0> require 'pp'
34
+ true
35
+ irb(main):001:0> require 'date'
36
+ true
37
+ irb(main):003:0> pp Ttsttb.find(Date.new(2018, 1, 7))['USD']['tts']
38
+ 108.52
39
+ irb(main):004:0> pp Ttsttb.find(Date.new(2018, 1, 1)); nil
28
40
  {"USD"=>
29
41
  {"currency"=>{"en"=>"US Dollar", "ja"=>"米ドル"},
30
42
  "code"=>"USD",
@@ -10,7 +10,7 @@ module Ttsttb
10
10
  require 'open-uri'
11
11
  require 'nokogiri'
12
12
 
13
- doc = Nokogiri::HTML(open(url))
13
+ doc = Nokogiri::HTML(open(url, redirect: false))
14
14
  doc.xpath('//table[1]/tr').each do |tr|
15
15
  tds = tr.xpath('.//td')
16
16
 
@@ -1,3 +1,3 @@
1
1
  module Ttsttb
2
- VERSION = '0.0.1'.freeze
2
+ VERSION = '0.0.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ttsttb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuki Matsukura