ekispert 0.0.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.
Files changed (55) hide show
  1. checksums.yaml +7 -0
  2. data/.circleci/config.yml +48 -0
  3. data/.gitignore +14 -0
  4. data/.rspec +3 -0
  5. data/.rubocop.yml +110 -0
  6. data/.travis.yml +5 -0
  7. data/CODE_OF_CONDUCT.md +74 -0
  8. data/Gemfile +6 -0
  9. data/LICENSE.txt +21 -0
  10. data/README.md +118 -0
  11. data/Rakefile +6 -0
  12. data/bin/console +14 -0
  13. data/bin/setup +8 -0
  14. data/ekispert-sdk-ruby.gemspec +31 -0
  15. data/example/point_station.rb +20 -0
  16. data/example/search_course.rb +116 -0
  17. data/lib/ekispert.rb +43 -0
  18. data/lib/ekispert/client.rb +58 -0
  19. data/lib/ekispert/config.rb +30 -0
  20. data/lib/ekispert/course.rb +124 -0
  21. data/lib/ekispert/course/pass_status.rb +34 -0
  22. data/lib/ekispert/course/price.rb +71 -0
  23. data/lib/ekispert/course/route.rb +33 -0
  24. data/lib/ekispert/course/route/line.rb +86 -0
  25. data/lib/ekispert/course/route/line/arrival_state.rb +25 -0
  26. data/lib/ekispert/course/route/line/arrival_state/gate.rb +22 -0
  27. data/lib/ekispert/course/route/line/corporation.rb +22 -0
  28. data/lib/ekispert/course/route/line/departure_state.rb +25 -0
  29. data/lib/ekispert/course/route/line/departure_state/gate.rb +22 -0
  30. data/lib/ekispert/course/route/line/line_symbol.rb +22 -0
  31. data/lib/ekispert/course/route/line/stop.rb +30 -0
  32. data/lib/ekispert/course/route/line/stop/arrival_state.rb +28 -0
  33. data/lib/ekispert/course/route/line/stop/departure_state.rb +28 -0
  34. data/lib/ekispert/course/route/line/stop/point.rb +28 -0
  35. data/lib/ekispert/course/route/line/stop/point/prefecture.rb +26 -0
  36. data/lib/ekispert/course/route/line/stop/point/station.rb +30 -0
  37. data/lib/ekispert/course/route/point.rb +49 -0
  38. data/lib/ekispert/course/route/point/prefecture.rb +22 -0
  39. data/lib/ekispert/course/route/point/station.rb +34 -0
  40. data/lib/ekispert/data_version.rb +35 -0
  41. data/lib/ekispert/ekispert_base.rb +69 -0
  42. data/lib/ekispert/error.rb +29 -0
  43. data/lib/ekispert/information.rb +58 -0
  44. data/lib/ekispert/information/corporation.rb +20 -0
  45. data/lib/ekispert/information/exit.rb +24 -0
  46. data/lib/ekispert/information/line.rb +35 -0
  47. data/lib/ekispert/information/welfare_facilities.rb +24 -0
  48. data/lib/ekispert/point.rb +41 -0
  49. data/lib/ekispert/point/prefecture.rb +18 -0
  50. data/lib/ekispert/point/station.rb +65 -0
  51. data/lib/ekispert/point/station/gate_group.rb +14 -0
  52. data/lib/ekispert/point/station/gate_group/gate.rb +28 -0
  53. data/lib/ekispert/util.rb +11 -0
  54. data/lib/ekispert/version.rb +3 -0
  55. metadata +213 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 90e2b356fb49b99771c575a6ff68a3e29be3c2a1f97ea677f2500011187b40fa
