Class: ThemeBandit::Downloader
- Inherits:
-
Object
- Object
- ThemeBandit::Downloader
- Includes:
- HTTParty
- Defined in:
- lib/theme_bandit/downloader.rb
Instance Attribute Summary collapse
-
#document ⇒ Object
readonly
Returns the value of attribute document.
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Class Method Summary collapse
- .error ⇒ Object
- .fetch(url, options = {}) ⇒ Object
- .get_theme(url = ThemeBandit.configuration.url) ⇒ Object
Instance Method Summary collapse
- #get_document(url) ⇒ Object
-
#initialize(url, options = {}) ⇒ Downloader
constructor
A new instance of Downloader.
Constructor Details
#initialize(url, options = {}) ⇒ Downloader
Returns a new instance of Downloader.
21 22 23 24 |
# File 'lib/theme_bandit/downloader.rb', line 21 def initialize(url, = {}) @url, @options = default_to_http(url), @document = get_document(url) end |
Instance Attribute Details
#document ⇒ Object (readonly)
Returns the value of attribute document.
19 20 21 |
# File 'lib/theme_bandit/downloader.rb', line 19 def document @document end |
#error ⇒ Object (readonly)
Returns the value of attribute error.
19 20 21 |
# File 'lib/theme_bandit/downloader.rb', line 19 def error @error end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
19 20 21 |
# File 'lib/theme_bandit/downloader.rb', line 19 def @options end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
19 20 21 |
# File 'lib/theme_bandit/downloader.rb', line 19 def url @url end |
Class Method Details
.error ⇒ Object
15 16 17 |
# File 'lib/theme_bandit/downloader.rb', line 15 def self.error Log.red 'Invalid configuration, please configure through ./bin wrapper or ThemeBandit::Configure' end |
.fetch(url, options = {}) ⇒ Object
11 12 13 |
# File 'lib/theme_bandit/downloader.rb', line 11 def self.fetch(url, = {}) new(url, ).document end |
.get_theme(url = ThemeBandit.configuration.url) ⇒ Object
7 8 9 |
# File 'lib/theme_bandit/downloader.rb', line 7 def self.get_theme(url = ThemeBandit.configuration.url) url ? fetch(url) : error end |