Module: Particle::Client::OAuthClients
- Included in:
- Particle::Client
- Defined in:
- lib/particle/client/oauth_clients.rb
Overview
Client methods for the Particle OAuth client API
Instance Method Summary collapse
-
#create_oauth_client(attributes) ⇒ OAuthClient
Create a Particle OAuth client.
-
#oauth_client(target) ⇒ OAuthClient
Create a domain model for a Particle OAuth client.
-
#oauth_clients ⇒ Array<OAuthClient>
List all Particle OAuth clients on the account.
-
#remove_oauth_client(target) ⇒ boolean
Remove a Particle OAuth client.
Instance Method Details
#create_oauth_client(attributes) ⇒ OAuthClient
Create a Particle OAuth client
37 38 39 40 |
# File 'lib/particle/client/oauth_clients.rb', line 37 def create_oauth_client(attributes) result = post(OAuthClient.create_path, attributes) oauth_client(result[:client]) end |
#oauth_client(target) ⇒ OAuthClient
Create a domain model for a Particle OAuth client
15 16 17 18 19 20 21 |
# File 'lib/particle/client/oauth_clients.rb', line 15 def oauth_client(target) if target.is_a? OAuthClient target else OAuthClient.new(self, target) end end |
#oauth_clients ⇒ Array<OAuthClient>
List all Particle OAuth clients on the account
26 27 28 29 30 31 |
# File 'lib/particle/client/oauth_clients.rb', line 26 def oauth_clients result = get(OAuthClient.list_path) result[:clients].map do |attributes| oauth_client(attributes) end end |
#remove_oauth_client(target) ⇒ boolean
Remove a Particle OAuth client
46 47 48 49 |
# File 'lib/particle/client/oauth_clients.rb', line 46 def remove_oauth_client(target) delete(oauth_client(target).path) true end |