Module: Metricsbot

Includes:
HTTParty
Defined in:
lib/domaintally/domain.rb,
lib/domaintally/ranking.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.api_access_tokenObject

Returns the value of attribute api_access_token.



4
5
6
# File 'lib/domaintally/domain.rb', line 4

def api_access_token
  @api_access_token
end

Class Method Details

.domain(domain) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/domaintally/domain.rb', line 11

def self.domain(domain)
  params = {
    :access_token => api_access_token,
    :domain => domain
  }

  body = get('/domain/', :query => params).parsed_response

  if body['meta']['code'] == 200
    body
  else
    raise ArgumentError, body['meta']['errorDetail']
  end
end

.ranking(domain) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/domaintally/ranking.rb', line 11

def self.ranking(domain)
  params = {
    :access_token => api_access_token,
    :domain => domain
  }

  body = get('/ranking/', :query => params).parsed_response

  if body['meta']['code'] == 200
    body
  else
    raise ArgumentError, body['meta']['errorDetail']
  end
end