4
+ data.tar.gz: ad423e8e09b22e8d505ec6fa53759abe5fa49e86dbf9bbf8ede1c8f12011160d
5
+ SHA512:
6
+ metadata.gz: df16b726c8f5c9c00cb9b2e2168faf6d490a54e275ce89cc8ade0954a839125b501cbe1aeef8e539ccf82c105a1c1105f5d7c57e3a41be68d880db30268c70bf
7
+ data.tar.gz: 7af6cb4ce6325a4bd93e5b3a65e62b5832fc112b85c0e0d0b3efb68ed9b7c70767b0a83f3f1e200d9a314fe760baf566690c5e5b941c966e35b4a223b0876409
@@ -0,0 +1,48 @@
1
+ # Ruby CircleCI 2.0 configuration file
2
+ #
3
+ # Check https://circleci.com/docs/2.0/language-ruby/ for more details
4
+ #
5
+ version: 2
6
+ jobs:
7
+ build:
8
+ docker:
9
+ # specify the version you desire here
10
+ - image: circleci/ruby:2.5.1-node-browsers
11
+
12
+ # Specify service dependencies here if necessary
13
+ # CircleCI maintains a library of pre-built images
14
+ # documented at https://circleci.com/docs/2.0/circleci-images/
15
+ # - image: circleci/postgres:9.4
16
+
17
+ working_directory: ~/repo
18
+
19
+ steps:
20
+ - checkout
21
+
22
+ # Download and cache dependencies
23
+ - restore_cache:
24
+ keys:
25
+ - v1-dependencies-{{ checksum "ekispert-sdk-ruby.gemspec" }}
26
+ # fallback to using the latest cache if no exact match is found
27
+ - v1-dependencies-
28
+
29
+ - run:
30
+ name: install dependencies
31
+ command: |
32
+ bundle install --jobs=4 --retry=3 --path vendor/bundle
33
+
34
+ - save_cache:
35
+ paths:
36
+ - ./vendor/bundle
37
+ key: v1-dependencies-{{ checksum "ekispert-sdk-ruby.gemspec" }}
38
+
39
+ - run:
40
+ name: run RuboCop
41
+ command: |
42
+ bundle exec rubocop
43
+
44
+ # run tests!
45
+ - run:
46
+ name: run tests
47
+ command: |
48
+ bundle exec rspec
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ Gemfile.lock
11
+ .ruby-version
12
+
13
+ # rspec failure tracking
14
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,110 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.3
3
+ # Display warning with reference URL
4
+ DisplayStyleGuide: true
5
+ StyleGuideBaseURL: https://github.com/fortissimo1997/ruby-style-guide/blob/japanese/README.ja.md
6
+ Exclude:
7
+ - "vendor/**/*"
8
+ - "example/**/*"
9
+
10
+ # Checks the indentation of here document closings.
11
+ Layout/ClosingHeredocIndentation:
12
+ Enabled: true
13
+
14
+ # Use only ascii symbols in comments.
15
+ AsciiComments:
16
+ Enabled: false
17
+
18
+ # Unnecessary blank line at the beginning of the source.
19
+ Layout/LeadingBlankLines:
20
+ Enabled: true
21
+
22
+ # Use 'set_' and 'get_' prefix
23
+ AccessorMethodName:
24
+ Enabled: false
25
+
26
+ # Surrounding space missing in default value assignment.
27
+ Layout/SpaceAroundEqualsInParameterDefault:
28
+ EnforcedStyle: no_space
29
+
30
+ # private does not make singleton methods private. Use private_class_method or private inside a class << self block instead.
31
+ Lint/IneffectiveAccessModifier:
32
+ Enabled: false
33
+
34
+ # Useless private access modifier.
35
+ Lint/UselessAccessModifier:
36
+ Enabled: false
37
+
38
+ # Offense count: 12
39
+ # Configuration parameters: CountComments, ExcludedMethods.
40
+ Metrics/BlockLength:
41
+ Max: 108
42
+ Exclude:
43
+ - 'spec/**/*'
44
+
45
+ Metrics/CyclomaticComplexity:
46
+ Max: 10
47
+
48
+ Metrics/LineLength:
49
+ Max: 120
50
+ Exclude:
51
+ - 'spec/**/*'
52
+
53
+ # Method has too many lines.
54
+ Metrics/MethodLength:
55
+ Enabled: false
56
+
57
+ # Use meaningful heredoc delimiters.
58
+ Naming/HeredocDelimiterNaming:
59
+ Enabled: false
60
+
61
+ # Do not place comments on the same line as the class keyword.
62
+ Style/CommentedKeyword:
63
+ Enabled: false
64
+
65
+ # Web API respons includes "<Datetime>" elements.
66
+ Style/DateTime:
67
+ Enabled: false
68
+
69
+ # Missing top-level class documentation comment.
70
+ Style/Documentation:
71
+ Enabled: false
72
+
73
+ # Missing magic comment # frozen_string_literal: true.
74
+ Style/FrozenStringLiteralComment:
75
+ Enabled: false
76
+
77
+ # Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
78
+ # https://github.com/fortissimo1997/ruby-style-guide/blob/japanese/README.md#if-as-a-modifier
79
+ Style/IfUnlessModifier:
80
+ Enabled: false
81
+
82
+ # Freeze mutable objects assigned to constants.
83
+ Style/MutableConstant:
84
+ Enabled: false
85
+
86
+ # Use underscores(_) as decimal mark and separate every 3 digits with them.
87
+ Style/NumericLiterals:
88
+ MinDigits: 8
89
+
90
+ # Use element.attributes.size.positive? instead of element.attributes.size > 0.
91
+ # https://github.com/fortissimo1997/ruby-style-guide/blob/japanese/README.md#predicate-methods
92
+ Style/NumericPredicate:
93
+ Enabled: false
94
+
95
+ # Redundant self detected.
96
+ # https://github.com/fortissimo1997/ruby-style-guide/blob/japanese/README.md#no-self-unless-required
97
+ Style/RedundantSelf:
98
+ Enabled: false
99
+
100
+ # Use %r around regular expression.
101
+ # SupportedStyles: slashes, percent_r, mixed
102
+ Style/RegexpLiteral:
103
+ Enabled: false
104
+
105
+ Style/RescueModifier:
106
+ Enabled: false
107
+
108
+ # Use !empty? instead of size > 0.
109
+ Style/ZeroLengthPredicate:
110
+ Enabled: false
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.5.0
5
+ before_install: gem install bundler -v 1.16.1
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at 3654953+pupupopo88@users.noreply.github.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in ekispert-sdk-ruby.gemspec
6
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) Val Laboratory Corporation
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,118 @@
1
+ # ekispert
2
+
3
+ A module for using the EkispertWebService API.
4
+
5
+ This SDK development is moving at a very slow pace and we haven't reached version 1.0 yet.
6
+ There are often backward-incompatible changes between minor releases.
7
+ Please use after understanding the it enough.
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ ```ruby
14
+ gem 'ekispert'
15
+ ```
16
+
17
+ And then execute:
18
+
19
+ $ bundle
20
+
21
+ Or install it yourself as:
22
+
23
+ $ gem install ekispert
24
+
25
+ ## Settings
26
+
27
+ ```shell
28
+ $ echo export EKISPERT_API_KEY=api_key >> ~/.bash_profile
29
+
30
+ # If you need to access Web through proxy
31
+ $ echo export HTTP_PROXY="http://www.example.com:8080" >> ~/.bash_profile
32
+
33
+ $ source ~/.bash_profile
34
+ ```
35
+
36
+ ## Usage
37
+
38
+ Don't forget to require ekispert.
39
+ ```ruby
40
+ require 'ekispert'
41
+ ```
42
+
43
+ ### Search Station
44
+
45
+ The base of this module is its `/v1/xml/station` API.
46
+ [-> Ekispert web service reference.](http://docs.ekispert.com/v1/api/station.html)
47
+
48
+ ```ruby
49
+ station_list = Ekispert::Point::Station.get(code: '22828')
50
+
51
+ p station_list[0].name
52
+ #=> "東京"
53
+
54
+ station_list[0].prefecture.name
55
+ #=> "東京都"
56
+
57
+ jr_station_list = Ekispert::Point::Station.get(corporationName: 'JR', limit: 2)
58
+
59
+ p jr_station_list[0].name
60
+ #=> "相生(兵庫県)"
61
+
62
+ p jr_station_list[1].name
63
+ #=> "相賀"
64
+ ```
65
+
66
+ ### Search Course
67
+
68
+ The base of this module is its `/v1/xml/search/course/extreme` API.
69
+ [-> Ekispert web service reference.](http://docs.ekispert.com/v1/api/search/course/extreme.html)
70
+
71
+ ```ruby
72
+ course_list = Ekispert::Course.get(viaList: '22828:22741', answerCount: 1)
73
+
74
+ course_list.each_with_index do |course, i|
75
+ price_list = course.price_list
76
+ route = course.route
77
+ point_list = route.point_list
78
+ line_list = route.line_list
79
+
80
+ line_list.each_with_index do |line, j|
81
+ puts "#{line.departure_state.datetime.strftime('%H:%M')} #{point_list[j].station.name}"
82
+ if line.line_symbol
83
+ puts " | [#{line.line_symbol.name}] #{line.name}"
84
+ else
85
+ puts " | #{line.name}"
86
+ end
87
+ end
88
+ puts "#{line_list[-1].arrival_state.datetime.strftime('%H:%M')} #{point_list[-1].station.name}"
89
+ end
90
+
91
+ # 12:00 東京
92
+ # | [JC] JR中央線中央特快・高尾行
93
+ # 12:16 新宿
94
+ ```
95
+
96
+ And more...
97
+
98
+ If you want to see more sample code, see the `/example` directory.
99
+
100
+ ## Supported Ruby Versions
101
+ This library supports and is tested against the following Ruby inplementations:
102
+ - Ruby 2.5
103
+ - Ruby 2.6
104
+
105
+ ## Document
106
+ [Ekispert web service reference](http://docs.ekispert.com/v1/api/)
107
+
108
+ ## Contributing
109
+
110
+ Bug reports and pull requests are welcome on GitHub at https://github.com/EkispertWebService/ekispert-sdk-ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
111
+
112
+ ## License
113
+
114
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
115
+
116
+ ## Code of Conduct
117
+
118
+ Everyone interacting in the ekispert project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/EkispertWebService/ekispert-sdk-ruby/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'ekispert'
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require 'irb'
14
+ IRB.start(__FILE__)