Class: Optify::Client
Instance Method Summary collapse
- #all_sites(options = {}) ⇒ Object
- #all_visitors(site_id, options = {}) ⇒ Object
-
#initialize(access_token) ⇒ Client
constructor
A new instance of Client.
- #site(site_id, options = {}) ⇒ Object
- #visitor(site_id, visitor_id, options = {}) ⇒ Object
- #who_am_i ⇒ Object
Constructor Details
#initialize(access_token) ⇒ Client
Returns a new instance of Client.
9 10 11 |
# File 'lib/optify/client.rb', line 9 def initialize(access_token) self.class.default_params :access_token => access_token end |
Instance Method Details
#all_sites(options = {}) ⇒ Object
13 14 15 16 |
# File 'lib/optify/client.rb', line 13 def all_sites(={}) site_path = "/v1/sites.json" self.class.get(site_path, :query => clean()).parsed_response end |
#all_visitors(site_id, options = {}) ⇒ Object
23 24 25 26 |
# File 'lib/optify/client.rb', line 23 def all_visitors(site_id,={}) site_path = "/v1/sites/#{site_id.to_s}/visitors.json" self.class.get(site_path, :query => clean()).parsed_response end |
#site(site_id, options = {}) ⇒ Object
18 19 20 21 |
# File 'lib/optify/client.rb', line 18 def site(site_id,={}) site_path = "/v1/sites/#{site_id.to_s}.json" self.class.get(site_path, :query => clean()).parsed_response end |
#visitor(site_id, visitor_id, options = {}) ⇒ Object
28 29 30 31 |
# File 'lib/optify/client.rb', line 28 def visitor(site_id,visitor_id, = {}) site_path = "/v1/sites/#{site_id.to_s}/visitors/#{visitor_id.to_s}.json" self.class.get(site_path, :query => clean()).parsed_response end |
#who_am_i ⇒ Object
33 34 35 36 |
# File 'lib/optify/client.rb', line 33 def who_am_i whois_path = "/whoami" self.class.get(whois_path, :format => 'text/plain').parsed_response.chomp end |