Created
May 23, 2018 21:19
-
-
Save romikoops/9842d932b787bc19968944ad2c7457e7 to your computer and use it in GitHub Desktop.
Jobs Scrapper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # crawler part | |
| str = <<-CONTENT | |
| **Age:** <%= h[:age] %> | |
| **Skills:** | |
| <% h[:skills].each do |s| %> | |
| * <%= s.escape_special_symbol %> | |
| <% end %> | |
| CONTENT | |
| job.create(title: xxx, description: xxx, content: ToMarkDown(json_data) ) | |
| **Age:** 35 | |
| **Skills:** | |
| * Ruby | |
| * Javascript | |
| # Core | |
| # <%= job.title %> | |
| # <%= job.description %> | |
| # <%= job.content %> | |
| # <%= job.expernal_url %> | |
| EMAIL: | |
| <h1><%= job.provider.title%> Jobs</h1> | |
| <h2><%= job.title %></h2> | |
| <p><%= job.description %></p> | |
| <p><%= job.content.to_html %></p> | |
| <a href="<%= job.expernal_url %>">Apply</a> | |
| Slack: | |
| *<%= job.title %>* | |
| <%= job.description %> | |
| <%= job.content.to_slack_markdown %> | |
| # <%= job.expernal_url %> | |
| class ImportUpworkJobsWorker | |
| def perform | |
| data = Upwork::ScrapService.call | |
| UpWork::SaveService.new(data).call | |
| end | |
| end | |
| module Upwork | |
| class ScrapService | |
| def call | |
| # TODO: fetch data from Upwork API | |
| end | |
| end | |
| class SaveService | |
| def intialize(data) | |
| @data= data | |
| end | |
| def call | |
| MailJob.create( | |
| title: data[:title], | |
| description: data[:description], | |
| content: content, | |
| ... | |
| ) | |
| end | |
| private | |
| def content | |
| <<-CONTENT | |
| **Age:** <%= data[:age] %> | |
| **Skills:** | |
| <% data[:skills].each do |s| %> | |
| * <%= data.escape_special_symbol %> | |
| <% end %> | |
| CONTENT | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment