Class: WhatAWorld::Country

Inherits:
Object
  • Object
show all
Defined in:
lib/what_a_world/country.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ Country

Returns a new instance of Country.



4
5
6
7
# File 'lib/what_a_world/country.rb', line 4

def initialize(hash)
    @name = hash.keys.join
    @url_extension = hash.values.join
end

Instance Attribute Details

#issuesObject

Returns the value of attribute issues.



2
3
4
# File 'lib/what_a_world/country.rb', line 2

def issues
  @issues
end

#last_updatedObject

Returns the value of attribute last_updated.



2
3
4
# File 'lib/what_a_world/country.rb', line 2

def last_updated
  @last_updated
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/what_a_world/country.rb', line 3

def name
  @name
end

#regionObject

Returns the value of attribute region.



2
3
4
# File 'lib/what_a_world/country.rb', line 2

def region
  @region
end

#url_extensionObject (readonly)

Returns the value of attribute url_extension.



3
4
5
# File 'lib/what_a_world/country.rb', line 3

def url_extension
  @url_extension
end

Instance Method Details

#get_issuesObject



17
18
19
20
# File 'lib/what_a_world/country.rb', line 17

def get_issues
    self.issues = WhatAWorld::Issues.new(self.url_extension)
    self.issues.scrape
end

#scrapeObject



9
10
11
12
13
14
15
# File 'lib/what_a_world/country.rb', line 9

def scrape
    scraper = WhatAWorld::Scraper::ScraperCountry.new(self.url_extension)
    
    self.last_updated = scraper.find_date
    self.region = scraper.find_region

end