Module: Misoni
- Defined in:
- lib/misoni.rb,
lib/misoni/cli.rb,
lib/misoni/version.rb
Defined Under Namespace
Constant Summary collapse
- VERSION =
"0.2.0"
Class Method Summary collapse
Class Method Details
.auth ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/misoni.rb', line 24 def self.auth agent = Mechanize.new { |agent| agent.user_agent_alias = 'Mac Safari' } begin agent.get('http://auth.zokei.ac.jp:16978/') do |page| login_result = page.form_with(:action => '/cgi-bin/adeflogin.cgi') do |form| _config = config form.field_with(:name => 'name').value = _config["id"] form.field_with(:name => 'pass').value = _config["password"] end.submit success?(login_result) end rescue SocketError => e puts e. end end |
.config ⇒ Object
11 12 13 |
# File 'lib/misoni.rb', line 11 def self.config Pit.get("http://auth.zokei.ac.jp:16978", :require => { "id"=> "YOUR_UserID", "password"=> "YOUR_PASSWORD" }) end |
.in_rbenv? ⇒ Boolean
43 44 45 |
# File 'lib/misoni.rb', line 43 def self.in_rbenv? ENV.has_key?('RBENV_ROOT') end |