Class: Digto::Client
- Inherits:
-
Object
- Object
- Digto::Client
- Defined in:
- lib/digto.rb
Overview
Client
Instance Attribute Summary collapse
-
#api_host ⇒ Object
Returns the value of attribute api_host.
-
#scheme ⇒ Object
Returns the value of attribute scheme.
-
#subdomain ⇒ Object
Returns the value of attribute subdomain.
Instance Method Summary collapse
-
#initialize(subdomain) ⇒ Client
constructor
A new instance of Client.
- #next ⇒ Object
- #public_url ⇒ Object
Constructor Details
#initialize(subdomain) ⇒ Client
11 12 13 14 15 |
# File 'lib/digto.rb', line 11 def initialize(subdomain) @scheme = 'https' @api_host = 'digto.org' @subdomain = subdomain end |
Instance Attribute Details
#api_host ⇒ Object
Returns the value of attribute api_host.
9 10 11 |
# File 'lib/digto.rb', line 9 def api_host @api_host end |
#scheme ⇒ Object
Returns the value of attribute scheme.
9 10 11 |
# File 'lib/digto.rb', line 9 def scheme @scheme end |
#subdomain ⇒ Object
Returns the value of attribute subdomain.
9 10 11 |
# File 'lib/digto.rb', line 9 def subdomain @subdomain end |
Instance Method Details
#next ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/digto.rb', line 21 def next url = "#{@scheme}://#{@api_host}/#{@subdomain}" res = HTTP.get(url) Digto.check_res_err(res) Session.new(url, res) end |
#public_url ⇒ Object
17 18 19 |
# File 'lib/digto.rb', line 17 def public_url "#{@scheme}://#{@subdomain}.#{@api_host}" end |