Class: Twelve::API::Clients::Proxy

Inherits:
ResourceProxy show all
Defined in:
lib/twelve/api/clients.rb

Overview

Clients::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

Methods inherited from ResourceProxy

#initialize, #method_missing

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 an API client

attributes - Hash of attributes

Returns json



22
23
24
# File 'lib/twelve/api/clients.rb', line 22

def create(attributes)
  connection.post(path_prefix, attributes).body['client']
end

#destroyObject

Deletes an API client

key - String of key

Returns json



32
33
34
# File 'lib/twelve/api/clients.rb', line 32

def destroy
  connection.delete(path_prefix).body['client']
end

#subjectObject

Get API clients

Returns json



40
41
42
# File 'lib/twelve/api/clients.rb', line 40

def subject
  @subject ||= connection.get(path_prefix).body['clients']
end