Class: Hungry::Site

Inherits:
Resource show all
Defined in:
lib/hungry/site.rb

Instance Attribute Summary collapse

Attributes inherited from Resource

#attributes, #data_source

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Resource

all, belongs_to, #canonical_data_source, collection, each, find, first, get, has_many, #initialize, lazy_load, #reload

Constructor Details

This class inherits a constructor from Hungry::Resource

Instance Attribute Details

#applicationsObject

Preview:



24
25
26
# File 'lib/hungry/site.rb', line 24

def applications
  @applications
end

#countersObject

Preview:



24
25
26
# File 'lib/hungry/site.rb', line 24

def counters
  @counters
end

#countryObject

Preview:



24
25
26
# File 'lib/hungry/site.rb', line 24

def country
  @country
end

#defaultObject

Preview:



24
25
26
# File 'lib/hungry/site.rb', line 24

def default
  @default
end

#emailObject

Preview:



24
25
26
# File 'lib/hungry/site.rb', line 24

def email
  @email
end

#emailsObject

Preview:



24
25
26
# File 'lib/hungry/site.rb', line 24

def emails
  @emails
end

#idObject

Preview:



24
25
26
# File 'lib/hungry/site.rb', line 24

def id
  @id
end

#identifierObject

Preview:



24
25
26
# File 'lib/hungry/site.rb', line 24

def identifier
  @identifier
end

#localeObject

Preview:



24
25
26
# File 'lib/hungry/site.rb', line 24

def locale
  @locale
end

#nameObject

Preview:



24
25
26
# File 'lib/hungry/site.rb', line 24

def name
  @name
end

#newsletter_listObject

Preview:



24
25
26
# File 'lib/hungry/site.rb', line 24

def newsletter_list
  @newsletter_list
end

#resourcesObject

Preview:



24
25
26
# File 'lib/hungry/site.rb', line 24

def resources
  @resources
end

#subtitleObject

Preview:



24
25
26
# File 'lib/hungry/site.rb', line 24

def subtitle
  @subtitle
end

#support_emailObject

Preview:



24
25
26
# File 'lib/hungry/site.rb', line 24

def support_email
  @support_email
end

#timezoneObject

Preview:



24
25
26
# File 'lib/hungry/site.rb', line 24

def timezone
  @timezone
end

#titleObject

Preview:



24
25
26
# File 'lib/hungry/site.rb', line 24

def title
  @title
end

#urlObject

Preview:



24
25
26
# File 'lib/hungry/site.rb', line 24

def url
  @url
end

Class Method Details

.default_siteObject



16
17
18
# File 'lib/hungry/site.rb', line 16

def self.default_site
  collection.all(default: true).first
end

.for_country(country) ⇒ Object



12
13
14
# File 'lib/hungry/site.rb', line 12

def self.for_country(country)
  collection.all(country: country.id).first
end

.with_hostname(hostname) ⇒ Object

FINDERS:



8
9
10
# File 'lib/hungry/site.rb', line 8

def self.with_hostname(hostname)
  collection.all(hostname: hostname).first
end

Instance Method Details

#hostnameObject



31
32
33
34
# File 'lib/hungry/site.rb', line 31

def hostname
  uri = URI.parse(url) rescue nil
  uri && uri.hostname
end