Class: Gauges

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/gauges.rb,
lib/gauges/version.rb

Constant Summary collapse

VERSION =
'0.2.1'

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Gauges



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

def initialize(options={})
  @options = options
end

Instance Method Details

#clientsObject



22
23
24
# File 'lib/gauges.rb', line 22

def clients
  get('/clients')
end

#content(id, params = {}) ⇒ Object



70
71
72
# File 'lib/gauges.rb', line 70

def content(id, params={})
  get("/gauges/#{id}/content", params)
end

#create_client(params = {}) ⇒ Object

:description => Any text describing what this client is or will be used for (ie: Campfire, GitHub, HipChat…)



27
28
29
# File 'lib/gauges.rb', line 27

def create_client(params={})
  post('/clients', params)
end

#create_gauge(params = {}) ⇒ Object

:title => The title of the gauge (ie: RailsTips) :tz => The time zone stats should be tracked in



41
42
43
# File 'lib/gauges.rb', line 41

def create_gauge(params={})
  post('/gauges', params)
end

#delete_client(id) ⇒ Object



31
32
33
# File 'lib/gauges.rb', line 31

def delete_client(id)
  delete("/clients/#{id}")
end

#delete_gauge(id) ⇒ Object



53
54
55
# File 'lib/gauges.rb', line 53

def delete_gauge(id)
  delete("/gauges/#{id}")
end

#engines(id, params = {}) ⇒ Object



94
95
96
# File 'lib/gauges.rb', line 94

def engines(id, params={})
  get("/gauges/#{id}/engines", params)
end

#gauge(id) ⇒ Object



45
46
47
# File 'lib/gauges.rb', line 45

def gauge(id)
  get("/gauges/#{id}")
end

#gaugesObject



35
36
37
# File 'lib/gauges.rb', line 35

def gauges
  get('/gauges')
end

#locations(id, params = {}) ⇒ Object



98
99
100
# File 'lib/gauges.rb', line 98

def locations(id, params={})
  get("/gauges/#{id}/locations", params)
end

#meObject



13
14
15
# File 'lib/gauges.rb', line 13

def me
  get('/me')
end

#referrers(id, params = {}) ⇒ Object



74
75
76
# File 'lib/gauges.rb', line 74

def referrers(id, params={})
  get("/gauges/#{id}/referrers", params)
end

#resolutions(id, params = {}) ⇒ Object



82
83
84
# File 'lib/gauges.rb', line 82

def resolutions(id, params={})
  get("/gauges/#{id}/resolutions", params)
end

#share(id, params = {}) ⇒ Object

:email => The email of the user to add



62
63
64
# File 'lib/gauges.rb', line 62

def share(id, params={})
  post("/gauges/#{id}/shares", params)
end

#shares(id) ⇒ Object



57
58
59
# File 'lib/gauges.rb', line 57

def shares(id)
  get("/gauges/#{id}/shares")
end

#technology(id, params = {}) ⇒ Object



86
87
88
# File 'lib/gauges.rb', line 86

def technology(id, params={})
  get("/gauges/#{id}/technology", params)
end

#terms(id, params = {}) ⇒ Object



90
91
92
# File 'lib/gauges.rb', line 90

def terms(id, params={})
  get("/gauges/#{id}/terms", params)
end

#tokenObject



102
103
104
# File 'lib/gauges.rb', line 102

def token
  @options[:token]
end

#traffic(id, params = {}) ⇒ Object



78
79
80
# File 'lib/gauges.rb', line 78

def traffic(id, params={})
  get("/gauges/#{id}/traffic", params)
end

#unshare(id, user_id) ⇒ Object



66
67
68
# File 'lib/gauges.rb', line 66

def unshare(id, user_id)
  delete("/gauges/#{id}/shares/#{user_id}")
end

#update_gauge(id, params = {}) ⇒ Object



49
50
51
# File 'lib/gauges.rb', line 49

def update_gauge(id, params={})
  put("/gauges/#{id}", params)
end

#update_me(params = {}) ⇒ Object

:first_name, :last_name



18
19
20
# File 'lib/gauges.rb', line 18

def update_me(params={})
  put('/me', params)
end

#url(url) ⇒ Object



106
107
108
109
# File 'lib/gauges.rb', line 106

def url(url)
  host, *parts = url.gsub(/https?\:\/\//, '').split('/')
  get("/#{parts.join('/')}")
end