jp_ski 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +14 -0
- data/.rspec +2 -0
- data/.travis.yml +7 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +35 -0
- data/Rakefile +7 -0
- data/jp_ski.gemspec +24 -0
- data/lib/jp_ski/mapping.rb +13 -0
- data/lib/jp_ski/ski.rb +20 -0
- data/lib/jp_ski/version.rb +3 -0
- data/lib/jp_ski.rb +3 -0
- data/spec/jp_ski_spec.rb +7 -0
- data/spec/mapping_spec.rb +9 -0
- data/spec/ski_spec.rb +25 -0
- data/spec/spec_helper.rb +2 -0
- data/yml/ski.yml +2252 -0
- metadata +121 -0
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Toshimasa Oguni
|
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,35 @@
|
|
1
|
+
# JpSki
|
2
|
+
|
3
|
+
[![Build Status](https://travis-ci.org/tsmsogn/jp_ski.svg?branch=master)](https://travis-ci.org/tsmsogn/jp_ski)
|
4
|
+
|
5
|
+
Japan ski areas
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'jp_ski'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install jp_ski
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
Get all ski areas
|
26
|
+
|
27
|
+
JpSki::Ski.all
|
28
|
+
|
29
|
+
## Contributing
|
30
|
+
|
31
|
+
1. Fork it ( https://github.com/[my-github-username]/jp_ski/fork )
|
32
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
33
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
34
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
35
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/jp_ski.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'jp_ski/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "jp_ski"
|
8
|
+
spec.version = JpSki::VERSION
|
9
|
+
spec.authors = ["Toshimasa Oguni"]
|
10
|
+
spec.email = ["tsmsogn@gmail.com"]
|
11
|
+
spec.summary = %q{Japan ski area.}
|
12
|
+
spec.description = %q{Japan ski area.}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
+
spec.add_development_dependency "rspec"
|
24
|
+
end
|
data/lib/jp_ski/ski.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
module JpSki
|
2
|
+
# Ski
|
3
|
+
class Ski
|
4
|
+
attr_accessor :name, :pref, :area
|
5
|
+
|
6
|
+
def self.build(name, pref, area)
|
7
|
+
ski = new
|
8
|
+
ski.name = name
|
9
|
+
ski.pref = pref
|
10
|
+
ski.area = area
|
11
|
+
ski
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.all
|
15
|
+
Mapping.data.map do |ski|
|
16
|
+
build(ski[:name], ski[:pref], ski[:area])
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/jp_ski.rb
ADDED
data/spec/jp_ski_spec.rb
ADDED
data/spec/ski_spec.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe JpSki::Ski do
|
6
|
+
let(:ski) { JpSki::Ski.build('foo', 'bar', 'baz') }
|
7
|
+
subject { ski }
|
8
|
+
|
9
|
+
it { is_expected.to respond_to(:name) }
|
10
|
+
it { is_expected.to respond_to(:pref) }
|
11
|
+
it { is_expected.to respond_to(:area) }
|
12
|
+
it { expect(ski.name).to eq 'foo' }
|
13
|
+
it { expect(ski.pref).to eq 'bar' }
|
14
|
+
it { expect(ski.area).to eq 'baz' }
|
15
|
+
|
16
|
+
describe '.all' do
|
17
|
+
let(:skis) { JpSki::Ski.all }
|
18
|
+
|
19
|
+
it { expect(skis.first).to be_an_instance_of(JpSki::Ski) }
|
20
|
+
it { expect(skis.first.name).to eq '石狩平原スキー場' }
|
21
|
+
it { expect(skis.first.pref).to eq '北海道' }
|
22
|
+
it { expect(skis.first.area).to eq '北海道' }
|
23
|
+
it { expect(skis.count).to eq 563 }
|
24
|
+
end
|
25
|
+
end
|
data/spec/spec_helper.rb
ADDED