set_patiphan2000 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 8523b50b78f79a42042208095b6074160b616a6896e77453ca5d6b0fbd833ba6
4
+ data.tar.gz: 0770122b185ae6f2104ced0170e1e5c4cc0921b51ce1b7e3d48254361504ce0e
5
+ SHA512:
6
+ metadata.gz: ac536249b84598a9cbdecb03155f6e1623f930011431360c7569e6ce437cd7823936ee8f4d00f2a5afe6768110c4bb4c9322711351f2f0be9afabd53456e9ecc
7
+ data.tar.gz: 25464c65dc3417fc863a3a4dd7b5185e04697ccf01803db6dc763c8778f98c39d045b0be3f520324a6607508bf063df2d43b3fb85afe7a5d9476c29fe54a4ea6
@@ -0,0 +1,18 @@
1
+ name: Ruby
2
+
3
+ on: [push,pull_request]
4
+
5
+ jobs:
6
+ build:
7
+ runs-on: ubuntu-latest
8
+ steps:
9
+ - uses: actions/checkout@v2
10
+ - name: Set up Ruby
11
+ uses: ruby/setup-ruby@v1
12
+ with:
13
+ ruby-version: 2.6.6
14
+ - name: Run the default task
15
+ run: |
16
+ gem install bundler -v 2.2.7
17
+ bundle install
18
+ bundle exec rake
data/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in set_patiphan2000.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
data/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # SetPatiphan2000
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/set_patiphan2000`. 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 'set_patiphan2000'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle install
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install set_patiphan2000
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 the created tag, 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]/set_patiphan2000.
data/Rakefile ADDED
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ task default: %i[]
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "set_patiphan2000"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require "irb"
15
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
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
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "set_patiphan2000/version"
4
+ require 'net/http'
5
+ require 'uri'
6
+ require 'nokogiri'
7
+
8
+ module SetPatiphan2000
9
+ def self.get_all_info
10
+
11
+ base_url = "https://www.set.or.th/set/commonslookup.do?language=th&country=TH&prefix="
12
+
13
+ alphabet = "A".."Z"
14
+
15
+ for char in ["NUMBER"] + alphabet.to_a;
16
+ source = Nokogiri::HTML(Net::HTTP.get(URI.parse(base_url + char)))
17
+ href_element = source.css('tbody', 'tr', 'td').css('a')
18
+
19
+ all_link = href_element.map { |element| element['href'] }
20
+
21
+ for link in all_link;
22
+ company_source = Nokogiri::HTML(Net::HTTP.get(URI.parse("https://www.set.or.th" + link)))
23
+ company_name = company_source.css('h3').inner_html
24
+ last_asset_link = company_source.css('div#maincontent').css('li')[1].css('a')[0]['href']
25
+ asset_source = Nokogiri::HTML(Net::HTTP.get(URI.parse("https://www.set.or.th" + last_asset_link)))
26
+ last_asset = asset_source.css('tbody').css('tr').css('td')[6]
27
+ print company_name, " : ", last_asset.inner_html, "\n"
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SetPatiphan2000
4
+ VERSION = "0.1.0"
5
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/set_patiphan2000/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "set_patiphan2000"
7
+ spec.version = SetPatiphan2000::VERSION
8
+ spec.authors = ["patiphan2000"]
9
+ spec.email = ["patiphan.sri@ku.th"]
10
+
11
+ spec.summary = "A gem for scrap name and asset values of all company in SET website."
12
+ # spec.homepage = "Put your gem's website or public repo URL here."
13
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
14
+
15
+ # spec.metadata["allowed_push_host"] = "Set to 'http://mygemserver.com'"
16
+
17
+ # spec.metadata["homepage_uri"] = spec.homepage
18
+ # spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
19
+ # spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
20
+
21
+ # Specify which files should be added to the gem when it is released.
22
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
23
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
24
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
25
+ end
26
+ spec.bindir = "exe"
27
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
28
+ spec.require_paths = ["lib"]
29
+
30
+ # Uncomment to register a new dependency of your gem
31
+ # spec.add_dependency "example-gem", "~> 1.0"
32
+
33
+ # For more information and examples about making a new gem, checkout our
34
+ # guide at: https://bundler.io/guides/creating_gem.html
35
+ end
metadata ADDED
@@ -0,0 +1,52 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: set_patiphan2000
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - patiphan2000
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2021-02-05 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description:
14
+ email:
15
+ - patiphan.sri@ku.th
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - ".github/workflows/main.yml"
21
+ - ".gitignore"
22
+ - Gemfile
23
+ - README.md
24
+ - Rakefile
25
+ - bin/console
26
+ - bin/setup
27
+ - lib/set_patiphan2000.rb
28
+ - lib/set_patiphan2000/version.rb
29
+ - set_patiphan2000.gemspec
30
+ homepage:
31
+ licenses: []
32
+ metadata: {}
33
+ post_install_message:
34
+ rdoc_options: []
35
+ require_paths:
36
+ - lib
37
+ required_ruby_version: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: 2.4.0
42
+ required_rubygems_version: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ requirements: []
48
+ rubygems_version: 3.0.3
49
+ signing_key:
50
+ specification_version: 4
51
+ summary: A gem for scrap name and asset values of all company in SET website.
52
+ test_files: []