Class: Digto::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/digto.rb

Overview

Client

Instance Attribute Summary collapse

Instance Method Summary collapse

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_hostObject

Returns the value of attribute api_host.



9
10
11
# File 'lib/digto.rb', line 9

def api_host
  @api_host
end

#schemeObject

Returns the value of attribute scheme.



9
10
11
# File 'lib/digto.rb', line 9

def scheme
  @scheme
end

#subdomainObject

Returns the value of attribute subdomain.



9
10
11
# File 'lib/digto.rb', line 9

def subdomain
  @subdomain
end

Instance Method Details

#nextObject



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_urlObject



17
18
19
# File 'lib/digto.rb', line 17

def public_url
  "#{@scheme}://#{@subdomain}.#{@api_host}"
end