lwqzx 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 78a5b965066bbb8c1c190fddd98f4d090bd91207b4d234d8b70abe377ca01f29
4
- data.tar.gz: c1d373ce4cb45d93db3ca01fc337ed485951e3480ec2d94de9163c1f7cad4e11
3
+ metadata.gz: 712d38db3b68aaec6f3e66f155f885edf2f57fb0b80330c047093ffa07f285f2
4
+ data.tar.gz: ea8a000a57c050b3ca5d00599a59c7a2375f5ab9ab67890653aded211ae1e574
5
5
  SHA512:
6
- metadata.gz: b80e2d14101e8bdd5bed4cfd3cb8b4063622f9b8561c796a2eb1393fbacb80ca7d3eceacc57e72cbff5718c46139f409beb266e3b5f272e9c2d4b1df687b7691
7
- data.tar.gz: ec55631af0958e4a76efe357e211eb4c6bbc7b8a82cabd3aa8dbb26490e278b6daf8d66405204a145f42ac9f2d1079a6dc54a2a6764f3c46c7b4d70472f811b7
6
+ metadata.gz: 42b6d338b6e07be59d6f3c0a757aacb18ae662fd132bf9125a6c588fb6b5aab3ce06692215a11b096445a2642966a7ea2400583360bcd962dc69bd3b239d068c
7
+ data.tar.gz: d8d1f383a14486d6e66bf6024d9b1704fdce8b863973502a75f3a45906851dd7b45ef3923dfa7fa3ecfebf9e750cd4d6b5552d04d66ebc7ce02e02cbe0dc7a10
data/lib/lwqzx.rb CHANGED
@@ -1,22 +1,15 @@
1
1
  require "lwqzx/version"
2
- require 'nokogiri'
3
-
2
+ require 'rest-client'
3
+ require 'json'
4
4
  module Lwqzx
5
5
  def self.auth(login,passwd)
6
- lurl = "http://www.lwqzx.sdedu.net/kernel/net_school/active_app/login1.php"
7
- user = "login_user_m_=#{login}"
8
- psd = "login_password=#{passwd}"
9
- res = %x[curl #{lurl} -s -c /tmp/cookies -d #{user} -d #{psd} ]
10
- infos = %x[curl -s -b /tmp/cookies #{lurl}]
11
- content=infos.encode("UTF-8","GB2312")
12
- doc = Nokogiri::HTML(content)
13
- uname = doc.css("span.tt1 a:nth-child(1)").text
14
- return {} if uname == ""
15
- groups = doc.css("span.tt1 a:nth-child(5)")[0]["title"]
16
- %x[rm /tmp/cookies]
17
- groups=groups.gsub("[","").gsub("]","").split("@").compact.reject(&:empty?)
18
- return {login: login, name: uname, groups: groups}
19
- end
6
+ lurl = "http://www.lwqzx.sdedu.net/kernel/net_school/core/jslogin.php"
7
+ res = ::RestClient.post lurl,{login: login, password: passwd}
8
+ hsh = ::JSON.parse(res.body)
9
+ return {} if hsh["name"].empty?
10
+ login = hsh["login"]
11
+ name = hsh["name"]
12
+ groups = hsh["user_group"]
13
+ return {login: login, name: name, groups: groups}
14
+ end
20
15
  end
21
-
22
- Lwqzx.auth("dsfas","dsfasd")
data/lib/lwqzx/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Lwqzx
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
data/lwqzx.gemspec CHANGED
@@ -8,25 +8,14 @@ Gem::Specification.new do |spec|
8
8
  spec.version = Lwqzx::VERSION
9
9
  spec.authors = ["zxy"]
10
10
  spec.email = ["zxy@qq.com"]
11
-
11
+ spec.license = "MIT"
12
12
  spec.summary = %q{lwqzx infos}
13
13
  spec.description = %q{lwqzx infos.}
14
- spec.homepage = ""
15
-
16
- # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
17
- # delete this section to allow pushing this gem to any host.
18
- #if spec.respond_to?(:metadata)
19
- # spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
20
- #else
21
- # raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
22
- #end
14
+ spec.homepage = "https://github.com/lajunta/lwqzx"
23
15
 
24
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
16
+ spec.files = Dir["{lib}/**/*", "Gemfile", "lwqzx.gemspec", "Rakefile"]
25
17
  spec.bindir = "exe"
26
18
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
19
  spec.require_paths = ["lib"]
28
-
29
- spec.add_development_dependency "bundler", "~> 1.11"
30
- spec.add_development_dependency "rake", "~> 10.0"
31
- spec.add_development_dependency "nokogiri", "~> 0"
20
+ spec.add_runtime_dependency("rest-client", "~> 2.1")
32
21
  end
metadata CHANGED
@@ -1,57 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lwqzx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - zxy
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-05-31 00:00:00.000000000 Z
11
+ date: 2019-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: bundler
14
+ name: rest-client
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.11'
20
- type: :development
19
+ version: '2.1'
20
+ type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.11'
27
- - !ruby/object:Gem::Dependency
28
- name: rake
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '10.0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '10.0'
41
- - !ruby/object:Gem::Dependency
42
- name: nokogiri
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '0'
26
+ version: '2.1'
55
27
  description: lwqzx infos.
56
28
  email:
57
29
  - zxy@qq.com
@@ -59,17 +31,14 @@ executables: []
59
31
  extensions: []
60
32
  extra_rdoc_files: []
61
33
  files:
62
- - ".gitignore"
63
34
  - Gemfile
64
- - README.md
65
35
  - Rakefile
66
- - bin/console
67
- - bin/setup
68
36
  - lib/lwqzx.rb
69
37
  - lib/lwqzx/version.rb
70
38
  - lwqzx.gemspec
71
- homepage: ''
72
- licenses: []
39
+ homepage: https://github.com/lajunta/lwqzx
40
+ licenses:
41
+ - MIT
73
42
  metadata: {}
74
43
  post_install_message:
75
44
  rdoc_options: []
@@ -86,8 +55,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
86
55
  - !ruby/object:Gem::Version
87
56
  version: '0'
88
57
  requirements: []
89
- rubyforge_project:
90
- rubygems_version: 2.7.3
58
+ rubygems_version: 3.0.3
91
59
  signing_key:
92
60
  specification_version: 4
93
61
  summary: lwqzx infos
data/.gitignore DELETED
@@ -1,10 +0,0 @@
1
- .gem
2
- /.bundle/
3
- /.yardoc
4
- /Gemfile.lock
5
- /_yardoc/
6
- /coverage/
7
- /doc/
8
- /pkg/
9
- /spec/reports/
10
- /tmp/
data/README.md DELETED
@@ -1,36 +0,0 @@
1
- # Lwqzx
2
-
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/lwqzx`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
6
-
7
- ## Installation
8
-
9
- Add this line to your application's Gemfile:
10
-
11
- ```ruby
12
- gem 'lwqzx'
13
- ```
14
-
15
- And then execute:
16
-
17
- $ bundle
18
-
19
- Or install it yourself as:
20
-
21
- $ gem install lwqzx
22
-
23
- ## Usage
24
-
25
- TODO: Write usage instructions here
26
-
27
- ## Development
28
-
29
- After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
-
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
-
33
- ## Contributing
34
-
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/lwqzx.
36
-
data/bin/console DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "lwqzx"
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 DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here