butter_sand 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,17 @@
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
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format documentation
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in butter_sand.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Shun Sugai
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,53 @@
1
+ # ButterSand
2
+
3
+ 六花亭さんの催事情報ページの内容を取得するためのRubyラッパーです
4
+
5
+ ## インストール方法
6
+
7
+ Gemfileに次の一行を追加してください:
8
+
9
+ gem 'butter_sand'
10
+
11
+ 次に以下のコマンドを実行してください:
12
+
13
+ $ bundle
14
+
15
+ もしくはbundlerを使わずに以下のコマンドでインストールしてもOKです:
16
+
17
+ $ gem install butter_sand
18
+
19
+ ## 使いかた
20
+
21
+ ### 催事情報を取得する
22
+ ```ruby
23
+ require 'butter_sand'
24
+
25
+ # 全件取得
26
+ ButterSand.all.each do |event|
27
+ puts event.shop #=> 店名
28
+ puts event.prefecture #=> 県
29
+ puts event.phone #=> 電話番号
30
+ puts event.starts #=> 開始日
31
+ puts event.ends #=> 終了日
32
+ end
33
+
34
+ # 今日から始まる催事情報
35
+ ButterSand.starts_today
36
+
37
+ # 今日で終わる催事情報
38
+ ButterSand.ends_today
39
+
40
+ # 県名で調べる
41
+ ButterSand.find_by_prefecture('東京')
42
+ ```
43
+
44
+ ### TODO
45
+ JSON返すやつ作る
46
+
47
+ ## Contributing
48
+
49
+ 1. Fork it
50
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
51
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
52
+ 4. Push to the branch (`git push origin my-new-feature`)
53
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
3
+ require "rspec/core/rake_task"
4
+
5
+ RSpec::Core::RakeTask.new('spec')
6
+ task :default => :spec
@@ -0,0 +1,29 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'butter_sand/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "butter_sand"
8
+ spec.version = ButterSand::VERSION
9
+ spec.authors = ["Shun Sugai"]
10
+ spec.email = ["sugaishun@gmail.com"]
11
+ spec.description = "Ruby wrapper for marusei butter sand website"
12
+ spec.summary = "Ruby wrapper for marusei butter sand website"
13
+ spec.homepage = "https://github.com/shunsugai/butter_sand"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
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_dependency 'faraday', '~> 0.8'
22
+ spec.add_dependency 'faraday_middleware'
23
+ spec.add_dependency 'nokogiri', '~> 1.5.6'
24
+ spec.add_development_dependency "bundler", "~> 1.3"
25
+ spec.add_development_dependency "rake"
26
+ spec.add_development_dependency 'rspec'
27
+ spec.add_development_dependency 'webmock'
28
+ spec.add_development_dependency 'simplecov'
29
+ end
@@ -0,0 +1,36 @@
1
+ require 'butter_sand/event'
2
+ require 'butter_sand/parser'
3
+ require 'date'
4
+
5
+ module ButterSand
6
+ module API
7
+ module Events
8
+ PATH_SAIJI = '/contents/shop/saiji/'
9
+
10
+ # @return [Array<ButterSand::Event>]
11
+ def all
12
+ ButterSand::Parser.to_array(get(PATH_SAIJI)).map {|event| ButterSand::Event.new(event)}
13
+ end
14
+
15
+ def on_sale
16
+ all.select {|event| (event.starts..event.ends) === Date.today}
17
+ end
18
+
19
+ # @return [Array<ButterSand::Event>]
20
+ def starts_today
21
+ all.select {|event| event.starts == Date.today}
22
+ end
23
+
24
+ # @return [Array<ButterSand::Event>]
25
+ def ends_today
26
+ all.select {|event| event.ends == Date.today}
27
+ end
28
+
29
+ # @return [Array<ButterSand::Event>]
30
+ def find_by_prefecture(name)
31
+ raise ArgumentError , 'Illegal argument' unless name.kind_of? String
32
+ all.select {|event| event.prefecture == name}
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,32 @@
1
+ require 'butter_sand'
2
+ require 'butter_sand/api/events'
3
+ require 'butter_sand/error'
4
+ require 'faraday'
5
+ require 'faraday_middleware'
6
+ require 'faraday/response/raise_butter_sand_error'
7
+
8
+ module ButterSand
9
+ class Client
10
+ include ButterSand::API::Events
11
+
12
+ ROOT_URL = 'https://www.rokkatei-eshop.com/'
13
+
14
+ def get(path)
15
+ request(:get, path)
16
+ end
17
+
18
+ private
19
+
20
+ def request(method, path)
21
+ response = connection.send(method.to_sym, path)
22
+ response.body
23
+ end
24
+
25
+ def connection
26
+ @connection ||= Faraday.new ROOT_URL, ssl: {verify: false} do |conn|
27
+ conn.use Faraday::Response::RaiseButterSandError
28
+ conn.use Faraday::Adapter::NetHttp
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,10 @@
1
+ module ButterSand
2
+ class Error < StandardError; end
3
+ class BadRequest < Error; end # 400
4
+ class Unauthorized < Error; end # 401
5
+ class Forbidden < Error; end # 403
6
+ class NotFound < Error; end # 404
7
+ class NotAcceptable < Error; end # 406
8
+ class InternalServerError < Error; end # 500
9
+ class ServiceUnavailable < Error; end # 503
10
+ end
@@ -0,0 +1,15 @@
1
+ require 'butter_sand'
2
+
3
+ module ButterSand
4
+ class Event
5
+ attr_reader :shop, :prefecture, :phone, :starts, :ends
6
+
7
+ def initialize(options={})
8
+ @shop = options[:shop]
9
+ @prefecture = options[:prefecture]
10
+ @phone = options[:phone]
11
+ @starts = options[:starts]
12
+ @ends = options[:ends]
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,50 @@
1
+ require 'butter_sand'
2
+ require 'core_ext/string'
3
+ require 'core_ext/array'
4
+ require 'nokogiri'
5
+
6
+ module ButterSand
7
+ class Parser
8
+ class << self
9
+ # @return [Array<Hash>]
10
+ def to_array(body)
11
+ shops = []
12
+ raw_events(Nokogiri::HTML(body)).each do |elem|
13
+ str_elems = elem.split(/\n\s+/)
14
+
15
+ next if str_elems.length < 4
16
+ next unless str_elems[3].strip.phone_number?
17
+ begin
18
+ dates = str_elems[0].date_to_ary
19
+ rescue ArgumentError => e
20
+ print e.message, "\n"
21
+ next
22
+ end
23
+
24
+ shops << {
25
+ shop: str_elems[2],
26
+ prefecture: str_elems[1],
27
+ phone: str_elems[3].strip,
28
+ starts: dates[0],
29
+ ends: dates[1]
30
+ }
31
+ end
32
+ shops
33
+ end
34
+
35
+ private
36
+
37
+ # @return [Array<String>]
38
+ def raw_events(body)
39
+ each_state = state_names.map {|state| body.css(state).map(&:text).remove_at(0)}
40
+ each_state.flatten(lv = 1)
41
+ end
42
+
43
+ # @return [Array<String>]
44
+ def state_names
45
+ states = %w(tohoku kanto tokai kansai chugoku kyushu)
46
+ states.map {|state| "table.#{state} tr"}
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,3 @@
1
+ module ButterSand
2
+ VERSION = "0.0.2"
3
+ end
@@ -0,0 +1,15 @@
1
+ require "butter_sand/client"
2
+ require "butter_sand/version"
3
+
4
+ module ButterSand
5
+ class << self
6
+ def new
7
+ ButterSand::Client.new
8
+ end
9
+
10
+ def method_missing(method, *args, &block)
11
+ return super unless new.respond_to?(method)
12
+ new.send(method, *args, &block)
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,6 @@
1
+ class Array
2
+ def remove_at(n)
3
+ delete_at(n)
4
+ self
5
+ end
6
+ end
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ require 'date'
3
+
4
+ class String
5
+ # @return [Date]
6
+ def parse_date
7
+ self.scan(/(\d+)(月)(\d+)(日)/)
8
+ month = $1.to_i
9
+ day = $3.to_i
10
+ today = Date.today
11
+ year = today.month >= 10 && month == 1 ? today.year + 1 : today.year
12
+ Date.parse("#{year}.#{month}.#{day}")
13
+ end
14
+
15
+ # @return [Array]
16
+ def date_to_ary
17
+ self.split("〜").map!(&:parse_date)
18
+ end
19
+
20
+ def phone_number?
21
+ delete('-') =~ /^\d+$/
22
+ end
23
+ end
@@ -0,0 +1,32 @@
1
+ require 'faraday'
2
+
3
+ module Faraday
4
+ class Response::RaiseButterSandError < Response::Middleware
5
+ def on_complete(response)
6
+ case response[:status]
7
+ when 400
8
+ raise ButterSand::BadRequest, error_message(response)
9
+ when 401
10
+ raise ButterSand::Unauthorized, error_message(response)
11
+ when 403
12
+ raise ButterSand::Forbidden, error_message(response)
13
+ when 404
14
+ raise ButterSand::NotFound, error_message(response)
15
+ when 406
16
+ raise ButterSand::NotAcceptable, error_message(response)
17
+ when 500
18
+ raise ButterSand::InternalServerError, error_message(response)
19
+ when 503
20
+ raise ButterSand::ServiceUnavailable, error_message(response)
21
+ end
22
+ end
23
+
24
+ private
25
+
26
+ def error_message(response)
27
+ message = response[:body]['error']
28
+ return message unless message.empty?
29
+ "#{response[:method].to_s.upcase} #{response[:url].to_s}: #{response[:status]}"
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,33 @@
1
+ # coding: utf-8
2
+ require 'spec_helper'
3
+
4
+ describe ButterSand::API::Events do
5
+ url = 'https://www.rokkatei-eshop.com/contents/shop/saiji/'
6
+
7
+ before do
8
+ stub_request(:get, url).to_return(:status => 200, :body => fixture('marusei.html'))
9
+ end
10
+
11
+ describe 'all' do
12
+ subject { ButterSand.all }
13
+ it { should have(5).items }
14
+ end
15
+
16
+ describe 'find_by_prefecture' do
17
+ it 'should have an item' do
18
+ ButterSand.send(:find_by_prefecture, '東京').should have(1).item
19
+ end
20
+
21
+ it 'should include ButterSand::Event' do
22
+ ButterSand.send(:find_by_prefecture, '東京').first.should be_kind_of ButterSand::Event
23
+ end
24
+
25
+ it 'should be empty array' do
26
+ ButterSand.send(:find_by_prefecture, '山形').should be_empty
27
+ end
28
+
29
+ it 'should raise ArgumentError' do
30
+ lambda{ ButterSand.send(:find_by_prefecture, 1111) }.should raise_error ArgumentError
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,78 @@
1
+ require 'spec_helper'
2
+
3
+ describe ButterSand::Client do
4
+ url = 'https://www.rokkatei-eshop.com/contents/shop/saiji/'
5
+ path_saiji = '/contents/shop/saiji/'
6
+
7
+ describe 'get' do
8
+ context '400' do
9
+ before do
10
+ stub_request(:get, url).to_return(:status => 400, :body => {'error' => 'Bad Request'})
11
+ end
12
+
13
+ it 'should raise ButterSand::BadRequest' do
14
+ lambda{ ButterSand.get(path_saiji) }.should raise_error ButterSand::BadRequest
15
+ end
16
+ end
17
+
18
+ context '401' do
19
+ before do
20
+ stub_request(:get, url).to_return(:status => 401, :body => {'error' => 'Unauthorized'})
21
+ end
22
+
23
+ it 'should raise ButterSand::Unauthorized' do
24
+ lambda{ ButterSand.get(path_saiji) }.should raise_error ButterSand::Unauthorized
25
+ end
26
+ end
27
+
28
+ context '403' do
29
+ before do
30
+ stub_request(:get, url).to_return(:status => 403, :body => {'error' => 'Forbidden'})
31
+ end
32
+
33
+ it 'should raise ButterSand::Unauthorized' do
34
+ lambda{ ButterSand.get(path_saiji) }.should raise_error ButterSand::Forbidden
35
+ end
36
+ end
37
+
38
+ context '404' do
39
+ before do
40
+ stub_request(:get, url).to_return(:status => 404, :body => {'error' => 'Not Found'})
41
+ end
42
+
43
+ it 'should raise ButterSand::NotFound' do
44
+ lambda{ ButterSand.get(path_saiji) }.should raise_error ButterSand::NotFound
45
+ end
46
+ end
47
+
48
+ context '406' do
49
+ before do
50
+ stub_request(:get, url).to_return(:status => 406, :body => {'error' => 'Not Acceptable'})
51
+ end
52
+
53
+ it 'should raise ButterSand::NotAcceptable' do
54
+ lambda{ ButterSand.get(path_saiji) }.should raise_error ButterSand::NotAcceptable
55
+ end
56
+ end
57
+
58
+ context '500' do
59
+ before do
60
+ stub_request(:get, url).to_return(:status => 500, :body => {'error' => 'Internal Server Error'})
61
+ end
62
+
63
+ it 'should raise ButterSand::InternalServerError' do
64
+ lambda{ ButterSand.get(path_saiji) }.should raise_error ButterSand::InternalServerError
65
+ end
66
+ end
67
+
68
+ context '503' do
69
+ before do
70
+ stub_request(:get, url).to_return(:status => 503, :body => {'error' => 'Internal Server Error'})
71
+ end
72
+
73
+ it 'should raise ButterSand::ServiceUnavailable' do
74
+ lambda{ ButterSand.get(path_saiji) }.should raise_error ButterSand::ServiceUnavailable
75
+ end
76
+ end
77
+ end
78
+ end
File without changes
@@ -0,0 +1,68 @@
1
+ # coding: utf-8
2
+ require 'spec_helper'
3
+ require 'date'
4
+
5
+ describe ButterSand::Parser do
6
+ path_saiji = '/contents/shop/saiji/'
7
+
8
+ context 'with some events' do
9
+ before do
10
+ stub_request(:get, 'https://www.rokkatei-eshop.com/contents/shop/saiji/')
11
+ .to_return(:status => 200, :body => fixture('marusei.html'))
12
+ @response = ButterSand.get(path_saiji)
13
+ @response_array = ButterSand::Parser.to_array(@response)
14
+ end
15
+
16
+ describe 'to_array' do
17
+ it 'should be kind of Array' do
18
+ @response_array.should be_kind_of Array
19
+ end
20
+
21
+ it 'should have 5 items' do
22
+ @response_array.should have(5).items
23
+ end
24
+
25
+ it 'includes Hash' do
26
+ @response_array.sample.should be_kind_of Hash
27
+ end
28
+
29
+ it "first item's shop name should be 'うすい百貨店'" do
30
+ @response_array.first[:shop].should eq 'うすい百貨店'
31
+ end
32
+
33
+ it "first item's prefecture should be '福島'" do
34
+ @response_array.first[:prefecture].should eq '福島'
35
+ end
36
+
37
+ it "first item's start date should be 2013-02-20" do
38
+ @response_array.first[:starts].should eq Date.parse('2013-02-20')
39
+ end
40
+
41
+ it "first item's end date should be 2013-03-12" do
42
+ @response_array.first[:ends].should eq Date.parse('2013-03-12')
43
+ end
44
+
45
+ it "first item's phone number should be 0249-32-0001" do
46
+ @response_array.first[:phone].should eq '0249-32-0001'
47
+ end
48
+ end
49
+ end
50
+
51
+ context 'with no event' do
52
+ before do
53
+ stub_request(:get, 'https://www.rokkatei-eshop.com/contents/shop/saiji/')
54
+ .to_return(:status => 200, :body => fixture('marusei_no_event.html'))
55
+ @response = ButterSand.get(path_saiji)
56
+ @response_array = ButterSand::Parser.to_array(@response)
57
+ end
58
+
59
+ describe 'to_hash' do
60
+ it 'should be kind of Array' do
61
+ @response_array.should be_kind_of Array
62
+ end
63
+ it 'should not have any items' do
64
+ @response_array.should have(0).items
65
+ end
66
+ end
67
+ end
68
+ end
File without changes
@@ -0,0 +1,232 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
3
+ <head>
4
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
5
+ <meta http-equiv="content-language" content="ja" />
6
+ <meta http-equiv="content-style-type" content="text/css" />
7
+ <meta http-equiv="content-script-type" content="text/javascript" />
8
+ <title>各地の催事情報</title>
9
+
10
+ <link rel="stylesheet" type="text/css" href="/contents/common/css/default800.css" media="all" />
11
+ <link rel="stylesheet" type="text/css" href="/contents/shop/saiji/css/default.css" media="all" />
12
+
13
+ <script type="text/javascript" src="/contents/common/js/functions.js""></script>
14
+
15
+ <style type="text/css">
16
+ <!--
17
+ #container #contents #frame .tohoku {
18
+ }
19
+ body5 {
20
+ color: #F00;
21
+ }
22
+ #container #contents .lead {
23
+ }
24
+ body {
25
+ }
26
+ body4 {
27
+ color: #F00;
28
+ }
29
+ point {
30
+ color: #F00;
31
+ }
32
+ .body4 {
33
+ color: #F00;
34
+ }
35
+ -->
36
+ </style>
37
+ <script type="text/javascript">
38
+
39
+ var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
40
+
41
+ document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
42
+
43
+ </script>
44
+
45
+ <script type="text/javascript">
46
+
47
+ try {
48
+
49
+ var pageTracker = _gat._getTracker("UA-24674757-1");
50
+
51
+ pageTracker._trackPageview();
52
+
53
+ } catch(err) {}
54
+
55
+ </script>
56
+
57
+ </head>
58
+ <body>
59
+ <div id="container">
60
+ <div id="header">
61
+ <div id="logo">
62
+ <blockquote>
63
+ <p><img src="/contents/common/image/rokkatei_onlineshop_s.gif" width="192" height="41" alt="六花亭 ONLINE SHOP" /></p>
64
+ </blockquote>
65
+ </div>
66
+ <h1><img src="/contents/shop/saiji/image/title_saiji.gif" width="250" height="41" alt="各地の催事情報" /></h1>
67
+ </div>
68
+ <div id="contents">
69
+
70
+
71
+
72
+ <h2>各地催事への出品のご案内</h2>
73
+
74
+ <p class="date">2013年2月27日現在</p>
75
+ <p class="lead">
76
+ 六花亭の人気商品を下記のお店でお求めいただけます。<br />
77
+ 取り扱い商品は各催事場で異なります。
78
+ また、開催期間が変わる場合がございますので、詳しくは各催事場までお問い合わせください。<br />
79
+ 数に限りがございます。品切れの場合はご容赦ください。<br />
80
+ <span class="red2">◆</span>印は出店催事(取り扱い商品の豊富な催事)です。</p>
81
+ <p>&nbsp;</p>
82
+
83
+ <ul>
84
+ <li class="left"><a href="#tohoku"><img src="/contents/shop/saiji/image/bt_saiji_01.gif" width="164" height="27" alt="東北地方" /></a></li>
85
+ <li><a href="#kanto"><img src="/contents/shop/saiji/image/bt_saiji_02.gif" width="164" height="27" alt="関東・甲信越地方" /></a></li>
86
+ <li><a href="#tokai"><img src="/contents/shop/saiji/image/bt_saiji_03.gif" width="164" height="27" alt="北陸・東海地方" /></a></li>
87
+
88
+ <li class="left"><a href="#kansai"><img src="/contents/shop/saiji/image/bt_saiji_04.gif" width="164" height="27" alt="関西地方" /></a></li>
89
+ <li><a href="#chugoku"><img src="/contents/shop/saiji/image/bt_saiji_05.gif" width="164" height="27" alt="中国・四国地方" /></a></li>
90
+ <li><a href="#kyusyu"><img src="/contents/shop/saiji/image/bt_saiji_06.gif" width="164" height="27" alt="九州・沖縄地方" /></a></li>
91
+ <!--<li><a href="#" onclick="window.open('shutten.html','出店催事のご案内','width=800,height=800,scrollbars=yes');"><img src="/contents/shop/saiji/image/bt_saiji_07.gif" width="164" height="27" alt="出店催事のご案内" /></a></li>-->
92
+ </ul>
93
+
94
+ <div class="line_dbl"></div>
95
+ </table>
96
+ <a name="tohoku" id="tohoku"></a>
97
+ <h3 class="tohoku">●東北地方</h3>
98
+
99
+ <table class="tohoku">
100
+ <tr><th width="203">< 期間 ></th><th width="83">< 都道府県 ></th><th width="220">< 催事場 ></th><th width="188">< お問い合わせ番号 ></th></tr>
101
+ <tr class="tohoku">
102
+ <td>2月20日〜3月12日</td>
103
+ <td class="pref">福島</td>
104
+ <td>うすい百貨店</td>
105
+ <td>0249-32-0001</td>
106
+ </tr>
107
+ <tr>
108
+ <td>2月20日〜3月14日</td>
109
+ <td class="pref">岩手</td>
110
+ <td>川徳パルクアベニューカワトク</td>
111
+ <td>019-651-1111</td>
112
+ </tr>
113
+ </table>
114
+ <a name="kanto" id="kanto"></a>
115
+ <h3 class="kanto">●関東・甲信越地方</h3>
116
+
117
+ <table class="kanto">
118
+ <tr>
119
+ <th width="184">< 期間 ></th>
120
+ <th width="105">< 都道府県 ></th>
121
+ <th width="301">< 催事場 ></th>
122
+ <th width="182">< お問い合わせ番号 ></th>
123
+ </tr>
124
+ <tr>
125
+ <td>2月20日〜2月28日</td>
126
+ <td class="pref">神奈川</td>
127
+ <td>小田急百貨店藤沢店</td>
128
+ <td>0466-26-6111</td>
129
+ </tr>
130
+ <tr>
131
+ <td class="tokai"><span class="red2">◆</span>3月6日〜3月11日</td>
132
+ <td class="pref">東京</td>
133
+ <td>伊勢丹立川店</td>
134
+ <td>042-525-1111</td>
135
+ </tr>
136
+ </table>
137
+
138
+ <a name="tokai" id="tokai"></a>
139
+ <h3 class="tokai">●北陸・東海地方</h3>
140
+
141
+ <table class="tokai">
142
+ <tr><th width="184">< 期間 ></th><th width="102">< 都道府県 ></th><th width="235">< 催事場 ></th><th width="188">< お問い合わせ番号 ></th></tr>
143
+ <tr class="tokai">
144
+ <td>1月15日〜2月27日</td>
145
+ <td class="pref">愛知</td>
146
+ <td>三越名古屋星ヶ丘店</td>
147
+ <td>052-783-3271</td>
148
+ </tr>
149
+ </table>
150
+
151
+ <a name="kansai" id="kansai"></a>
152
+ <h3 class="kansai">●関西地方</h3>
153
+
154
+ <table class="kansai">
155
+ <tr><th width="184">< 期間 ></th><th width="100">< 都道府県 ></th><th width="236">< 催事場 ></th><th width="181">< お問い合わせ番号 ></th></tr>
156
+ <tr>
157
+ <td colspan="4">現在催事への出品予定はございません。</td>
158
+ </tr>
159
+ </table>
160
+
161
+ <a name="chugoku" id="chugoku"></a>
162
+ <h3 class="chugoku">●中国・四国地方</h3>
163
+
164
+ <table class="chugoku">
165
+ <tr><th width="168">< 期間 ></th><th width="100">< 都道府県 ></th><th width="232">< 催事場 ></th><th width="181">< お問い合わせ番号 ></th></tr>
166
+ <tr class="chugoku">
167
+ <td><span class="kanto">2月15日〜2月27日</span></td>
168
+ <td class="pref">香川</td>
169
+ <td>高松天満屋</td>
170
+ <td>hoge-hoge-hoge</td>
171
+ </tr>
172
+ </table>
173
+
174
+ <a name="kyushu" id="kyushu"></a>
175
+ <h3 class="kyushu">●九州・沖縄地方</h3>
176
+
177
+ <table class="kyushu">
178
+ <tr><th width="173">< 期間 ></th><th width="101">< 都道府県 ></th><th width="232">< 催事場 ></th><th width="188">< お問い合わせ番号 ></th></tr>
179
+ <tr class="chugoku">
180
+ <td><span class="kanto">二月二十日〜三月十四日</span></td>
181
+ <td class="pref">佐賀</td>
182
+ <td>佐賀玉屋</td>
183
+ <td>0952-24-1151</td>
184
+ </tr>
185
+ </table>
186
+
187
+ </table>
188
+
189
+ <!-- sample --><!--
190
+
191
+ --------------通常催事--------------
192
+ <tr>
193
+ <td>0月00日〜0月00日</td>
194
+ <td class="pref">ああ</td>
195
+ <td>ああああああああ</td>
196
+ <td>000-00-0000</td>
197
+ </tr>
198
+
199
+ --------------社員派遣催事--------------
200
+ <tr>
201
+ <td>0月00日〜0月00日</td>
202
+ <td class="pref"><span class="red2">◆</span>ああ</td>
203
+ <td>ああああああああ</td>
204
+ <td>000-00-0000</td>
205
+ </tr>
206
+
207
+ --------------予定無し--------------
208
+ <tr>
209
+ <td colspan="4">現在催事への出品予定はございません。</td>
210
+ </tr>
211
+
212
+ --><!-- end sample -->
213
+
214
+
215
+
216
+ </div><!-- end frame -->
217
+
218
+
219
+
220
+ <div class="navi_page"><div class="navi_prev">
221
+ <p class="arrow"><a href="#" onclick="window.close(); return false;">このウィンドウを閉じる</a></p>
222
+ </div><div class="navi_next">
223
+
224
+ </div></div>
225
+ <div class="cr"></div>
226
+
227
+
228
+
229
+ </div><!-- end contents -->
230
+ </div><!-- end container -->
231
+ </body>
232
+ </html>
@@ -0,0 +1,198 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
3
+ <head>
4
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
5
+ <meta http-equiv="content-language" content="ja" />
6
+ <meta http-equiv="content-style-type" content="text/css" />
7
+ <meta http-equiv="content-script-type" content="text/javascript" />
8
+ <title>各地の催事情報</title>
9
+
10
+ <link rel="stylesheet" type="text/css" href="/contents/common/css/default800.css" media="all" />
11
+ <link rel="stylesheet" type="text/css" href="/contents/shop/saiji/css/default.css" media="all" />
12
+
13
+ <script type="text/javascript" src="/contents/common/js/functions.js""></script>
14
+
15
+ <style type="text/css">
16
+ <!--
17
+ #container #contents #frame .tohoku {
18
+ }
19
+ body5 {
20
+ color: #F00;
21
+ }
22
+ #container #contents .lead {
23
+ }
24
+ body {
25
+ }
26
+ body4 {
27
+ color: #F00;
28
+ }
29
+ point {
30
+ color: #F00;
31
+ }
32
+ .body4 {
33
+ color: #F00;
34
+ }
35
+ -->
36
+ </style>
37
+ <script type="text/javascript">
38
+
39
+ var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
40
+
41
+ document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
42
+
43
+ </script>
44
+
45
+ <script type="text/javascript">
46
+
47
+ try {
48
+
49
+ var pageTracker = _gat._getTracker("UA-24674757-1");
50
+
51
+ pageTracker._trackPageview();
52
+
53
+ } catch(err) {}
54
+
55
+ </script>
56
+
57
+ </head>
58
+ <body>
59
+ <div id="container">
60
+ <div id="header">
61
+ <div id="logo">
62
+ <blockquote>
63
+ <p><img src="/contents/common/image/rokkatei_onlineshop_s.gif" width="192" height="41" alt="六花亭 ONLINE SHOP" /></p>
64
+ </blockquote>
65
+ </div>
66
+ <h1><img src="/contents/shop/saiji/image/title_saiji.gif" width="250" height="41" alt="各地の催事情報" /></h1>
67
+ </div>
68
+ <div id="contents">
69
+
70
+
71
+
72
+ <h2>各地催事への出品のご案内</h2>
73
+
74
+ <p class="date">2013年2月27日現在</p>
75
+ <p class="lead">
76
+ 六花亭の人気商品を下記のお店でお求めいただけます。<br />
77
+ 取り扱い商品は各催事場で異なります。
78
+ また、開催期間が変わる場合がございますので、詳しくは各催事場までお問い合わせください。<br />
79
+ 数に限りがございます。品切れの場合はご容赦ください。<br />
80
+ <span class="red2">◆</span>印は出店催事(取り扱い商品の豊富な催事)です。</p>
81
+ <p>&nbsp;</p>
82
+
83
+ <ul>
84
+ <li class="left"><a href="#tohoku"><img src="/contents/shop/saiji/image/bt_saiji_01.gif" width="164" height="27" alt="東北地方" /></a></li>
85
+ <li><a href="#kanto"><img src="/contents/shop/saiji/image/bt_saiji_02.gif" width="164" height="27" alt="関東・甲信越地方" /></a></li>
86
+ <li><a href="#tokai"><img src="/contents/shop/saiji/image/bt_saiji_03.gif" width="164" height="27" alt="北陸・東海地方" /></a></li>
87
+
88
+ <li class="left"><a href="#kansai"><img src="/contents/shop/saiji/image/bt_saiji_04.gif" width="164" height="27" alt="関西地方" /></a></li>
89
+ <li><a href="#chugoku"><img src="/contents/shop/saiji/image/bt_saiji_05.gif" width="164" height="27" alt="中国・四国地方" /></a></li>
90
+ <li><a href="#kyusyu"><img src="/contents/shop/saiji/image/bt_saiji_06.gif" width="164" height="27" alt="九州・沖縄地方" /></a></li>
91
+ <!--<li><a href="#" onclick="window.open('shutten.html','出店催事のご案内','width=800,height=800,scrollbars=yes');"><img src="/contents/shop/saiji/image/bt_saiji_07.gif" width="164" height="27" alt="出店催事のご案内" /></a></li>-->
92
+ </ul>
93
+
94
+ <div class="line_dbl"></div>
95
+ </table>
96
+ <a name="tohoku" id="tohoku"></a>
97
+ <h3 class="tohoku">●東北地方</h3>
98
+
99
+ <table class="tohoku">
100
+ <tr><th width="203">< 期間 ></th><th width="83">< 都道府県 ></th><th width="220">< 催事場 ></th><th width="188">< お問い合わせ番号 ></th></tr>
101
+ <tr>
102
+ <td colspan="4">現在催事への出品予定はございません。</td>
103
+ </tr>
104
+ </table>
105
+ <a name="kanto" id="kanto"></a>
106
+ <h3 class="kanto">●関東・甲信越地方</h3>
107
+
108
+ <table class="kanto">
109
+ <tr>
110
+ <td colspan="4">現在催事への出品予定はございません。</td>
111
+ </tr>
112
+ </table>
113
+
114
+ <a name="tokai" id="tokai"></a>
115
+ <h3 class="tokai">●北陸・東海地方</h3>
116
+
117
+ <table class="tokai">
118
+ <tr><th width="184">< 期間 ></th><th width="102">< 都道府県 ></th><th width="235">< 催事場 ></th><th width="188">< お問い合わせ番号 ></th></tr>
119
+ <tr>
120
+ <td colspan="4">現在催事への出品予定はございません。</td>
121
+ </tr>
122
+ </table>
123
+
124
+ <a name="kansai" id="kansai"></a>
125
+ <h3 class="kansai">●関西地方</h3>
126
+
127
+ <table class="kansai">
128
+ <tr><th width="184">< 期間 ></th><th width="100">< 都道府県 ></th><th width="236">< 催事場 ></th><th width="181">< お問い合わせ番号 ></th></tr>
129
+ <tr>
130
+ <td colspan="4">現在催事への出品予定はございません。</td>
131
+ </tr>
132
+ </table>
133
+
134
+ <a name="chugoku" id="chugoku"></a>
135
+ <h3 class="chugoku">●中国・四国地方</h3>
136
+
137
+ <table class="chugoku">
138
+ <tr><th width="168">< 期間 ></th><th width="100">< 都道府県 ></th><th width="232">< 催事場 ></th><th width="181">< お問い合わせ番号 ></th></tr>
139
+ <tr>
140
+ <td colspan="4">現在催事への出品予定はございません。</td>
141
+ </tr>
142
+ </table>
143
+ <a name="kyushu" id="kyushu"></a>
144
+ <h3 class="kyushu">●九州・沖縄地方</h3>
145
+
146
+ <table class="kyushu">
147
+ <tr><th width="173">< 期間 ></th><th width="101">< 都道府県 ></th><th width="232">< 催事場 ></th><th width="188">< お問い合わせ番号 ></th></tr>
148
+ <tr>
149
+ <td colspan="4">現在催事への出品予定はございません。</td>
150
+ </tr>
151
+ </table>
152
+
153
+ </table>
154
+
155
+ <!-- sample --><!--
156
+
157
+ --------------通常催事--------------
158
+ <tr>
159
+ <td>0月00日〜0月00日</td>
160
+ <td class="pref">ああ</td>
161
+ <td>ああああああああ</td>
162
+ <td>000-00-0000</td>
163
+ </tr>
164
+
165
+ --------------社員派遣催事--------------
166
+ <tr>
167
+ <td>0月00日〜0月00日</td>
168
+ <td class="pref"><span class="red2">◆</span>ああ</td>
169
+ <td>ああああああああ</td>
170
+ <td>000-00-0000</td>
171
+ </tr>
172
+
173
+ --------------予定無し--------------
174
+ <tr>
175
+ <td colspan="4">現在催事への出品予定はございません。</td>
176
+ </tr>
177
+
178
+ --><!-- end sample -->
179
+
180
+
181
+
182
+ </div><!-- end frame -->
183
+
184
+
185
+
186
+ <div class="navi_page"><div class="navi_prev">
187
+ <p class="arrow"><a href="#" onclick="window.close(); return false;">このウィンドウを閉じる</a></p>
188
+ </div><div class="navi_next">
189
+
190
+ </div></div>
191
+ <div class="cr"></div>
192
+
193
+
194
+
195
+ </div><!-- end contents -->
196
+ </div><!-- end container -->
197
+ </body>
198
+ </html>
@@ -0,0 +1,22 @@
1
+ require 'simplecov'
2
+
3
+ SimpleCov.start do
4
+ add_filter 'spec'
5
+ end
6
+
7
+ require 'bundler/setup'
8
+ require 'butter_sand'
9
+ require 'faraday/response/raise_butter_sand_error'
10
+ require 'webmock/rspec'
11
+
12
+ RSpec.configure do |config|
13
+ config.order = 'random'
14
+ end
15
+
16
+ def fixture_path
17
+ File.expand_path('../fixtures', __FILE__)
18
+ end
19
+
20
+ def fixture(file)
21
+ File.new(fixture_path + '/' + file)
22
+ end
metadata ADDED
@@ -0,0 +1,207 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: butter_sand
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Shun Sugai
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-03-07 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: faraday
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '0.8'
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: '0.8'
30
+ - !ruby/object:Gem::Dependency
31
+ name: faraday_middleware
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
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'
46
+ - !ruby/object:Gem::Dependency
47
+ name: nokogiri
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: 1.5.6
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 1.5.6
62
+ - !ruby/object:Gem::Dependency
63
+ name: bundler
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: '1.3'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: '1.3'
78
+ - !ruby/object:Gem::Dependency
79
+ name: rake
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: rspec
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: webmock
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: simplecov
128
+ requirement: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ! '>='
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ type: :development
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ description: Ruby wrapper for marusei butter sand website
143
+ email:
144
+ - sugaishun@gmail.com
145
+ executables: []
146
+ extensions: []
147
+ extra_rdoc_files: []
148
+ files:
149
+ - .gitignore
150
+ - .rspec
151
+ - Gemfile
152
+ - LICENSE.txt
153
+ - README.md
154
+ - Rakefile
155
+ - butter_sand.gemspec
156
+ - lib/butter_sand.rb
157
+ - lib/butter_sand/api/events.rb
158
+ - lib/butter_sand/client.rb
159
+ - lib/butter_sand/error.rb
160
+ - lib/butter_sand/event.rb
161
+ - lib/butter_sand/parser.rb
162
+ - lib/butter_sand/version.rb
163
+ - lib/core_ext/array.rb
164
+ - lib/core_ext/string.rb
165
+ - lib/faraday/response/raise_butter_sand_error.rb
166
+ - spec/butter_sand/api/events_spec.rb
167
+ - spec/butter_sand/client_spec.rb
168
+ - spec/butter_sand/event_spec.rb
169
+ - spec/butter_sand/parser_spec.rb
170
+ - spec/butter_sand_spec.rb
171
+ - spec/fixtures/marusei.html
172
+ - spec/fixtures/marusei_no_event.html
173
+ - spec/spec_helper.rb
174
+ homepage: https://github.com/shunsugai/butter_sand
175
+ licenses:
176
+ - MIT
177
+ post_install_message:
178
+ rdoc_options: []
179
+ require_paths:
180
+ - lib
181
+ required_ruby_version: !ruby/object:Gem::Requirement
182
+ none: false
183
+ requirements:
184
+ - - ! '>='
185
+ - !ruby/object:Gem::Version
186
+ version: '0'
187
+ required_rubygems_version: !ruby/object:Gem::Requirement
188
+ none: false
189
+ requirements:
190
+ - - ! '>='
191
+ - !ruby/object:Gem::Version
192
+ version: '0'
193
+ requirements: []
194
+ rubyforge_project:
195
+ rubygems_version: 1.8.25
196
+ signing_key:
197
+ specification_version: 3
198
+ summary: Ruby wrapper for marusei butter sand website
199
+ test_files:
200
+ - spec/butter_sand/api/events_spec.rb
201
+ - spec/butter_sand/client_spec.rb
202
+ - spec/butter_sand/event_spec.rb
203
+ - spec/butter_sand/parser_spec.rb
204
+ - spec/butter_sand_spec.rb
205
+ - spec/fixtures/marusei.html
206
+ - spec/fixtures/marusei_no_event.html
207
+ - spec/spec_helper.rb