Class: PinterestDL::Configuration
- Inherits:
-
Object
- Object
- PinterestDL::Configuration
- Defined in:
- lib/pinterest_dl/configuration.rb
Constant Summary collapse
- DEFAULT_USER_AGENT =
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 ' \ '(KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36'
- VALID_QUALITIES =
%i[originals 736x 474x 236x].freeze
Instance Attribute Summary collapse
-
#cookies ⇒ Object
Returns the value of attribute cookies.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#max_retries ⇒ Object
Returns the value of attribute max_retries.
-
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
-
#quality ⇒ Object
Returns the value of attribute quality.
-
#rate_limit_interval ⇒ Object
Returns the value of attribute rate_limit_interval.
-
#read_timeout ⇒ Object
Returns the value of attribute read_timeout.
-
#retry_wait ⇒ Object
Returns the value of attribute retry_wait.
-
#user_agent ⇒ Object
Returns the value of attribute user_agent.
Instance Method Summary collapse
- #authenticated? ⇒ Boolean
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/pinterest_dl/configuration.rb', line 19 def initialize @user_agent = DEFAULT_USER_AGENT @cookies = nil @open_timeout = 10 @read_timeout = 20 @max_retries = 3 @retry_wait = 1.0 @quality = :originals @rate_limit_interval = 0.0 @logger = Logger.new($stdout).tap do |log| log.level = Logger::WARN log.formatter = proc { |severity, _time, _progname, msg| "[pinterest-dl] #{severity}: #{msg}\n" } end end |
Instance Attribute Details
#cookies ⇒ Object
Returns the value of attribute cookies.
13 14 15 |
# File 'lib/pinterest_dl/configuration.rb', line 13 def @cookies end |
#logger ⇒ Object
Returns the value of attribute logger.
13 14 15 |
# File 'lib/pinterest_dl/configuration.rb', line 13 def logger @logger end |
#max_retries ⇒ Object
Returns the value of attribute max_retries.
13 14 15 |
# File 'lib/pinterest_dl/configuration.rb', line 13 def max_retries @max_retries end |
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
13 14 15 |
# File 'lib/pinterest_dl/configuration.rb', line 13 def open_timeout @open_timeout end |
#quality ⇒ Object
Returns the value of attribute quality.
17 18 19 |
# File 'lib/pinterest_dl/configuration.rb', line 17 def quality @quality end |
#rate_limit_interval ⇒ Object
Returns the value of attribute rate_limit_interval.
13 14 15 |
# File 'lib/pinterest_dl/configuration.rb', line 13 def rate_limit_interval @rate_limit_interval end |
#read_timeout ⇒ Object
Returns the value of attribute read_timeout.
13 14 15 |
# File 'lib/pinterest_dl/configuration.rb', line 13 def read_timeout @read_timeout end |
#retry_wait ⇒ Object
Returns the value of attribute retry_wait.
13 14 15 |
# File 'lib/pinterest_dl/configuration.rb', line 13 def retry_wait @retry_wait end |
#user_agent ⇒ Object
Returns the value of attribute user_agent.
13 14 15 |
# File 'lib/pinterest_dl/configuration.rb', line 13 def user_agent @user_agent end |
Instance Method Details
#authenticated? ⇒ Boolean
42 43 44 |
# File 'lib/pinterest_dl/configuration.rb', line 42 def authenticated? !.nil? && !.to_s.empty? end |