full_house 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +18 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +1 -0
- data/full_house.gemspec +24 -0
- data/lib/full_house.rb +72 -0
- data/lib/full_house/version.rb +3 -0
- metadata +94 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ffcf25e67cae75ee97fc47f080655c13869cc4bb
|
4
|
+
data.tar.gz: 93443ff84ce3a40b8fc015ab03f0cd148952cf6e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a89585ef97a781cd30d9d7363dd65a5619179de33fc628638b852358ed491ade5f76c870179df20c8e09a13cf0f7285cf7b730bf0f8c9250a3c2b4e7f4e1ad1e
|
7
|
+
data.tar.gz: 30afb6bdc26f6bf285c4cb9071864080b78720433ec27cd478f2b0b04196fe0ab5eed06ef2211511d620d85c7d05cd8a26cfb74fa930dd08ef75e6fe83c05630
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Derek Willis
|
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,29 @@
|
|
1
|
+
# FullHouse
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'full_house'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install full_house
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it ( http://github.com/<my-github-username>/full_house/fork )
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/full_house.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 'full_house/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "full_house"
|
8
|
+
spec.version = FullHouse::VERSION
|
9
|
+
spec.authors = ["Derek Willis"]
|
10
|
+
spec.email = ["dwillis@gmail.com"]
|
11
|
+
spec.summary = %q{Checks for empty seats for Nutcracker performances.}
|
12
|
+
spec.description = %q{}
|
13
|
+
spec.homepage = ""
|
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_development_dependency "bundler"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_dependency "json"
|
24
|
+
end
|
data/lib/full_house.rb
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
require "full_house/version"
|
2
|
+
require "open-uri"
|
3
|
+
require "json"
|
4
|
+
require "csv"
|
5
|
+
|
6
|
+
module FullHouse
|
7
|
+
class Parser
|
8
|
+
|
9
|
+
def self.parse_and_output
|
10
|
+
nycb = parse_nycb
|
11
|
+
bam = parse_bam
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.parse_nycb
|
15
|
+
start = DateTime.now
|
16
|
+
results = []
|
17
|
+
base_url = "http://www.nycballet.com/syos/services/seateditem/"
|
18
|
+
nycb_peformances = [{ :perf => 3588, :date => '2013-12-13', :hour => '20'},
|
19
|
+
{:perf => 3589, :date => '2013-12-14', :hour => 14}, {:perf => 3590, :date => '2013-12-14', :hour => 20},
|
20
|
+
{:perf => 3591, :date => '2013-12-15', :hour => 13}, {:perf => 3592, :date => '2013-12-18', :hour => 19},
|
21
|
+
{:perf => 3593, :date => '2013-12-19', :hour => 19}, {:perf => 3594, :date => '2013-12-20', :hour => 20},
|
22
|
+
{:perf => 3595, :date => '2013-12-21', :hour => 14}, {:perf => 3596, :date => '2013-12-21', :hour => 20},
|
23
|
+
{:perf => 3597, :date => '2013-12-22', :hour => 17}, {:perf => 3598, :date => '2013-12-23', :hour => 14},
|
24
|
+
{:perf => 3599, :date => '2013-12-23', :hour => 19}]
|
25
|
+
nycb_peformances.each do |nycb|
|
26
|
+
response = JSON.parse(open(base_url+nycb[:perf].to_s).read)
|
27
|
+
response["day"] = start.day
|
28
|
+
response["hour"] = start.hour
|
29
|
+
response["perf_id"] = nycb[:perf]
|
30
|
+
response["perf_date"] = nycb[:date]
|
31
|
+
response["perf_hour"] = nycb[:hour]
|
32
|
+
results << response
|
33
|
+
end
|
34
|
+
CSV.open("nycb_#{start.day}_#{start.hour}.csv", "w", :write_headers=> true, :headers => ["day_checked","hour_checked","performance_id","performance_date","performance_hour","seat_type","price_range","seats"]) do |csv|
|
35
|
+
results.each do |result|
|
36
|
+
result['sections'].each do |section|
|
37
|
+
csv << [result["day"], result["hour"], result["perf_id"], result["perf_date"], result["perf_hour"], section["name"], section["price"], section['message']]
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.parse_bam
|
44
|
+
start = DateTime.now
|
45
|
+
results = []
|
46
|
+
base_url = "http://commerce.bam.org/services/SYOS/SeatsSections.ashx?performanceNumber="
|
47
|
+
bam_performances = [{ :perf => 8102, :date => '2013-12-13', :hour => '19'},
|
48
|
+
{:perf => 8104, :date => '2013-12-14', :hour => 14}, {:perf => 8105, :date => '2013-12-14', :hour => 19},
|
49
|
+
{:perf => 8106, :date => '2013-12-15', :hour => 13}, {:perf => 8107, :date => '2013-12-15', :hour => 18},
|
50
|
+
{:perf => 8108, :date => '2013-12-18', :hour => 19}, {:perf => 8109, :date => '2013-12-19', :hour => 19},
|
51
|
+
{:perf => 8110, :date => '2013-12-20', :hour => 19}, {:perf => 8111, :date => '2013-12-21', :hour => 14},
|
52
|
+
{:perf => 8112, :date => '2013-12-21', :hour => 19}, {:perf => 8113, :date => '2013-12-22', :hour => 13},
|
53
|
+
{:perf => 8114, :date => '2013-12-22', :hour => 18}]
|
54
|
+
bam_performances.each do |bam|
|
55
|
+
response = JSON.parse(open(base_url+bam[:perf].to_s).read)
|
56
|
+
response.each do |r|
|
57
|
+
r["day"] = start.day
|
58
|
+
r["hour"] = start.hour
|
59
|
+
r["perf_id"] = bam[:perf]
|
60
|
+
r["perf_date"] = bam[:date]
|
61
|
+
r["perf_hour"] = bam[:hour]
|
62
|
+
end
|
63
|
+
results << response
|
64
|
+
end
|
65
|
+
CSV.open("bam_#{start.day}_#{start.hour}.csv", "w", :write_headers=> true, :headers => ["day_checked","hour_checked","performance_id","performance_date","performance_hour","seat_type","price_range","seats"]) do |csv|
|
66
|
+
results.flatten.each do |result|
|
67
|
+
csv << [result["day"], result["hour"], result["perf_id"], result["perf_date"], result["perf_hour"], result["ScreenDescription"], result["MinPrice"].to_s+"-"+result["MaxPrice"].to_s, result['AvailableSeats']]
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
metadata
ADDED
@@ -0,0 +1,94 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: full_house
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Derek Willis
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-12-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: json
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: ''
|
56
|
+
email:
|
57
|
+
- dwillis@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- .gitignore
|
63
|
+
- Gemfile
|
64
|
+
- LICENSE.txt
|
65
|
+
- README.md
|
66
|
+
- Rakefile
|
67
|
+
- full_house.gemspec
|
68
|
+
- lib/full_house.rb
|
69
|
+
- lib/full_house/version.rb
|
70
|
+
homepage: ''
|
71
|
+
licenses:
|
72
|
+
- MIT
|
73
|
+
metadata: {}
|
74
|
+
post_install_message:
|
75
|
+
rdoc_options: []
|
76
|
+
require_paths:
|
77
|
+
- lib
|
78
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
requirements: []
|
89
|
+
rubyforge_project:
|
90
|
+
rubygems_version: 2.1.9
|
91
|
+
signing_key:
|
92
|
+
specification_version: 4
|
93
|
+
summary: Checks for empty seats for Nutcracker performances.
|
94
|
+
test_files: []
|