Class: Camdram::HTTP
Instance Attribute Summary collapse
-
#api_token ⇒ Object
writeonly
Sets the attribute api_token.
-
#base_url ⇒ String
Returns the API URL that each HTTP request is sent to.
-
#user_agent ⇒ String
Returns the user agent header sent in each HTTP request.
Instance Method Summary collapse
-
#api_token? ⇒ Boolean
Returns true if the API access token is set.
-
#get(url_slug, max_redirects = 10) ⇒ String
Sends a HTTP-get request to the Camdram API.
-
#user_agent? ⇒ Boolean
Returns true if the User Agent string is set.
Instance Attribute Details
#api_token=(value) ⇒ Object (writeonly)
Sets the attribute api_token
9 10 11 |
# File 'lib/camdram/http.rb', line 9 def api_token=(value) @api_token = value end |
Instance Method Details
#api_token? ⇒ Boolean
Returns true if the API access token is set
26 27 28 |
# File 'lib/camdram/http.rb', line 26 def api_token? !@api_token.nil? && !(blank?(@api_token)) end |
#get(url_slug, max_redirects = 10) ⇒ String
Sends a HTTP-get request to the Camdram API
17 18 19 20 21 |
# File 'lib/camdram/http.rb', line 17 def get(url_slug, max_redirects = 10) url = base_url + url_slug uri = URI(url) inner_get(uri, max_redirects) end |
#user_agent? ⇒ Boolean
Returns true if the User Agent string is set
33 34 35 |
# File 'lib/camdram/http.rb', line 33 def user_agent? !@user_agent.nil? && !(blank?(@user_agent)) end |