module Particle::Client::OAuthClients

Client methods for the Particle OAuth client API

@see docs.particle.io/reference/api/#oauth-clients

Public Instance Methods

create_oauth_client(attributes) click to toggle source

Create a Particle OAuth client

@param options [Hash] Options to configure the client @return [OAuthClient] An OAuth client object to interact with

# 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) click to toggle source

Create a domain model for a Particle OAuth client

@param target [String, Hash, OAuthClient] A client id, hash of attributes or {OAuthClient} object @return [OAuthClient] A OAuth client object to interact with

# 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() click to toggle source

List all Particle OAuth clients on the account

@return [Array<OAuthClient>] List of Particle OAuth clients to interact with

# 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) click to toggle source

Remove a Particle OAuth client

@param target [String, OAuthClient] A client id or {OAuthClient} object @return [boolean] true for success

# File lib/particle/client/oauth_clients.rb, line 46
def remove_oauth_client(target)
  delete(oauth_client(target).path)
  true
end