module GunBroker
Constants
- VERSION
- WEB_URL
- WEB_URL_SANDBOX
Public Class Methods
Sets the developer key obtained from GunBroker.com. @param api [Boolean] whether to use api endpoint or public website endpoint
# File lib/gun_broker.rb, line 21 def self.base_url(api: true) if sandbox? return API::ROOT_URL_SANDBOX if api WEB_URL_SANDBOX else return API::ROOT_URL if api WEB_URL end end
Returns the set developer key, or raises GunBroker::Error
if not set. @raise [GunBroker::Error] If the {.dev_key} has not been set. @return [String] The developer key.
# File lib/gun_broker.rb, line 40 def self.dev_key raise GunBroker::Error.new('GunBroker developer key not set.') unless dev_key_present? @@dev_key end
Sets the developer key obtained from GunBroker.com. @param dev_key
[String]
# File lib/gun_broker.rb, line 33 def self.dev_key=(_dev_key) @@dev_key = _dev_key end
Fully-qualified URL for remote proxy (including host, port, user, and password) @return [String] Defaults to `nil`.
# File lib/gun_broker.rb, line 53 def self.proxy_url defined?(@@proxy_url) ? @@proxy_url : nil end
Set URL for remote proxy (including host, port, user, and password) @return [String] Defaults to `nil`.
# File lib/gun_broker.rb, line 47 def self.proxy_url=(_proxy_url) @@proxy_url = _proxy_url end
Convenience method for finding out if a proxy_url
has been set @return [Boolean] Defaults to `false`.
# File lib/gun_broker.rb, line 59 def self.proxy_url? defined?(@@proxy_url) && ! @@proxy_url.nil? || false end
An alias to {.sandbox} method
# File lib/gun_broker.rb, line 76 def self.sandbox? sandbox end
Returns a hash containing the time on GunBroker's servers in UTC and the current version of the GunBroker
API
.
For example:
{ "gunBrokerTime" => "2015-02-06T20:23:08Z", "gunBrokerVersion" => "6 4.4.2.12" }
@return [Hash] Containing the time and API
version.
# File lib/gun_broker.rb, line 91 def self.time GunBroker::API.get('/GunBrokerTime') end
Amount (in seconds) to wait before raising a GunBroker::Error::TimeoutError
@return [Integer] Defaults to `30`.
# File lib/gun_broker.rb, line 103 def self.timeout defined?(@@timeout) ? @@timeout : 30 end
Determines how long to wait on the API
until raising a GunBroker::Error::TimeoutError
. @param value [Integer]
# File lib/gun_broker.rb, line 97 def self.timeout=(value) @@timeout = value end
Private Class Methods
# File lib/gun_broker.rb, line 109 def self.dev_key_present? defined?(@@dev_key) && !@@dev_key.nil? && !@@dev_key.empty? end