Class: Craiggy::PostScraper

Inherits:
Object
  • Object
show all
Defined in:
lib/craiggy/post.rb

Overview

Scrapes and formats ‘post_params` for easy `Post` initialization

Instance Method Summary collapse

Constructor Details

#initialize(page) ⇒ PostScraper

Returns a new instance of PostScraper.



24
25
26
# File 'lib/craiggy/post.rb', line 24

def initialize(page)
  @page = page
end

Instance Method Details

#post_paramsObject



28
29
30
31
32
33
34
35
36
37
# File 'lib/craiggy/post.rb', line 28

def post_params
  {
    image: image,
    title: title,
    price: price,
    location: location,
    description: description,
    url: page.uri.to_s,
  }
end