marketplace_opportunity_scraper 0.0.2 → 0.0.3

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.
@@ -13,6 +13,7 @@ module MarketplaceOpportunityScraper
13
13
  question_deadline
14
14
  closing
15
15
  description
16
+ expected_start_date
16
17
  ].freeze
17
18
 
18
19
  attr_reader *ATTRIBUTES
@@ -62,10 +63,6 @@ module MarketplaceOpportunityScraper
62
63
  ['digital-outcomes', 'digital-specialists', 'user-research-participants']
63
64
  end
64
65
 
65
- def self.get_date(date)
66
- Date.parse date.text.split(':').last
67
- end
68
-
69
66
  def self.opportunity_from_id(id)
70
67
  url = BASE_URL + '/digital-outcomes-and-specialists/opportunities/' + id.to_s
71
68
  page = mechanize.get(url)
@@ -82,6 +79,7 @@ module MarketplaceOpportunityScraper
82
79
  published: Date.parse(text_from_label(page, 'Published')),
83
80
  question_deadline: Date.parse(text_from_label(page, 'Deadline for asking questions')),
84
81
  closing: Date.parse(text_from_label(page, 'Closing date for applications')),
82
+ expected_start_date: Date.parse(text_from_label(page, 'Latest start date')),
85
83
  description: text_from_label(page, 'Summary of the work')
86
84
  }
87
85
 
@@ -90,23 +88,9 @@ module MarketplaceOpportunityScraper
90
88
 
91
89
  def self.opportunity_from_search_result(element)
92
90
  title = element.at('.search-result-title')
93
- important_metadata = element.search('ul.search-result-important-metadata li')
94
- dates = element.search('ul.search-result-metadata')[1].search('li')
95
91
  url = BASE_URL + title.at('a').attributes['href'].value
96
92
 
97
- attrs = {
98
- id: url.split('/').last.to_i,
99
- title: title.text.strip,
100
- url: url,
101
- buyer: important_metadata[0].text.strip,
102
- location: important_metadata[1].text.strip,
103
- published: get_date(dates[0]),
104
- question_deadline: get_date(dates[1]),
105
- closing: get_date(dates[2]),
106
- description: element.at('.search-result-excerpt').text.strip
107
- }
108
-
109
- new(attrs)
93
+ opportunity_from_id(url.split('/').last.to_i)
110
94
  end
111
95
 
112
96
  def self.text_from_label(page, label)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MarketplaceOpportunityScraper
4
- VERSION = '0.0.2'
4
+ VERSION = '0.0.3'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: marketplace_opportunity_scraper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stuart Harrison