Class: Twelve::API::Gauges::Proxy
- Inherits:
-
ResourceProxy
- Object
- ResourceProxy
- Twelve::API::Gauges::Proxy
- Includes:
- Content, Engines, Locations, Referrers, Resolutions, Shares, Technology, Terms, Traffic
- Defined in:
- lib/twelve/api/gauges.rb
Overview
Gauges::Proxy inherits from Twelve::Proxy and enables defining methods on the proxy object
Instance Attribute Summary
Attributes inherited from ResourceProxy
#attributes, #connection, #path_prefix
Instance Method Summary collapse
-
#create(attributes) ⇒ Object
Creates a gauge.
-
#destroy ⇒ Object
Deletes a gauge.
-
#subject ⇒ Object
Get gauges, gauge, or update gauge.
Methods included from Locations
Methods included from Engines
Methods included from Terms
Methods included from Technology
Methods included from Resolutions
Methods included from Traffic
Methods included from Referrers
Methods included from Content
Methods included from Shares
Methods inherited from ResourceProxy
Constructor Details
This class inherits a constructor from Twelve::ResourceProxy
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Twelve::ResourceProxy
Instance Method Details
#create(attributes) ⇒ Object
Creates a gauge
attributes - Hash of attributes
Returns json
31 32 33 |
# File 'lib/twelve/api/gauges.rb', line 31 def create(attributes) connection.post(path_prefix, attributes).body['gauge'] end |
#destroy ⇒ Object
Deletes a gauge
Returns json
39 40 41 |
# File 'lib/twelve/api/gauges.rb', line 39 def destroy connection.delete(path_prefix).body['gauge'] end |
#subject ⇒ Object
Get gauges, gauge, or update gauge
Returns json
47 48 49 50 51 52 53 54 |
# File 'lib/twelve/api/gauges.rb', line 47 def subject response = if attributes connection.put(path_prefix, attributes).body else connection.get(path_prefix).body end @subject ||= path_prefix == '/gauges' ? response['gauges'] : response['gauge'] end |