switch_eapass 0.1.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.
- checksums.yaml +7 -0
- data/.gitignore +35 -0
- data/.travis.yml +4 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +21 -0
- data/README.md +24 -0
- data/Rakefile +1 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/exe/switch_eapass +5 -0
- data/lib/switch_eapass/cli.rb +13 -0
- data/lib/switch_eapass/eamusement.rb +42 -0
- data/lib/switch_eapass/version.rb +3 -0
- data/lib/switch_eapass.rb +5 -0
- data/switch_eapass.gemspec +27 -0
- metadata +129 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: bf401650063d8ab5586dabfa9b7b92ddc74f72c7
|
4
|
+
data.tar.gz: d5bdf51ed180d88b5057adc3395889da535bebc7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0fdddf8e22a2746642b13ca9f6faa4308a0966e4639b2f7f8a1602c1c7699fac63e2ae62d925dd7e1b6f438bd52ce711d31fed52ebba404734f9a0f263a9211b
|
7
|
+
data.tar.gz: 6c2d94f045210f36b9374a49ec50e8bcbb6ee032c66dfed6a5912efbc1156615112e24522518c7938fb1d3bb242914ce903b12fd85dfa44a459221911b3476a6
|
data/.gitignore
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/test/tmp/
|
9
|
+
/test/version_tmp/
|
10
|
+
/tmp/
|
11
|
+
|
12
|
+
## Specific to RubyMotion:
|
13
|
+
.dat*
|
14
|
+
.repl_history
|
15
|
+
build/
|
16
|
+
|
17
|
+
## Documentation cache and generated files:
|
18
|
+
/.yardoc/
|
19
|
+
/_yardoc/
|
20
|
+
/doc/
|
21
|
+
/rdoc/
|
22
|
+
|
23
|
+
## Environment normalisation:
|
24
|
+
/.bundle/
|
25
|
+
/vendor/bundle
|
26
|
+
/lib/bundler/man/
|
27
|
+
|
28
|
+
# for a library or gem, you might want to ignore these files since the code is
|
29
|
+
# intended to run in multiple environments; otherwise, check them in:
|
30
|
+
# Gemfile.lock
|
31
|
+
# .ruby-version
|
32
|
+
# .ruby-gemset
|
33
|
+
|
34
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
35
|
+
.rvmrc
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 gs3
|
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,24 @@
|
|
1
|
+
## switch_eapass
|
2
|
+
This gem provides command that switching reference in a number of e-Amusement passes.
|
3
|
+
|
4
|
+
## Installation
|
5
|
+
You can get from rubygems.
|
6
|
+
|
7
|
+
```sh
|
8
|
+
$ gem install switch_eapass
|
9
|
+
```
|
10
|
+
|
11
|
+
## Usage
|
12
|
+
|
13
|
+
Execute `switch_eapass` command with e-Amusement card number you want to switch as a argument.
|
14
|
+
|
15
|
+
|
16
|
+
```sh
|
17
|
+
# Example
|
18
|
+
# Now you switch reference to the card with number 'AAAA1111BBBB2222'
|
19
|
+
|
20
|
+
$ switch_eapass AAAA1111BBBB2222
|
21
|
+
```
|
22
|
+
|
23
|
+
At first time, a editor will be launched to set KONAMI-ID and password.
|
24
|
+
(Uses [pit gem](https://github.com/cho45/pit) about it.)
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "switch_eapass"
|
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
|
data/bin/setup
ADDED
data/exe/switch_eapass
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'switch_eapass'
|
2
|
+
require 'switch_eapass/eamusement'
|
3
|
+
require 'thor'
|
4
|
+
|
5
|
+
module SwitchEapass
|
6
|
+
class CLI < Thor
|
7
|
+
desc "switch <e-Pass ID>", "switch referring e-Amusement pass"
|
8
|
+
def switch(card_number)
|
9
|
+
ea = EAmusement.new
|
10
|
+
ea.switch_reference(card_number)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'mechanize'
|
2
|
+
require 'pit'
|
3
|
+
|
4
|
+
class EAmusement < Mechanize
|
5
|
+
def switch_reference(switch_card_number)
|
6
|
+
login
|
7
|
+
get 'http://p.eagate.573.jp/gate/p/eamusement/change/index.html'
|
8
|
+
|
9
|
+
reffered_card_number =
|
10
|
+
page.search('//td[@class="card_info"][1]').inner_text[0..15]
|
11
|
+
|
12
|
+
if reffered_card_number != switch_card_number
|
13
|
+
# switch reference
|
14
|
+
page.links_with(class: "detach_btn").each do |link|
|
15
|
+
click(link) if link.href.include?(switch_card_number)
|
16
|
+
end
|
17
|
+
else
|
18
|
+
puts 'Already reffered.'
|
19
|
+
false
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
def login
|
25
|
+
get 'https://p.eagate.573.jp/gate/p/login.html'
|
26
|
+
page.encoding = 'utf-8'
|
27
|
+
|
28
|
+
ENV['EDITOR'] ||= 'vim'
|
29
|
+
config = Pit.get('p.eagate.573.jp', require: {
|
30
|
+
"konami_id" => "Your KONAMI ID",
|
31
|
+
"password" => "Your password",
|
32
|
+
})
|
33
|
+
|
34
|
+
login_form = page.form_with(action: '/gate/p/login.html')
|
35
|
+
login_form.KID = config['konami_id']
|
36
|
+
login_form.pass = config['password']
|
37
|
+
|
38
|
+
submit login_form
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'switch_eapass/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "switch_eapass"
|
8
|
+
spec.version = SwitchEapass::VERSION
|
9
|
+
spec.authors = ["gs3"]
|
10
|
+
spec.email = ["doub1e.31415@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = "Switch referring e-Amusement pass"
|
13
|
+
spec.description = "Switch referring e-Amusement pass"
|
14
|
+
spec.homepage = "https://github.com/gs3/switch_eapass"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = "exe"
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_runtime_dependency "thor"
|
23
|
+
spec.add_runtime_dependency "mechanize"
|
24
|
+
spec.add_runtime_dependency "pit"
|
25
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
26
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,129 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: switch_eapass
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- gs3
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-08-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: thor
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
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: mechanize
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
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: pit
|
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
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.10'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.10'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '10.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '10.0'
|
83
|
+
description: Switch referring e-Amusement pass
|
84
|
+
email:
|
85
|
+
- doub1e.31415@gmail.com
|
86
|
+
executables:
|
87
|
+
- switch_eapass
|
88
|
+
extensions: []
|
89
|
+
extra_rdoc_files: []
|
90
|
+
files:
|
91
|
+
- ".gitignore"
|
92
|
+
- ".travis.yml"
|
93
|
+
- Gemfile
|
94
|
+
- LICENSE.txt
|
95
|
+
- README.md
|
96
|
+
- Rakefile
|
97
|
+
- bin/console
|
98
|
+
- bin/setup
|
99
|
+
- exe/switch_eapass
|
100
|
+
- lib/switch_eapass.rb
|
101
|
+
- lib/switch_eapass/cli.rb
|
102
|
+
- lib/switch_eapass/eamusement.rb
|
103
|
+
- lib/switch_eapass/version.rb
|
104
|
+
- switch_eapass.gemspec
|
105
|
+
homepage: https://github.com/gs3/switch_eapass
|
106
|
+
licenses:
|
107
|
+
- MIT
|
108
|
+
metadata: {}
|
109
|
+
post_install_message:
|
110
|
+
rdoc_options: []
|
111
|
+
require_paths:
|
112
|
+
- lib
|
113
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
119
|
+
requirements:
|
120
|
+
- - ">="
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: '0'
|
123
|
+
requirements: []
|
124
|
+
rubyforge_project:
|
125
|
+
rubygems_version: 2.4.5
|
126
|
+
signing_key:
|
127
|
+
specification_version: 4
|
128
|
+
summary: Switch referring e-Amusement pass
|
129
|
+
test_files: []
|