sfcbus 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ vendor
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in sfcbus.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 mako2x
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,64 @@
1
+ SFCBus
2
+ ===
3
+ Ruby gem that provides bus information at Keio Univ SFC.
4
+
5
+
6
+ Installation
7
+ ---
8
+ $ gem install sfcbus
9
+
10
+
11
+ Usage
12
+ ---
13
+ #### Command Line
14
+
15
+ $ sfcbus
16
+ 平日
17
+ 湘南台駅 -> SFC
18
+ ----------
19
+ 16:33
20
+ 16:39 ツインライナー
21
+ 16:45 笹久保経由
22
+ 16:52 ツインライナー
23
+ 17:00
24
+
25
+
26
+ #### Ruby
27
+ ```ruby
28
+ require 'sfcbus'
29
+
30
+ sfcbus = SFCBus.new
31
+ timetable = sfcbus.select(
32
+ :from => :sfc,
33
+ :to => :shonandai,
34
+ :day_type => :weekday
35
+ )
36
+
37
+ # Result
38
+ timetable.each do |bus|
39
+ puts bus.hour
40
+ puts bus.min
41
+ puts bus.from # => :sfc, :shonandai, :tsujido
42
+ puts bus.to # => :sfc, :shonandai, :tsujido
43
+ puts bus.type # => :normal, :twinliner, :sasakubo, :night
44
+ puts bus.rotary?
45
+ end
46
+
47
+ # Timetable last updated
48
+ p sfcbus.updated_at
49
+
50
+ ```
51
+
52
+ Test
53
+ ---
54
+ $ rake spec
55
+
56
+
57
+ Contributing
58
+ ---
59
+
60
+ 1. Fork it
61
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
62
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
63
+ 4. Push to the branch (`git push origin my-new-feature`)
64
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,9 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new do |spec|
5
+ spec.pattern = 'spec/**/*_spec.rb'
6
+ spec.rspec_opts = ['-c', '-fs']
7
+ end
8
+
9
+ task :default => :spec
data/bin/sfcbus ADDED
@@ -0,0 +1,47 @@
1
+ #!/usr/bin/env ruby
2
+ #coding:utf-8
3
+
4
+ require 'args_parser'
5
+ require 'sfcbus'
6
+
7
+ # Parse Arguments
8
+ parser = ArgsParser.parse ARGV do
9
+ arg :from, 'filter by source (options: sfc, shonandai, tsujido)', :alias => :f
10
+ arg :to, 'filter by desination (options: sfc, shonandai, tsujido)', :alias => :t
11
+ arg :day_type, 'filter by day type (options: weekday, saturday, holiday)', :alias => :d
12
+ arg :limit, 'list limit (default: 5)', :alias => :l
13
+ arg :help, 'show help', :alias => :h
14
+ arg :version, 'print version', :alias => :v
15
+
16
+ filter(:from) { |a| a.to_sym }
17
+ filter(:to) { |a| a.to_sym }
18
+ filter(:day_type) { |a| a.to_sym }
19
+ end
20
+
21
+ if parser.has_option?(:help)
22
+ STDERR.puts parser.help
23
+ exit 1
24
+ end
25
+
26
+ if parser.has_option?(:version)
27
+ STDERR.puts SFCBus::VERSION
28
+ exit 1
29
+ end
30
+
31
+
32
+
33
+ sfcbus = SFCBus.new
34
+ list = sfcbus.next_list(parser)
35
+ if list.empty?
36
+ puts '本日のバスは終了しました。'
37
+ puts "相愛交通(#{SFCBus::TaxiPhoneNumber})をご利用ください。"
38
+ else
39
+ puts list[0].day_type_jp
40
+ puts "#{list[0].from_jp} -> #{list[0].to_jp}"
41
+ puts '-' * 10
42
+ list.each do |bus|
43
+ print bus.inspect_time
44
+ print " #{bus.type_jp}"
45
+ puts
46
+ end
47
+ end
data/lib/sfcbus/bus.rb ADDED
@@ -0,0 +1,35 @@
1
+ #coding:utf-8
2
+
3
+ module SFCBus
4
+ class Bus
5
+ attr_reader :day_type, :from, :to, :hour, :min, :type, :is_rotary
6
+
7
+ def initialize(params)
8
+ params.each { |k, v| instance_variable_set("@#{k}", v) }
9
+ end
10
+
11
+ def rotary?
12
+ @is_rotary
13
+ end
14
+
15
+ def from_jp
16
+ SFCBus::Locations::JP[@from]
17
+ end
18
+
19
+ def to_jp
20
+ SFCBus::Locations::JP[@to]
21
+ end
22
+
23
+ def type_jp
24
+ SFCBus::Types::JP[@type]
25
+ end
26
+
27
+ def day_type_jp
28
+ SFCBus::DayTypes::JP[@day_type]
29
+ end
30
+
31
+ def inspect_time
32
+ "#{@hour.to_s.rjust(2, '0')}:#{@min.to_s.rjust(2, '0')}"
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,53 @@
1
+ #coding:utf-8
2
+ require 'open-uri'
3
+ require 'net/http'
4
+ require 'json'
5
+
6
+ module SFCBus
7
+ class Client
8
+ def fetch
9
+ http = Net::HTTP.new('hack.sfc.keioac.jp')
10
+ res = http.get('/sfcbusapi/index.php')
11
+ res.value
12
+ parsed = SFCBus::Parser.parse(res.body)
13
+ @updated_at = parsed[:updated_at]
14
+ @timetable = parsed[:timetable]
15
+ end
16
+
17
+ def timetable
18
+ fetch if @timetable.nil?
19
+ @timetable
20
+ end
21
+
22
+ def updated_at
23
+ fetch if @updated_at.nil?
24
+ @updated_at
25
+ end
26
+
27
+ def select(opts = {})
28
+ SFCBus::Validator.validate(opts)
29
+
30
+ list = timetable
31
+ list.select! { |bus| bus.from == opts[:from] } unless opts[:from].nil?
32
+ list.select! { |bus| bus.to == opts[:to] } unless opts[:to].nil?
33
+ list.select! { |bus| bus.type == opts[:type] } unless opts[:type].nil?
34
+ list.select! { |bus| bus.day_type == opts[:day_type] } unless opts[:day_type].nil?
35
+ list.select! { |bus| bus.rotary? == opts[:is_rotary] } unless opts[:is_rotary].nil?
36
+ list
37
+ end
38
+
39
+ def next_list(opts = {})
40
+ if opts[:from].nil? and opts[:to].nil?
41
+ route = [SFCBus::Locations::SFC, SFCBus::Locations::Shonandai]
42
+ opts[:from], opts[:to] = SFCBus::Utils.at_sfc? ? route : route.reverse
43
+ end
44
+ opts[:day_type] ||= SFCBus::Utils.today_day_type
45
+ opts[:limit] ||= 5
46
+
47
+ now = Time.now
48
+ select(opts).select { |b|
49
+ (now.hour < b.hour) or (now.hour == b.hour and now.min < b.min)
50
+ }.take(opts[:limit])
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,48 @@
1
+ #coding:utf-8
2
+
3
+ module SFCBus
4
+ module Locations
5
+ SFC = :sfc
6
+ Shonandai = :shonandai
7
+ Tsujido = :tsujido
8
+ List = [SFC, Shonandai, Tsujido]
9
+ JP = {
10
+ SFC => 'SFC',
11
+ Shonandai => '湘南台駅',
12
+ Tsujido => '辻堂駅',
13
+ }
14
+ end
15
+
16
+ module Types
17
+ Normal = :normal
18
+ Twinliner = :twinliner
19
+ Sasakubo = :sasakubo
20
+ Night = :night
21
+ List = [Normal, Twinliner, Sasakubo, Night]
22
+ JP = {
23
+ Normal => '',
24
+ Twinliner => 'ツインライナー',
25
+ Sasakubo => '笹久保経由',
26
+ Night => '深夜バス',
27
+ }
28
+ end
29
+
30
+ module DayTypes
31
+ Weekday = :weekday
32
+ Saturday = :saturday
33
+ Holiday = :holiday
34
+ List = [Weekday, Saturday, Holiday]
35
+ JP = {
36
+ Weekday => '平日',
37
+ Saturday => '土曜',
38
+ Holiday => '休日',
39
+ }
40
+ end
41
+
42
+ module Rotary
43
+ JP = 'ロータリー発'
44
+ end
45
+
46
+ TaxiPhoneNumber = '0120-87-2610'
47
+
48
+ end
@@ -0,0 +1,65 @@
1
+ #coding:utf-8
2
+ require 'date'
3
+
4
+ module SFCBus
5
+ class Parser
6
+ def self.parse(body)
7
+ body =~ /callback\((.+)\);/
8
+ json = JSON.parse($1)
9
+ updated_at = parse_updated_at(json.pop)
10
+
11
+ timetable = []
12
+ json.each do |json2|
13
+ json2.each_with_index do |buses, day_type|
14
+ buses.each do |bus|
15
+ timetable << SFCBus::Bus.new(
16
+ :day_type => parse_day_type(day_type),
17
+ :from => parse_location(bus['from']),
18
+ :to => parse_location(bus['to']),
19
+ :hour => bus['h'],
20
+ :min => bus['m'],
21
+ :type => parse_bus_type(bus['type']),
22
+ :is_rotary => parse_is_rotary(bus['type'])
23
+ )
24
+ end
25
+ end
26
+ end
27
+ {:timetable => timetable, :updated_at => updated_at}
28
+ end
29
+
30
+ def self.parse_updated_at(str)
31
+ year, month, day = str.split('.').map(&:to_i)
32
+ Date.new(year, month, day)
33
+ end
34
+
35
+ def self.parse_day_type(num)
36
+ [
37
+ SFCBus::DayTypes::Weekday,
38
+ SFCBus::DayTypes::Saturday,
39
+ SFCBus::DayTypes::Holiday
40
+ ][num]
41
+ end
42
+
43
+ def self.parse_bus_type(str)
44
+ char = str.sub('r', '')
45
+ return SFCBus::Types::Normal if char == ''
46
+ {
47
+ 't' => SFCBus::Types::Twinliner,
48
+ 's' => SFCBus::Types::Sasakubo,
49
+ 'n' => SFCBus::Types::Night
50
+ }[char]
51
+ end
52
+
53
+ def self.parse_location(str)
54
+ {
55
+ 'sfc' => SFCBus::Locations::SFC,
56
+ 'sho' => SFCBus::Locations::Shonandai,
57
+ 'tuji' => SFCBus::Locations::Tsujido
58
+ }[str]
59
+ end
60
+
61
+ def self.parse_is_rotary(str)
62
+ str.include?('r')
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,24 @@
1
+ #coding:utf-8
2
+ require 'date'
3
+ require 'holidays'
4
+ require 'socket'
5
+
6
+ module SFCBus::Utils
7
+ def self.today_day_type
8
+ today = Date.today
9
+ if today.holiday?(:jp)
10
+ SFCBus::DayTypes::Holiday
11
+ elsif today.sunday?
12
+ SFCBus::DayTypes::Holiday
13
+ elsif today.saturday?
14
+ SFCBus::DayTypes::Saturday
15
+ else
16
+ SFCBus::DayTypes::Weekday
17
+ end
18
+ end
19
+
20
+ def self.at_sfc?
21
+ ip_address = Socket.getaddrinfo(Socket.gethostname, 'http')[0][2]
22
+ !!(ip_address =~ /^(133\.27|203.178)/)
23
+ end
24
+ end
@@ -0,0 +1,25 @@
1
+ #coding:utf-8
2
+ require 'open-uri'
3
+ require 'net/http'
4
+ require 'json'
5
+
6
+ module SFCBus
7
+ class Validator
8
+ def self.validate(opts)
9
+ _validate('Location', opts[:from])
10
+ _validate('Location', opts[:to])
11
+ _validate('Type', opts[:type])
12
+ _validate('DayType', opts[:day_type])
13
+ end
14
+
15
+ private
16
+ def self._validate(prop, val)
17
+ return if val.nil?
18
+ list = SFCBus.module_eval("#{prop}s")::List
19
+ unless list.include?(val)
20
+ err_msg = "Unknown #{prop.downcase} '#{val.to_s}'. Valid #{prop.downcase}s: #{list.map(&:to_s).join(', ')}"
21
+ raise ArgumentError, err_msg
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,3 @@
1
+ module SFCBus
2
+ VERSION = '0.0.2'
3
+ end
data/lib/sfcbus.rb ADDED
@@ -0,0 +1,16 @@
1
+ #coding:utf-8
2
+ $:.unshift(File.dirname(__FILE__))
3
+
4
+ require 'sfcbus/version'
5
+ require 'sfcbus/constants'
6
+ require 'sfcbus/utils'
7
+ require 'sfcbus/validator'
8
+ require 'sfcbus/bus'
9
+ require 'sfcbus/parser'
10
+ require 'sfcbus/client'
11
+
12
+ module SFCBus
13
+ def self.new
14
+ SFCBus::Client.new
15
+ end
16
+ end
data/sfcbus.gemspec ADDED
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'sfcbus/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = 'sfcbus'
8
+ gem.version = SFCBus::VERSION
9
+ gem.authors = ['mako2x']
10
+ gem.email = ['arekara3nen@gmail.com']
11
+ gem.description = %q{Ruby gem that provides bus information at Keio Univ SFC.}
12
+ gem.summary = %q{Provides bus information at SFC.}
13
+ gem.homepage = 'https://github.com/mako2x/sfcbus'
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ['lib']
19
+ gem.add_dependency 'holidays', '>=1.0.5'
20
+ gem.add_dependency 'args_parser', '>=0.1.4'
21
+ gem.add_development_dependency 'rspec'
22
+ end
data/spec/api.jsonp ADDED
@@ -0,0 +1 @@
1
+ callback([[[{"h":7,"m":10,"from":"sho","to":"sfc","type":""},{"h":7,"m":17,"from":"sho","to":"sfc","type":""},{"h":7,"m":24,"from":"sho","to":"sfc","type":"t"},{"h":7,"m":30,"from":"sho","to":"sfc","type":""},{"h":7,"m":35,"from":"sho","to":"sfc","type":"t"},{"h":7,"m":40,"from":"sho","to":"sfc","type":""},{"h":7,"m":44,"from":"sho","to":"sfc","type":""},{"h":7,"m":48,"from":"sho","to":"sfc","type":""},{"h":7,"m":53,"from":"sho","to":"sfc","type":"t"},{"h":7,"m":56,"from":"sho","to":"sfc","type":""},{"h":8,"m":1,"from":"sho","to":"sfc","type":"t"},{"h":8,"m":4,"from":"sho","to":"sfc","type":""},{"h":8,"m":9,"from":"sho","to":"sfc","type":"t"},{"h":8,"m":12,"from":"sho","to":"sfc","type":""},{"h":8,"m":17,"from":"sho","to":"sfc","type":"t"},{"h":8,"m":20,"from":"sho","to":"sfc","type":""},{"h":8,"m":24,"from":"sho","to":"sfc","type":""},{"h":8,"m":28,"from":"sho","to":"sfc","type":""},{"h":8,"m":35,"from":"sho","to":"sfc","type":"t"},{"h":8,"m":40,"from":"sho","to":"sfc","type":""},{"h":8,"m":45,"from":"sho","to":"sfc","type":"t"},{"h":8,"m":49,"from":"sho","to":"sfc","type":""},{"h":8,"m":55,"from":"sho","to":"sfc","type":"t"},{"h":8,"m":59,"from":"sho","to":"sfc","type":""},{"h":9,"m":4,"from":"sho","to":"sfc","type":"t"},{"h":9,"m":8,"from":"sho","to":"sfc","type":""},{"h":9,"m":12,"from":"sho","to":"sfc","type":""},{"h":9,"m":16,"from":"sho","to":"sfc","type":""},{"h":9,"m":22,"from":"sho","to":"sfc","type":"t"},{"h":9,"m":26,"from":"sho","to":"sfc","type":""},{"h":9,"m":32,"from":"sho","to":"sfc","type":"t"},{"h":9,"m":36,"from":"sho","to":"sfc","type":""},{"h":9,"m":40,"from":"sho","to":"sfc","type":""},{"h":9,"m":50,"from":"sho","to":"sfc","type":"t"},{"h":9,"m":55,"from":"sho","to":"sfc","type":""},{"h":10,"m":0,"from":"sho","to":"sfc","type":""},{"h":10,"m":5,"from":"sho","to":"sfc","type":""},{"h":10,"m":12,"from":"sho","to":"sfc","type":"t"},{"h":10,"m":17,"from":"sho","to":"sfc","type":""},{"h":10,"m":25,"from":"sho","to":"sfc","type":"t"},{"h":10,"m":30,"from":"sho","to":"sfc","type":""},{"h":10,"m":35,"from":"sho","to":"sfc","type":""},{"h":10,"m":40,"from":"sho","to":"sfc","type":""},{"h":10,"m":45,"from":"sho","to":"sfc","type":""},{"h":10,"m":50,"from":"sho","to":"sfc","type":""},{"h":10,"m":55,"from":"sho","to":"sfc","type":""},{"h":11,"m":0,"from":"sho","to":"sfc","type":""},{"h":11,"m":5,"from":"sho","to":"sfc","type":""},{"h":11,"m":10,"from":"sho","to":"sfc","type":""},{"h":11,"m":15,"from":"sho","to":"sfc","type":""},{"h":11,"m":20,"from":"sho","to":"sfc","type":""},{"h":11,"m":30,"from":"sho","to":"sfc","type":""},{"h":11,"m":40,"from":"sho","to":"sfc","type":""},{"h":11,"m":50,"from":"sho","to":"sfc","type":""},{"h":12,"m":0,"from":"sho","to":"sfc","type":"t"},{"h":12,"m":10,"from":"sho","to":"sfc","type":""},{"h":12,"m":20,"from":"sho","to":"sfc","type":""},{"h":12,"m":25,"from":"sho","to":"sfc","type":""},{"h":12,"m":30,"from":"sho","to":"sfc","type":""},{"h":12,"m":35,"from":"sho","to":"sfc","type":""},{"h":12,"m":40,"from":"sho","to":"sfc","type":""},{"h":12,"m":45,"from":"sho","to":"sfc","type":"t"},{"h":12,"m":50,"from":"sho","to":"sfc","type":""},{"h":12,"m":55,"from":"sho","to":"sfc","type":""},{"h":13,"m":5,"from":"sho","to":"sfc","type":"t"},{"h":13,"m":15,"from":"sho","to":"sfc","type":"s"},{"h":13,"m":25,"from":"sho","to":"sfc","type":""},{"h":13,"m":35,"from":"sho","to":"sfc","type":""},{"h":13,"m":45,"from":"sho","to":"sfc","type":"s"},{"h":13,"m":55,"from":"sho","to":"sfc","type":"t"},{"h":14,"m":5,"from":"sho","to":"sfc","type":""},{"h":14,"m":15,"from":"sho","to":"sfc","type":"s"},{"h":14,"m":20,"from":"sho","to":"sfc","type":""},{"h":14,"m":25,"from":"sho","to":"sfc","type":""},{"h":14,"m":35,"from":"sho","to":"sfc","type":""},{"h":14,"m":45,"from":"sho","to":"sfc","type":"s"},{"h":14,"m":55,"from":"sho","to":"sfc","type":""},{"h":15,"m":5,"from":"sho","to":"sfc","type":""},{"h":15,"m":15,"from":"sho","to":"sfc","type":"s"},{"h":15,"m":25,"from":"sho","to":"sfc","type":""},{"h":15,"m":35,"from":"sho","to":"sfc","type":""},{"h":15,"m":40,"from":"sho","to":"sfc","type":"t"},{"h":15,"m":45,"from":"sho","to":"sfc","type":"s"},{"h":15,"m":52,"from":"sho","to":"sfc","type":""},{"h":16,"m":0,"from":"sho","to":"sfc","type":"t"},{"h":16,"m":5,"from":"sho","to":"sfc","type":""},{"h":16,"m":10,"from":"sho","to":"sfc","type":"t"},{"h":16,"m":15,"from":"sho","to":"sfc","type":"s"},{"h":16,"m":21,"from":"sho","to":"sfc","type":"t"},{"h":16,"m":27,"from":"sho","to":"sfc","type":""},{"h":16,"m":33,"from":"sho","to":"sfc","type":""},{"h":16,"m":39,"from":"sho","to":"sfc","type":"t"},{"h":16,"m":45,"from":"sho","to":"sfc","type":"s"},{"h":16,"m":52,"from":"sho","to":"sfc","type":"t"},{"h":17,"m":0,"from":"sho","to":"sfc","type":""},{"h":17,"m":8,"from":"sho","to":"sfc","type":"t"},{"h":17,"m":15,"from":"sho","to":"sfc","type":"s"},{"h":17,"m":21,"from":"sho","to":"sfc","type":"t"},{"h":17,"m":27,"from":"sho","to":"sfc","type":"t"},{"h":17,"m":33,"from":"sho","to":"sfc","type":""},{"h":17,"m":39,"from":"sho","to":"sfc","type":"t"},{"h":17,"m":45,"from":"sho","to":"sfc","type":"s"},{"h":17,"m":50,"from":"sho","to":"sfc","type":"t"},{"h":17,"m":57,"from":"sho","to":"sfc","type":""},{"h":18,"m":5,"from":"sho","to":"sfc","type":"t"},{"h":18,"m":15,"from":"sho","to":"sfc","type":"s"},{"h":18,"m":23,"from":"sho","to":"sfc","type":"t"},{"h":18,"m":30,"from":"sho","to":"sfc","type":""},{"h":18,"m":35,"from":"sho","to":"sfc","type":"t"},{"h":18,"m":42,"from":"sho","to":"sfc","type":"s"},{"h":18,"m":47,"from":"sho","to":"sfc","type":"t"},{"h":18,"m":54,"from":"sho","to":"sfc","type":"t"},{"h":19,"m":3,"from":"sho","to":"sfc","type":""},{"h":19,"m":13,"from":"sho","to":"sfc","type":"t"},{"h":19,"m":17,"from":"sho","to":"sfc","type":"s"},{"h":19,"m":21,"from":"sho","to":"sfc","type":"t"},{"h":19,"m":27,"from":"sho","to":"sfc","type":""},{"h":19,"m":33,"from":"sho","to":"sfc","type":"t"},{"h":19,"m":39,"from":"sho","to":"sfc","type":""},{"h":19,"m":45,"from":"sho","to":"sfc","type":"s"},{"h":19,"m":55,"from":"sho","to":"sfc","type":""},{"h":20,"m":5,"from":"sho","to":"sfc","type":""},{"h":20,"m":15,"from":"sho","to":"sfc","type":"s"},{"h":20,"m":25,"from":"sho","to":"sfc","type":""},{"h":20,"m":35,"from":"sho","to":"sfc","type":""},{"h":20,"m":50,"from":"sho","to":"sfc","type":"s"},{"h":21,"m":5,"from":"sho","to":"sfc","type":""},{"h":21,"m":20,"from":"sho","to":"sfc","type":"s"},{"h":21,"m":35,"from":"sho","to":"sfc","type":""},{"h":21,"m":50,"from":"sho","to":"sfc","type":"s"}],[{"h":7,"m":15,"from":"sho","to":"sfc","type":""},{"h":7,"m":24,"from":"sho","to":"sfc","type":"t"},{"h":7,"m":30,"from":"sho","to":"sfc","type":""},{"h":7,"m":35,"from":"sho","to":"sfc","type":"t"},{"h":7,"m":40,"from":"sho","to":"sfc","type":""},{"h":7,"m":44,"from":"sho","to":"sfc","type":""},{"h":7,"m":48,"from":"sho","to":"sfc","type":""},{"h":7,"m":53,"from":"sho","to":"sfc","type":"t"},{"h":7,"m":56,"from":"sho","to":"sfc","type":""},{"h":8,"m":1,"from":"sho","to":"sfc","type":"t"},{"h":8,"m":4,"from":"sho","to":"sfc","type":""},{"h":8,"m":9,"from":"sho","to":"sfc","type":"t"},{"h":8,"m":12,"from":"sho","to":"sfc","type":""},{"h":8,"m":17,"from":"sho","to":"sfc","type":"t"},{"h":8,"m":20,"from":"sho","to":"sfc","type":""},{"h":8,"m":25,"from":"sho","to":"sfc","type":""},{"h":8,"m":32,"from":"sho","to":"sfc","type":"t"},{"h":8,"m":37,"from":"sho","to":"sfc","type":""},{"h":8,"m":45,"from":"sho","to":"sfc","type":"t"},{"h":8,"m":50,"from":"sho","to":"sfc","type":""},{"h":8,"m":57,"from":"sho","to":"sfc","type":"t"},{"h":9,"m":2,"from":"sho","to":"sfc","type":""},{"h":9,"m":10,"from":"sho","to":"sfc","type":"t"},{"h":9,"m":15,"from":"sho","to":"sfc","type":""},{"h":9,"m":22,"from":"sho","to":"sfc","type":"t"},{"h":9,"m":28,"from":"sho","to":"sfc","type":""},{"h":9,"m":37,"from":"sho","to":"sfc","type":"t"},{"h":9,"m":43,"from":"sho","to":"sfc","type":""},{"h":9,"m":52,"from":"sho","to":"sfc","type":"t"},{"h":10,"m":0,"from":"sho","to":"sfc","type":""},{"h":10,"m":12,"from":"sho","to":"sfc","type":"t"},{"h":10,"m":24,"from":"sho","to":"sfc","type":""},{"h":10,"m":36,"from":"sho","to":"sfc","type":""},{"h":10,"m":48,"from":"sho","to":"sfc","type":""},{"h":11,"m":0,"from":"sho","to":"sfc","type":""},{"h":11,"m":12,"from":"sho","to":"sfc","type":""},{"h":11,"m":24,"from":"sho","to":"sfc","type":""},{"h":11,"m":36,"from":"sho","to":"sfc","type":""},{"h":11,"m":50,"from":"sho","to":"sfc","type":""},{"h":12,"m":0,"from":"sho","to":"sfc","type":""},{"h":12,"m":10,"from":"sho","to":"sfc","type":""},{"h":12,"m":20,"from":"sho","to":"sfc","type":"t"},{"h":12,"m":30,"from":"sho","to":"sfc","type":""},{"h":12,"m":40,"from":"sho","to":"sfc","type":""},{"h":12,"m":50,"from":"sho","to":"sfc","type":""},{"h":13,"m":0,"from":"sho","to":"sfc","type":"s"},{"h":13,"m":7,"from":"sho","to":"sfc","type":"t"},{"h":13,"m":15,"from":"sho","to":"sfc","type":"t"},{"h":13,"m":21,"from":"sho","to":"sfc","type":""},{"h":13,"m":29,"from":"sho","to":"sfc","type":"t"},{"h":13,"m":37,"from":"sho","to":"sfc","type":"t"},{"h":13,"m":43,"from":"sho","to":"sfc","type":"s"},{"h":13,"m":51,"from":"sho","to":"sfc","type":"t"},{"h":14,"m":0,"from":"sho","to":"sfc","type":"t"},{"h":14,"m":6,"from":"sho","to":"sfc","type":""},{"h":14,"m":15,"from":"sho","to":"sfc","type":"t"},{"h":14,"m":25,"from":"sho","to":"sfc","type":"t"},{"h":14,"m":35,"from":"sho","to":"sfc","type":""},{"h":14,"m":45,"from":"sho","to":"sfc","type":"s"},{"h":14,"m":55,"from":"sho","to":"sfc","type":""},{"h":15,"m":5,"from":"sho","to":"sfc","type":"t"},{"h":15,"m":15,"from":"sho","to":"sfc","type":"s"},{"h":15,"m":25,"from":"sho","to":"sfc","type":""},{"h":15,"m":35,"from":"sho","to":"sfc","type":""},{"h":15,"m":45,"from":"sho","to":"sfc","type":"s"},{"h":15,"m":55,"from":"sho","to":"sfc","type":""},{"h":16,"m":5,"from":"sho","to":"sfc","type":""},{"h":16,"m":15,"from":"sho","to":"sfc","type":"s"},{"h":16,"m":25,"from":"sho","to":"sfc","type":""},{"h":16,"m":35,"from":"sho","to":"sfc","type":""},{"h":16,"m":45,"from":"sho","to":"sfc","type":"s"},{"h":16,"m":55,"from":"sho","to":"sfc","type":""},{"h":17,"m":5,"from":"sho","to":"sfc","type":""},{"h":17,"m":15,"from":"sho","to":"sfc","type":"s"},{"h":17,"m":25,"from":"sho","to":"sfc","type":"t"},{"h":17,"m":35,"from":"sho","to":"sfc","type":""},{"h":17,"m":45,"from":"sho","to":"sfc","type":"s"},{"h":17,"m":55,"from":"sho","to":"sfc","type":""},{"h":18,"m":5,"from":"sho","to":"sfc","type":"s"},{"h":18,"m":15,"from":"sho","to":"sfc","type":"t"},{"h":18,"m":25,"from":"sho","to":"sfc","type":""},{"h":18,"m":35,"from":"sho","to":"sfc","type":"t"},{"h":18,"m":45,"from":"sho","to":"sfc","type":"s"},{"h":18,"m":55,"from":"sho","to":"sfc","type":""},{"h":19,"m":5,"from":"sho","to":"sfc","type":"t"},{"h":19,"m":15,"from":"sho","to":"sfc","type":"s"},{"h":19,"m":25,"from":"sho","to":"sfc","type":"t"},{"h":19,"m":35,"from":"sho","to":"sfc","type":""},{"h":19,"m":45,"from":"sho","to":"sfc","type":"s"},{"h":19,"m":55,"from":"sho","to":"sfc","type":""},{"h":20,"m":10,"from":"sho","to":"sfc","type":""}],[{"h":7,"m":35,"from":"sho","to":"sfc","type":""},{"h":7,"m":50,"from":"sho","to":"sfc","type":""},{"h":8,"m":5,"from":"sho","to":"sfc","type":""},{"h":8,"m":20,"from":"sho","to":"sfc","type":""},{"h":8,"m":35,"from":"sho","to":"sfc","type":""},{"h":8,"m":50,"from":"sho","to":"sfc","type":""},{"h":9,"m":5,"from":"sho","to":"sfc","type":""},{"h":9,"m":20,"from":"sho","to":"sfc","type":""},{"h":9,"m":35,"from":"sho","to":"sfc","type":""},{"h":9,"m":50,"from":"sho","to":"sfc","type":""},{"h":10,"m":5,"from":"sho","to":"sfc","type":""},{"h":10,"m":20,"from":"sho","to":"sfc","type":""},{"h":10,"m":35,"from":"sho","to":"sfc","type":""},{"h":10,"m":50,"from":"sho","to":"sfc","type":""},{"h":11,"m":5,"from":"sho","to":"sfc","type":""},{"h":11,"m":20,"from":"sho","to":"sfc","type":""},{"h":11,"m":35,"from":"sho","to":"sfc","type":""},{"h":11,"m":50,"from":"sho","to":"sfc","type":""},{"h":12,"m":5,"from":"sho","to":"sfc","type":""},{"h":12,"m":20,"from":"sho","to":"sfc","type":""},{"h":12,"m":50,"from":"sho","to":"sfc","type":""},{"h":13,"m":20,"from":"sho","to":"sfc","type":""},{"h":13,"m":50,"from":"sho","to":"sfc","type":"s"},{"h":14,"m":20,"from":"sho","to":"sfc","type":""},{"h":14,"m":35,"from":"sho","to":"sfc","type":""},{"h":14,"m":50,"from":"sho","to":"sfc","type":"s"},{"h":15,"m":20,"from":"sho","to":"sfc","type":""},{"h":15,"m":50,"from":"sho","to":"sfc","type":"s"},{"h":16,"m":5,"from":"sho","to":"sfc","type":""},{"h":16,"m":20,"from":"sho","to":"sfc","type":""},{"h":16,"m":50,"from":"sho","to":"sfc","type":"s"},{"h":17,"m":20,"from":"sho","to":"sfc","type":""},{"h":17,"m":50,"from":"sho","to":"sfc","type":"s"},{"h":18,"m":20,"from":"sho","to":"sfc","type":""},{"h":18,"m":50,"from":"sho","to":"sfc","type":"s"},{"h":19,"m":20,"from":"sho","to":"sfc","type":""},{"h":19,"m":50,"from":"sho","to":"sfc","type":"s"}]],[[{"h":7,"m":0,"from":"sfc","to":"sho","type":"rt"},{"h":7,"m":5,"from":"sfc","to":"sho","type":"rs"},{"h":7,"m":15,"from":"sfc","to":"sho","type":"rt"},{"h":7,"m":28,"from":"sfc","to":"sho","type":"r"},{"h":7,"m":32,"from":"sfc","to":"sho","type":"rt"},{"h":7,"m":35,"from":"sfc","to":"sho","type":"r"},{"h":7,"m":40,"from":"sfc","to":"sho","type":"rt"},{"h":7,"m":45,"from":"sfc","to":"sho","type":"rt"},{"h":7,"m":47,"from":"sfc","to":"sho","type":"rs"},{"h":7,"m":55,"from":"sfc","to":"sho","type":"rt"},{"h":8,"m":2,"from":"sfc","to":"sho","type":"rs"},{"h":8,"m":8,"from":"sfc","to":"sho","type":"r"},{"h":8,"m":12,"from":"sfc","to":"sho","type":"rt"},{"h":8,"m":18,"from":"sfc","to":"sho","type":"r"},{"h":8,"m":22,"from":"sfc","to":"sho","type":"rt"},{"h":8,"m":24,"from":"sfc","to":"sho","type":"rs"},{"h":8,"m":32,"from":"sfc","to":"sho","type":"rt"},{"h":8,"m":37,"from":"sfc","to":"sho","type":"r"},{"h":8,"m":42,"from":"sfc","to":"sho","type":"rt"},{"h":8,"m":50,"from":"sfc","to":"sho","type":"r"},{"h":8,"m":55,"from":"sfc","to":"sho","type":"rt"},{"h":9,"m":0,"from":"sfc","to":"sho","type":"rs"},{"h":9,"m":10,"from":"sfc","to":"sho","type":"rt"},{"h":9,"m":20,"from":"sfc","to":"sho","type":"r"},{"h":9,"m":30,"from":"sfc","to":"sho","type":"rt"},{"h":9,"m":35,"from":"sfc","to":"sho","type":"rs"},{"h":9,"m":50,"from":"sfc","to":"sho","type":"rt"},{"h":10,"m":0,"from":"sfc","to":"sho","type":"rt"},{"h":10,"m":7,"from":"sfc","to":"sho","type":"rs"},{"h":10,"m":20,"from":"sfc","to":"sho","type":"r"},{"h":10,"m":27,"from":"sfc","to":"sho","type":"rs"},{"h":10,"m":40,"from":"sfc","to":"sho","type":"r"},{"h":10,"m":50,"from":"sfc","to":"sho","type":"r"},{"h":11,"m":0,"from":"sfc","to":"sho","type":"r"},{"h":11,"m":7,"from":"sfc","to":"sho","type":"rs"},{"h":11,"m":20,"from":"sfc","to":"sho","type":"r"},{"h":11,"m":30,"from":"sfc","to":"sho","type":"r"},{"h":11,"m":40,"from":"sfc","to":"sho","type":"rt"},{"h":11,"m":50,"from":"sfc","to":"sho","type":"r"},{"h":12,"m":0,"from":"sfc","to":"sho","type":"r"},{"h":12,"m":10,"from":"sfc","to":"sho","type":"rs"},{"h":12,"m":20,"from":"sfc","to":"sho","type":"rt"},{"h":12,"m":30,"from":"sfc","to":"sho","type":"rs"},{"h":12,"m":40,"from":"sfc","to":"sho","type":"rt"},{"h":12,"m":50,"from":"sfc","to":"sho","type":"r"},{"h":13,"m":0,"from":"sfc","to":"sho","type":"r"},{"h":13,"m":10,"from":"sfc","to":"sho","type":"r"},{"h":13,"m":20,"from":"sfc","to":"sho","type":"r"},{"h":13,"m":30,"from":"sfc","to":"sho","type":"rt"},{"h":13,"m":40,"from":"sfc","to":"sho","type":"r"},{"h":13,"m":50,"from":"sfc","to":"sho","type":"r"},{"h":14,"m":0,"from":"sfc","to":"sho","type":"r"},{"h":14,"m":10,"from":"sfc","to":"sho","type":"r"},{"h":14,"m":20,"from":"sfc","to":"sho","type":"r"},{"h":14,"m":30,"from":"sfc","to":"sho","type":"r"},{"h":14,"m":38,"from":"sfc","to":"sho","type":"r"},{"h":14,"m":46,"from":"sfc","to":"sho","type":"r"},{"h":14,"m":54,"from":"sfc","to":"sho","type":"r"},{"h":15,"m":2,"from":"sfc","to":"sho","type":"r"},{"h":15,"m":9,"from":"sfc","to":"sho","type":"r"},{"h":15,"m":16,"from":"sfc","to":"sho","type":""},{"h":15,"m":21,"from":"sfc","to":"sho","type":"t"},{"h":15,"m":24,"from":"sfc","to":"sho","type":""},{"h":15,"m":31,"from":"sfc","to":"sho","type":""},{"h":15,"m":38,"from":"sfc","to":"sho","type":"t"},{"h":15,"m":43,"from":"sfc","to":"sho","type":""},{"h":15,"m":51,"from":"sfc","to":"sho","type":"t"},{"h":15,"m":56,"from":"sfc","to":"sho","type":""},{"h":16,"m":3,"from":"sfc","to":"sho","type":"t"},{"h":16,"m":8,"from":"sfc","to":"sho","type":""},{"h":16,"m":13,"from":"sfc","to":"sho","type":""},{"h":16,"m":20,"from":"sfc","to":"sho","type":"t"},{"h":16,"m":25,"from":"sfc","to":"sho","type":""},{"h":16,"m":33,"from":"sfc","to":"sho","type":"t"},{"h":16,"m":38,"from":"sfc","to":"sho","type":""},{"h":16,"m":45,"from":"sfc","to":"sho","type":"t"},{"h":16,"m":50,"from":"sfc","to":"sho","type":""},{"h":16,"m":58,"from":"sfc","to":"sho","type":"t"},{"h":17,"m":5,"from":"sfc","to":"sho","type":"t"},{"h":17,"m":10,"from":"sfc","to":"sho","type":""},{"h":17,"m":18,"from":"sfc","to":"sho","type":"t"},{"h":17,"m":23,"from":"sfc","to":"sho","type":""},{"h":17,"m":30,"from":"sfc","to":"sho","type":"t"},{"h":17,"m":35,"from":"sfc","to":"sho","type":""},{"h":17,"m":43,"from":"sfc","to":"sho","type":"t"},{"h":17,"m":48,"from":"sfc","to":"sho","type":""},{"h":17,"m":55,"from":"sfc","to":"sho","type":""},{"h":18,"m":3,"from":"sfc","to":"sho","type":"t"},{"h":18,"m":8,"from":"sfc","to":"sho","type":""},{"h":18,"m":16,"from":"sfc","to":"sho","type":"t"},{"h":18,"m":20,"from":"sfc","to":"sho","type":""},{"h":18,"m":28,"from":"sfc","to":"sho","type":"t"},{"h":18,"m":35,"from":"sfc","to":"sho","type":"t"},{"h":18,"m":40,"from":"sfc","to":"sho","type":""},{"h":18,"m":47,"from":"sfc","to":"sho","type":""},{"h":18,"m":55,"from":"sfc","to":"sho","type":"t"},{"h":19,"m":1,"from":"sfc","to":"sho","type":"t"},{"h":19,"m":7,"from":"sfc","to":"sho","type":""},{"h":19,"m":15,"from":"sfc","to":"sho","type":"t"},{"h":19,"m":20,"from":"sfc","to":"sho","type":""},{"h":19,"m":30,"from":"sfc","to":"sho","type":""},{"h":19,"m":40,"from":"sfc","to":"sho","type":""},{"h":19,"m":50,"from":"sfc","to":"sho","type":""},{"h":20,"m":0,"from":"sfc","to":"sho","type":""},{"h":20,"m":10,"from":"sfc","to":"sho","type":""},{"h":20,"m":20,"from":"sfc","to":"sho","type":""},{"h":20,"m":30,"from":"sfc","to":"sho","type":""},{"h":20,"m":40,"from":"sfc","to":"sho","type":""},{"h":20,"m":50,"from":"sfc","to":"sho","type":""},{"h":21,"m":0,"from":"sfc","to":"sho","type":""},{"h":21,"m":15,"from":"sfc","to":"sho","type":""},{"h":21,"m":30,"from":"sfc","to":"sho","type":""},{"h":21,"m":50,"from":"sfc","to":"sho","type":""},{"h":22,"m":10,"from":"sfc","to":"sho","type":""},{"h":22,"m":30,"from":"sfc","to":"sho","type":""},{"h":22,"m":50,"from":"sfc","to":"sho","type":""},{"h":23,"m":15,"from":"sfc","to":"sho","type":"n"}],[{"h":7,"m":0,"from":"sfc","to":"sho","type":"rt"},{"h":7,"m":5,"from":"sfc","to":"sho","type":"rs"},{"h":7,"m":15,"from":"sfc","to":"sho","type":"rt"},{"h":7,"m":28,"from":"sfc","to":"sho","type":"r"},{"h":7,"m":32,"from":"sfc","to":"sho","type":"rt"},{"h":7,"m":35,"from":"sfc","to":"sho","type":"r"},{"h":7,"m":40,"from":"sfc","to":"sho","type":"rt"},{"h":7,"m":45,"from":"sfc","to":"sho","type":"rt"},{"h":7,"m":47,"from":"sfc","to":"sho","type":"rs"},{"h":7,"m":55,"from":"sfc","to":"sho","type":"rt"},{"h":8,"m":2,"from":"sfc","to":"sho","type":"rs"},{"h":8,"m":8,"from":"sfc","to":"sho","type":"r"},{"h":8,"m":12,"from":"sfc","to":"sho","type":"rt"},{"h":8,"m":18,"from":"sfc","to":"sho","type":"r"},{"h":8,"m":22,"from":"sfc","to":"sho","type":"rt"},{"h":8,"m":27,"from":"sfc","to":"sho","type":"r"},{"h":8,"m":32,"from":"sfc","to":"sho","type":"rt"},{"h":8,"m":42,"from":"sfc","to":"sho","type":"rt"},{"h":8,"m":50,"from":"sfc","to":"sho","type":"r"},{"h":8,"m":55,"from":"sfc","to":"sho","type":"rt"},{"h":9,"m":0,"from":"sfc","to":"sho","type":"r"},{"h":9,"m":10,"from":"sfc","to":"sho","type":"rt"},{"h":9,"m":20,"from":"sfc","to":"sho","type":"rs"},{"h":9,"m":30,"from":"sfc","to":"sho","type":"rt"},{"h":9,"m":37,"from":"sfc","to":"sho","type":"rs"},{"h":9,"m":50,"from":"sfc","to":"sho","type":"rt"},{"h":10,"m":0,"from":"sfc","to":"sho","type":"r"},{"h":10,"m":10,"from":"sfc","to":"sho","type":"rs"},{"h":10,"m":24,"from":"sfc","to":"sho","type":"r"},{"h":10,"m":36,"from":"sfc","to":"sho","type":"r"},{"h":10,"m":48,"from":"sfc","to":"sho","type":"r"},{"h":11,"m":0,"from":"sfc","to":"sho","type":"r"},{"h":11,"m":10,"from":"sfc","to":"sho","type":"rs"},{"h":11,"m":24,"from":"sfc","to":"sho","type":"r"},{"h":11,"m":36,"from":"sfc","to":"sho","type":"r"},{"h":11,"m":48,"from":"sfc","to":"sho","type":"r"},{"h":11,"m":58,"from":"sfc","to":"sho","type":"rt"},{"h":12,"m":10,"from":"sfc","to":"sho","type":"r"},{"h":12,"m":20,"from":"sfc","to":"sho","type":"rs"},{"h":12,"m":30,"from":"sfc","to":"sho","type":"r"},{"h":12,"m":40,"from":"sfc","to":"sho","type":"r"},{"h":12,"m":48,"from":"sfc","to":"sho","type":"t"},{"h":12,"m":55,"from":"sfc","to":"sho","type":"t"},{"h":13,"m":0,"from":"sfc","to":"sho","type":""},{"h":13,"m":7,"from":"sfc","to":"sho","type":"t"},{"h":13,"m":15,"from":"sfc","to":"sho","type":"t"},{"h":13,"m":20,"from":"sfc","to":"sho","type":""},{"h":13,"m":28,"from":"sfc","to":"sho","type":"t"},{"h":13,"m":36,"from":"sfc","to":"sho","type":"t"},{"h":13,"m":41,"from":"sfc","to":"sho","type":""},{"h":13,"m":50,"from":"sfc","to":"sho","type":"t"},{"h":14,"m":0,"from":"sfc","to":"sho","type":"t"},{"h":14,"m":10,"from":"sfc","to":"sho","type":""},{"h":14,"m":20,"from":"sfc","to":"sho","type":""},{"h":14,"m":30,"from":"sfc","to":"sho","type":""},{"h":14,"m":40,"from":"sfc","to":"sho","type":"t"},{"h":14,"m":50,"from":"sfc","to":"sho","type":""},{"h":15,"m":0,"from":"sfc","to":"sho","type":""},{"h":15,"m":10,"from":"sfc","to":"sho","type":""},{"h":15,"m":20,"from":"sfc","to":"sho","type":""},{"h":15,"m":30,"from":"sfc","to":"sho","type":""},{"h":15,"m":40,"from":"sfc","to":"sho","type":""},{"h":15,"m":50,"from":"sfc","to":"sho","type":""},{"h":16,"m":0,"from":"sfc","to":"sho","type":""},{"h":16,"m":10,"from":"sfc","to":"sho","type":""},{"h":16,"m":20,"from":"sfc","to":"sho","type":""},{"h":16,"m":30,"from":"sfc","to":"sho","type":""},{"h":16,"m":40,"from":"sfc","to":"sho","type":""},{"h":16,"m":50,"from":"sfc","to":"sho","type":""},{"h":17,"m":0,"from":"sfc","to":"sho","type":"t"},{"h":17,"m":10,"from":"sfc","to":"sho","type":""},{"h":17,"m":20,"from":"sfc","to":"sho","type":""},{"h":17,"m":30,"from":"sfc","to":"sho","type":""},{"h":17,"m":40,"from":"sfc","to":"sho","type":""},{"h":17,"m":50,"from":"sfc","to":"sho","type":"t"},{"h":18,"m":0,"from":"sfc","to":"sho","type":""},{"h":18,"m":10,"from":"sfc","to":"sho","type":"t"},{"h":18,"m":20,"from":"sfc","to":"sho","type":""},{"h":18,"m":30,"from":"sfc","to":"sho","type":""},{"h":18,"m":40,"from":"sfc","to":"sho","type":"t"},{"h":18,"m":50,"from":"sfc","to":"sho","type":""},{"h":19,"m":0,"from":"sfc","to":"sho","type":"t"},{"h":19,"m":10,"from":"sfc","to":"sho","type":""},{"h":19,"m":20,"from":"sfc","to":"sho","type":""},{"h":19,"m":30,"from":"sfc","to":"sho","type":""},{"h":19,"m":40,"from":"sfc","to":"sho","type":""},{"h":19,"m":50,"from":"sfc","to":"sho","type":""},{"h":20,"m":0,"from":"sfc","to":"sho","type":""},{"h":20,"m":10,"from":"sfc","to":"sho","type":""},{"h":20,"m":30,"from":"sfc","to":"sho","type":""}],[{"h":8,"m":10,"from":"sfc","to":"sho","type":"rs"},{"h":8,"m":25,"from":"sfc","to":"sho","type":"r"},{"h":8,"m":40,"from":"sfc","to":"sho","type":"r"},{"h":9,"m":10,"from":"sfc","to":"sho","type":"rs"},{"h":9,"m":40,"from":"sfc","to":"sho","type":"r"},{"h":10,"m":10,"from":"sfc","to":"sho","type":"rs"},{"h":10,"m":25,"from":"sfc","to":"sho","type":"r"},{"h":10,"m":40,"from":"sfc","to":"sho","type":"r"},{"h":11,"m":10,"from":"sfc","to":"sho","type":"rs"},{"h":11,"m":40,"from":"sfc","to":"sho","type":"r"},{"h":12,"m":10,"from":"sfc","to":"sho","type":"rs"},{"h":12,"m":25,"from":"sfc","to":"sho","type":"r"},{"h":12,"m":40,"from":"sfc","to":"sho","type":"r"},{"h":13,"m":10,"from":"sfc","to":"sho","type":"rs"},{"h":13,"m":30,"from":"sfc","to":"sho","type":"r"},{"h":13,"m":45,"from":"sfc","to":"sho","type":"r"},{"h":14,"m":0,"from":"sfc","to":"sho","type":"r"},{"h":14,"m":15,"from":"sfc","to":"sho","type":"r"},{"h":14,"m":30,"from":"sfc","to":"sho","type":"r"},{"h":14,"m":45,"from":"sfc","to":"sho","type":"r"},{"h":15,"m":0,"from":"sfc","to":"sho","type":"r"},{"h":15,"m":15,"from":"sfc","to":"sho","type":"r"},{"h":15,"m":30,"from":"sfc","to":"sho","type":"r"},{"h":15,"m":45,"from":"sfc","to":"sho","type":"r"},{"h":16,"m":0,"from":"sfc","to":"sho","type":"r"},{"h":16,"m":15,"from":"sfc","to":"sho","type":"r"},{"h":16,"m":30,"from":"sfc","to":"sho","type":"r"},{"h":16,"m":45,"from":"sfc","to":"sho","type":"r"},{"h":17,"m":0,"from":"sfc","to":"sho","type":"r"},{"h":17,"m":15,"from":"sfc","to":"sho","type":"r"},{"h":17,"m":30,"from":"sfc","to":"sho","type":"r"},{"h":17,"m":45,"from":"sfc","to":"sho","type":"r"},{"h":18,"m":15,"from":"sfc","to":"sho","type":"r"},{"h":18,"m":45,"from":"sfc","to":"sho","type":"r"},{"h":19,"m":45,"from":"sfc","to":"sho","type":"r"}]],[[{"h":7,"m":3,"from":"tuji","to":"sfc","type":""},{"h":7,"m":18,"from":"tuji","to":"sfc","type":""},{"h":7,"m":33,"from":"tuji","to":"sfc","type":""},{"h":7,"m":48,"from":"tuji","to":"sfc","type":""},{"h":7,"m":58,"from":"tuji","to":"sfc","type":""},{"h":8,"m":3,"from":"tuji","to":"sfc","type":""},{"h":8,"m":13,"from":"tuji","to":"sfc","type":""},{"h":8,"m":23,"from":"tuji","to":"sfc","type":""},{"h":8,"m":33,"from":"tuji","to":"sfc","type":""},{"h":8,"m":43,"from":"tuji","to":"sfc","type":""},{"h":8,"m":53,"from":"tuji","to":"sfc","type":""},{"h":9,"m":3,"from":"tuji","to":"sfc","type":""},{"h":9,"m":15,"from":"tuji","to":"sfc","type":""},{"h":9,"m":25,"from":"tuji","to":"sfc","type":""},{"h":9,"m":35,"from":"tuji","to":"sfc","type":""},{"h":9,"m":45,"from":"tuji","to":"sfc","type":""},{"h":9,"m":55,"from":"tuji","to":"sfc","type":""},{"h":10,"m":5,"from":"tuji","to":"sfc","type":""},{"h":10,"m":15,"from":"tuji","to":"sfc","type":""},{"h":10,"m":25,"from":"tuji","to":"sfc","type":""},{"h":10,"m":35,"from":"tuji","to":"sfc","type":""},{"h":10,"m":45,"from":"tuji","to":"sfc","type":""},{"h":10,"m":55,"from":"tuji","to":"sfc","type":""},{"h":11,"m":5,"from":"tuji","to":"sfc","type":""},{"h":11,"m":20,"from":"tuji","to":"sfc","type":""},{"h":11,"m":35,"from":"tuji","to":"sfc","type":""},{"h":11,"m":50,"from":"tuji","to":"sfc","type":""},{"h":12,"m":5,"from":"tuji","to":"sfc","type":""},{"h":12,"m":20,"from":"tuji","to":"sfc","type":""},{"h":12,"m":35,"from":"tuji","to":"sfc","type":""},{"h":12,"m":50,"from":"tuji","to":"sfc","type":""},{"h":13,"m":5,"from":"tuji","to":"sfc","type":""},{"h":13,"m":20,"from":"tuji","to":"sfc","type":""},{"h":13,"m":35,"from":"tuji","to":"sfc","type":""},{"h":13,"m":50,"from":"tuji","to":"sfc","type":""},{"h":14,"m":5,"from":"tuji","to":"sfc","type":""},{"h":14,"m":20,"from":"tuji","to":"sfc","type":""},{"h":14,"m":35,"from":"tuji","to":"sfc","type":""},{"h":14,"m":50,"from":"tuji","to":"sfc","type":""},{"h":15,"m":5,"from":"tuji","to":"sfc","type":""},{"h":15,"m":20,"from":"tuji","to":"sfc","type":""},{"h":15,"m":35,"from":"tuji","to":"sfc","type":""},{"h":15,"m":50,"from":"tuji","to":"sfc","type":""},{"h":16,"m":5,"from":"tuji","to":"sfc","type":""},{"h":16,"m":20,"from":"tuji","to":"sfc","type":""},{"h":16,"m":35,"from":"tuji","to":"sfc","type":""},{"h":16,"m":50,"from":"tuji","to":"sfc","type":""},{"h":17,"m":5,"from":"tuji","to":"sfc","type":""},{"h":17,"m":20,"from":"tuji","to":"sfc","type":""},{"h":17,"m":35,"from":"tuji","to":"sfc","type":""},{"h":17,"m":50,"from":"tuji","to":"sfc","type":""},{"h":18,"m":5,"from":"tuji","to":"sfc","type":""},{"h":18,"m":25,"from":"tuji","to":"sfc","type":""},{"h":18,"m":45,"from":"tuji","to":"sfc","type":""},{"h":19,"m":5,"from":"tuji","to":"sfc","type":""},{"h":19,"m":35,"from":"tuji","to":"sfc","type":""},{"h":20,"m":5,"from":"tuji","to":"sfc","type":""},{"h":20,"m":35,"from":"tuji","to":"sfc","type":""},{"h":21,"m":5,"from":"tuji","to":"sfc","type":""},{"h":21,"m":35,"from":"tuji","to":"sfc","type":""},{"h":22,"m":35,"from":"tuji","to":"sfc","type":""}],[{"h":7,"m":33,"from":"tuji","to":"sfc","type":""},{"h":7,"m":45,"from":"tuji","to":"sfc","type":""},{"h":7,"m":55,"from":"tuji","to":"sfc","type":""},{"h":8,"m":5,"from":"tuji","to":"sfc","type":""},{"h":8,"m":13,"from":"tuji","to":"sfc","type":""},{"h":8,"m":25,"from":"tuji","to":"sfc","type":""},{"h":8,"m":35,"from":"tuji","to":"sfc","type":""},{"h":8,"m":45,"from":"tuji","to":"sfc","type":""},{"h":8,"m":55,"from":"tuji","to":"sfc","type":""},{"h":9,"m":5,"from":"tuji","to":"sfc","type":""},{"h":9,"m":15,"from":"tuji","to":"sfc","type":""},{"h":9,"m":25,"from":"tuji","to":"sfc","type":""},{"h":9,"m":35,"from":"tuji","to":"sfc","type":""},{"h":9,"m":45,"from":"tuji","to":"sfc","type":""},{"h":9,"m":55,"from":"tuji","to":"sfc","type":""},{"h":10,"m":5,"from":"tuji","to":"sfc","type":""},{"h":10,"m":15,"from":"tuji","to":"sfc","type":""},{"h":10,"m":25,"from":"tuji","to":"sfc","type":""},{"h":10,"m":35,"from":"tuji","to":"sfc","type":""},{"h":10,"m":50,"from":"tuji","to":"sfc","type":""},{"h":11,"m":5,"from":"tuji","to":"sfc","type":""},{"h":11,"m":20,"from":"tuji","to":"sfc","type":""},{"h":11,"m":35,"from":"tuji","to":"sfc","type":""},{"h":11,"m":50,"from":"tuji","to":"sfc","type":""},{"h":12,"m":5,"from":"tuji","to":"sfc","type":""},{"h":12,"m":20,"from":"tuji","to":"sfc","type":""},{"h":12,"m":35,"from":"tuji","to":"sfc","type":""},{"h":12,"m":50,"from":"tuji","to":"sfc","type":""},{"h":13,"m":5,"from":"tuji","to":"sfc","type":""},{"h":13,"m":20,"from":"tuji","to":"sfc","type":""},{"h":13,"m":35,"from":"tuji","to":"sfc","type":""},{"h":13,"m":50,"from":"tuji","to":"sfc","type":""},{"h":14,"m":5,"from":"tuji","to":"sfc","type":""},{"h":14,"m":20,"from":"tuji","to":"sfc","type":""},{"h":14,"m":35,"from":"tuji","to":"sfc","type":""},{"h":14,"m":50,"from":"tuji","to":"sfc","type":""},{"h":15,"m":5,"from":"tuji","to":"sfc","type":""},{"h":15,"m":20,"from":"tuji","to":"sfc","type":""},{"h":15,"m":35,"from":"tuji","to":"sfc","type":""},{"h":15,"m":50,"from":"tuji","to":"sfc","type":""},{"h":16,"m":5,"from":"tuji","to":"sfc","type":""},{"h":16,"m":20,"from":"tuji","to":"sfc","type":""},{"h":16,"m":35,"from":"tuji","to":"sfc","type":""},{"h":16,"m":50,"from":"tuji","to":"sfc","type":""},{"h":17,"m":5,"from":"tuji","to":"sfc","type":""},{"h":17,"m":35,"from":"tuji","to":"sfc","type":""},{"h":18,"m":5,"from":"tuji","to":"sfc","type":""},{"h":18,"m":35,"from":"tuji","to":"sfc","type":""},{"h":19,"m":35,"from":"tuji","to":"sfc","type":""},{"h":20,"m":35,"from":"tuji","to":"sfc","type":""}],[{"h":8,"m":25,"from":"tuji","to":"sfc","type":""},{"h":9,"m":35,"from":"tuji","to":"sfc","type":""},{"h":10,"m":35,"from":"tuji","to":"sfc","type":""},{"h":11,"m":35,"from":"tuji","to":"sfc","type":""},{"h":12,"m":35,"from":"tuji","to":"sfc","type":""},{"h":13,"m":35,"from":"tuji","to":"sfc","type":""},{"h":14,"m":35,"from":"tuji","to":"sfc","type":""},{"h":15,"m":35,"from":"tuji","to":"sfc","type":""},{"h":16,"m":35,"from":"tuji","to":"sfc","type":""},{"h":17,"m":35,"from":"tuji","to":"sfc","type":""},{"h":18,"m":35,"from":"tuji","to":"sfc","type":""}]],[[{"h":7,"m":0,"from":"sfc","to":"tuji","type":"r"},{"h":7,"m":40,"from":"sfc","to":"tuji","type":"r"},{"h":7,"m":54,"from":"sfc","to":"tuji","type":"r"},{"h":8,"m":10,"from":"sfc","to":"tuji","type":"r"},{"h":8,"m":24,"from":"sfc","to":"tuji","type":"r"},{"h":8,"m":33,"from":"sfc","to":"tuji","type":"r"},{"h":8,"m":40,"from":"sfc","to":"tuji","type":"r"},{"h":8,"m":55,"from":"sfc","to":"tuji","type":"r"},{"h":9,"m":10,"from":"sfc","to":"tuji","type":"r"},{"h":9,"m":26,"from":"sfc","to":"tuji","type":"r"},{"h":9,"m":41,"from":"sfc","to":"tuji","type":"r"},{"h":9,"m":56,"from":"sfc","to":"tuji","type":"r"},{"h":10,"m":13,"from":"sfc","to":"tuji","type":"r"},{"h":10,"m":28,"from":"sfc","to":"tuji","type":"r"},{"h":10,"m":43,"from":"sfc","to":"tuji","type":"r"},{"h":10,"m":58,"from":"sfc","to":"tuji","type":"r"},{"h":11,"m":13,"from":"sfc","to":"tuji","type":"r"},{"h":11,"m":28,"from":"sfc","to":"tuji","type":"r"},{"h":11,"m":43,"from":"sfc","to":"tuji","type":"r"},{"h":11,"m":58,"from":"sfc","to":"tuji","type":"r"},{"h":12,"m":13,"from":"sfc","to":"tuji","type":"r"},{"h":12,"m":28,"from":"sfc","to":"tuji","type":"r"},{"h":12,"m":43,"from":"sfc","to":"tuji","type":"r"},{"h":12,"m":58,"from":"sfc","to":"tuji","type":"r"},{"h":13,"m":13,"from":"sfc","to":"tuji","type":"r"},{"h":13,"m":28,"from":"sfc","to":"tuji","type":"r"},{"h":13,"m":43,"from":"sfc","to":"tuji","type":"r"},{"h":13,"m":58,"from":"sfc","to":"tuji","type":"r"},{"h":14,"m":13,"from":"sfc","to":"tuji","type":"r"},{"h":14,"m":28,"from":"sfc","to":"tuji","type":"r"},{"h":14,"m":43,"from":"sfc","to":"tuji","type":"r"},{"h":14,"m":58,"from":"sfc","to":"tuji","type":"r"},{"h":15,"m":15,"from":"sfc","to":"tuji","type":""},{"h":15,"m":25,"from":"sfc","to":"tuji","type":""},{"h":15,"m":30,"from":"sfc","to":"tuji","type":""},{"h":15,"m":40,"from":"sfc","to":"tuji","type":""},{"h":15,"m":45,"from":"sfc","to":"tuji","type":""},{"h":15,"m":55,"from":"sfc","to":"tuji","type":""},{"h":16,"m":0,"from":"sfc","to":"tuji","type":""},{"h":16,"m":12,"from":"sfc","to":"tuji","type":""},{"h":16,"m":27,"from":"sfc","to":"tuji","type":""},{"h":16,"m":42,"from":"sfc","to":"tuji","type":""},{"h":16,"m":52,"from":"sfc","to":"tuji","type":""},{"h":17,"m":2,"from":"sfc","to":"tuji","type":""},{"h":17,"m":12,"from":"sfc","to":"tuji","type":""},{"h":17,"m":22,"from":"sfc","to":"tuji","type":""},{"h":17,"m":32,"from":"sfc","to":"tuji","type":""},{"h":17,"m":42,"from":"sfc","to":"tuji","type":""},{"h":17,"m":52,"from":"sfc","to":"tuji","type":""},{"h":18,"m":2,"from":"sfc","to":"tuji","type":""},{"h":18,"m":12,"from":"sfc","to":"tuji","type":""},{"h":18,"m":22,"from":"sfc","to":"tuji","type":""},{"h":18,"m":42,"from":"sfc","to":"tuji","type":""},{"h":19,"m":2,"from":"sfc","to":"tuji","type":""},{"h":19,"m":22,"from":"sfc","to":"tuji","type":""},{"h":19,"m":42,"from":"sfc","to":"tuji","type":""},{"h":20,"m":10,"from":"sfc","to":"tuji","type":""},{"h":20,"m":40,"from":"sfc","to":"tuji","type":""},{"h":21,"m":10,"from":"sfc","to":"tuji","type":""},{"h":22,"m":10,"from":"sfc","to":"tuji","type":""}],[{"h":8,"m":10,"from":"sfc","to":"tuji","type":"r"},{"h":8,"m":29,"from":"sfc","to":"tuji","type":"r"},{"h":8,"m":42,"from":"sfc","to":"tuji","type":"r"},{"h":8,"m":57,"from":"sfc","to":"tuji","type":"r"},{"h":9,"m":12,"from":"sfc","to":"tuji","type":"r"},{"h":9,"m":29,"from":"sfc","to":"tuji","type":"r"},{"h":9,"m":44,"from":"sfc","to":"tuji","type":"r"},{"h":9,"m":59,"from":"sfc","to":"tuji","type":"r"},{"h":10,"m":14,"from":"sfc","to":"tuji","type":"r"},{"h":10,"m":29,"from":"sfc","to":"tuji","type":"r"},{"h":10,"m":44,"from":"sfc","to":"tuji","type":"r"},{"h":10,"m":59,"from":"sfc","to":"tuji","type":"r"},{"h":11,"m":14,"from":"sfc","to":"tuji","type":"r"},{"h":11,"m":29,"from":"sfc","to":"tuji","type":"r"},{"h":11,"m":44,"from":"sfc","to":"tuji","type":"r"},{"h":11,"m":59,"from":"sfc","to":"tuji","type":"r"},{"h":12,"m":14,"from":"sfc","to":"tuji","type":"r"},{"h":12,"m":29,"from":"sfc","to":"tuji","type":"r"},{"h":12,"m":45,"from":"sfc","to":"tuji","type":""},{"h":12,"m":58,"from":"sfc","to":"tuji","type":""},{"h":13,"m":13,"from":"sfc","to":"tuji","type":""},{"h":13,"m":28,"from":"sfc","to":"tuji","type":""},{"h":13,"m":43,"from":"sfc","to":"tuji","type":""},{"h":13,"m":58,"from":"sfc","to":"tuji","type":""},{"h":14,"m":13,"from":"sfc","to":"tuji","type":""},{"h":14,"m":28,"from":"sfc","to":"tuji","type":""},{"h":14,"m":43,"from":"sfc","to":"tuji","type":""},{"h":14,"m":58,"from":"sfc","to":"tuji","type":""},{"h":15,"m":13,"from":"sfc","to":"tuji","type":""},{"h":15,"m":28,"from":"sfc","to":"tuji","type":""},{"h":15,"m":43,"from":"sfc","to":"tuji","type":""},{"h":15,"m":58,"from":"sfc","to":"tuji","type":""},{"h":16,"m":13,"from":"sfc","to":"tuji","type":""},{"h":16,"m":28,"from":"sfc","to":"tuji","type":""},{"h":16,"m":43,"from":"sfc","to":"tuji","type":""},{"h":16,"m":58,"from":"sfc","to":"tuji","type":""},{"h":17,"m":13,"from":"sfc","to":"tuji","type":""},{"h":17,"m":28,"from":"sfc","to":"tuji","type":""},{"h":17,"m":43,"from":"sfc","to":"tuji","type":""},{"h":17,"m":58,"from":"sfc","to":"tuji","type":""},{"h":18,"m":13,"from":"sfc","to":"tuji","type":""},{"h":18,"m":28,"from":"sfc","to":"tuji","type":""},{"h":18,"m":43,"from":"sfc","to":"tuji","type":""},{"h":19,"m":15,"from":"sfc","to":"tuji","type":""},{"h":20,"m":15,"from":"sfc","to":"tuji","type":""},{"h":21,"m":15,"from":"sfc","to":"tuji","type":""}],[{"h":9,"m":12,"from":"sfc","to":"tuji","type":"r"},{"h":10,"m":14,"from":"sfc","to":"tuji","type":"r"},{"h":11,"m":14,"from":"sfc","to":"tuji","type":"r"},{"h":12,"m":14,"from":"sfc","to":"tuji","type":"r"},{"h":13,"m":14,"from":"sfc","to":"tuji","type":"r"},{"h":14,"m":14,"from":"sfc","to":"tuji","type":"r"},{"h":15,"m":14,"from":"sfc","to":"tuji","type":"r"},{"h":16,"m":14,"from":"sfc","to":"tuji","type":"r"},{"h":17,"m":14,"from":"sfc","to":"tuji","type":"r"},{"h":18,"m":14,"from":"sfc","to":"tuji","type":"r"},{"h":19,"m":14,"from":"sfc","to":"tuji","type":"r"}]],"2012.12.16"]);
data/spec/bus_spec.rb ADDED
@@ -0,0 +1,32 @@
1
+ #coding:utf-8
2
+ require File.dirname(__FILE__) + '/spec_helper.rb'
3
+
4
+ describe SFCBus::Bus do
5
+ before(:all) do
6
+ @bus = SFCBus::Bus.new(
7
+ :from => :sfc,
8
+ :to => :tsujido,
9
+ :day_type => :saturday,
10
+ :hour => 7,
11
+ :min => 30
12
+ )
13
+ end
14
+
15
+ describe '#inspect_time' do
16
+ it 'returns time string' do
17
+ @bus.inspect_time.should eq '07:30'
18
+ end
19
+ end
20
+
21
+ describe '#to_jp' do
22
+ it 'returns station name in japanese' do
23
+ @bus.to_jp.should eq '辻堂駅'
24
+ end
25
+ end
26
+
27
+ describe '#day_type_jp' do
28
+ it 'returns day type in japanese' do
29
+ @bus.day_type_jp.should eq '土曜'
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,52 @@
1
+ #coding:utf-8
2
+ require File.dirname(__FILE__) + '/spec_helper.rb'
3
+
4
+ describe SFCBus::Client do
5
+ before(:all) do
6
+ @sfcbus = SFCBus.new
7
+ open(File.dirname(__FILE__) + '/api.jsonp') do |f|
8
+ timetable = SFCBus::Parser.parse(f.read)[:timetable]
9
+ @sfcbus.stub!(:timetable).and_return(timetable)
10
+ end
11
+ end
12
+
13
+
14
+ describe '#select' do
15
+ it 'can select bus list from timetable' do
16
+ bus = @sfcbus.select(
17
+ :day_type => :saturday,
18
+ :from => :sfc,
19
+ :to => :tsujido,
20
+ :is_rotary => true
21
+ ).first
22
+ bus.day_type.should be :saturday
23
+ bus.from.should be :sfc
24
+ bus.to.should be :tsujido
25
+ bus.rotary?.should be_true
26
+ end
27
+ end
28
+
29
+
30
+ describe '#next_list' do
31
+ before do
32
+ SFCBus::Utils.stub!(:today_day_type).and_return(:weekday)
33
+ SFCBus::Utils.stub!(:at_sfc?).and_return(false)
34
+ Time.stub!(:now).and_return(Time.new(2013, 1, 1, 17, 30))
35
+ @list = @sfcbus.next_list
36
+ end
37
+
38
+ it 'can limit list' do
39
+ @list.size.should be 5
40
+ end
41
+
42
+ it 'uses default route if option is not given' do
43
+ @list.first.from.should be :shonandai
44
+ @list.first.to.should be :sfc
45
+ end
46
+
47
+ it 'can return next bus list' do
48
+ @list.first.hour.should be 17
49
+ @list.first.min.should be 33
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,53 @@
1
+ #coding:utf-8
2
+ require File.dirname(__FILE__) + '/spec_helper.rb'
3
+
4
+ describe SFCBus::Parser do
5
+ describe '.parse_day_type' do
6
+ it 'can parse day type number' do
7
+ SFCBus::Parser.parse_day_type(2).should be :holiday
8
+ end
9
+ end
10
+
11
+ describe '.parse_location' do
12
+ it 'can parse location string' do
13
+ SFCBus::Parser.parse_location('tuji').should be :tsujido
14
+ end
15
+ end
16
+
17
+ describe '.parse_bus_type' do
18
+ it 'can parse bus type string' do
19
+ SFCBus::Parser.parse_bus_type('rt').should be :twinliner
20
+ end
21
+ end
22
+
23
+ describe '.parse_is_rotary' do
24
+ it 'can parse rotary string' do
25
+ SFCBus::Parser.parse_is_rotary('rt').should be_true
26
+ end
27
+ end
28
+
29
+ describe '.parse_updated_at' do
30
+ it 'can parse updated_at' do
31
+ SFCBus::Parser.parse_updated_at('2012.12.16').should eq Date.new(2012, 12, 16)
32
+ end
33
+ end
34
+
35
+ describe '.parse' do
36
+ before(:all) do
37
+ open(File.dirname(__FILE__) + '/api.jsonp') do |f|
38
+ @body = f.read
39
+ end
40
+ end
41
+
42
+ it 'can parse timetable' do
43
+ bus = SFCBus::Parser.parse(@body)[:timetable].first
44
+ bus.day_type.should be :weekday
45
+ bus.from.should be :shonandai
46
+ bus.to.should be :sfc
47
+ bus.hour.should be 7
48
+ bus.min.should be 10
49
+ bus.type.should be :normal
50
+ bus.rotary?.should be_false
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,4 @@
1
+ #coding:utf-8
2
+ $:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
3
+
4
+ require 'sfcbus'
@@ -0,0 +1,20 @@
1
+ #coding:utf-8
2
+ require File.dirname(__FILE__) + '/spec_helper.rb'
3
+ require 'date'
4
+
5
+ describe SFCBus::Utils do
6
+ describe '.today_day_type' do
7
+ it 'can return day type of today' do
8
+ Date.stub!(:today).and_return(Date.new(2012, 7, 16))
9
+ SFCBus::Utils.today_day_type.should be SFCBus::DayTypes::Holiday
10
+ end
11
+ end
12
+
13
+ describe '.at_sfc?' do
14
+ it 'can find location by ip address' do
15
+ ip_address = '203.178.142.130'
16
+ Socket.stub!(:getaddrinfo).and_return([['AF_INET', 80, ip_address]])
17
+ SFCBus::Utils.at_sfc?.should be_true
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,14 @@
1
+ #coding:utf-8
2
+ require File.dirname(__FILE__) + '/spec_helper.rb'
3
+
4
+ describe SFCBus::Validator do
5
+ describe '.validate' do
6
+ it 'can validate options' do
7
+ opt = {
8
+ :from => :sfc,
9
+ :to => :tujido
10
+ }
11
+ lambda{ SFCBus::Validator.validate(opt) }.should raise_error(ArgumentError)
12
+ end
13
+ end
14
+ end
metadata ADDED
@@ -0,0 +1,124 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sfcbus
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - mako2x
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-03-08 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: holidays
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 1.0.5
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 1.0.5
30
+ - !ruby/object:Gem::Dependency
31
+ name: args_parser
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: 0.1.4
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: 0.1.4
46
+ - !ruby/object:Gem::Dependency
47
+ name: rspec
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ description: Ruby gem that provides bus information at Keio Univ SFC.
63
+ email:
64
+ - arekara3nen@gmail.com
65
+ executables:
66
+ - sfcbus
67
+ extensions: []
68
+ extra_rdoc_files: []
69
+ files:
70
+ - .gitignore
71
+ - Gemfile
72
+ - LICENSE.txt
73
+ - README.md
74
+ - Rakefile
75
+ - bin/sfcbus
76
+ - lib/sfcbus.rb
77
+ - lib/sfcbus/bus.rb
78
+ - lib/sfcbus/client.rb
79
+ - lib/sfcbus/constants.rb
80
+ - lib/sfcbus/parser.rb
81
+ - lib/sfcbus/utils.rb
82
+ - lib/sfcbus/validator.rb
83
+ - lib/sfcbus/version.rb
84
+ - sfcbus.gemspec
85
+ - spec/api.jsonp
86
+ - spec/bus_spec.rb
87
+ - spec/client_spec.rb
88
+ - spec/parser_spec.rb
89
+ - spec/spec_helper.rb
90
+ - spec/utils_spec.rb
91
+ - spec/validator_spec.rb
92
+ homepage: https://github.com/mako2x/sfcbus
93
+ licenses: []
94
+ post_install_message:
95
+ rdoc_options: []
96
+ require_paths:
97
+ - lib
98
+ required_ruby_version: !ruby/object:Gem::Requirement
99
+ none: false
100
+ requirements:
101
+ - - ! '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ required_rubygems_version: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ requirements: []
111
+ rubyforge_project:
112
+ rubygems_version: 1.8.23
113
+ signing_key:
114
+ specification_version: 3
115
+ summary: Provides bus information at SFC.
116
+ test_files:
117
+ - spec/api.jsonp
118
+ - spec/bus_spec.rb
119
+ - spec/client_spec.rb
120
+ - spec/parser_spec.rb
121
+ - spec/spec_helper.rb
122
+ - spec/utils_spec.rb
123
+ - spec/validator_spec.rb
124
+ has_rdoc: