class Particle::Client

Client for the Particle API

@see docs.particle.io/

Public Class Methods

new(options = {}) click to toggle source
# File lib/particle/client.rb, line 32
def initialize(options = {})
  # Use options passed in, but fall back to module defaults
  Particle::Configurable.keys.each do |key|
    instance_variable_set(:"@#{key}", options[key] || Particle.instance_variable_get(:"@#{key}"))
  end
end

Public Instance Methods

access_token=(value) click to toggle source

Set OAuth2 access token for authentication

@param value [String] 40 character Particle OAuth2 access token

# File lib/particle/client.rb, line 56
def access_token=(value)
  reset_connection
  @access_token =
    if value.respond_to? :access_token
      value.access_token
    else
      value
    end
end
inspect() click to toggle source

Text representation of the client, masking tokens

@return [String]

Calls superclass method
# File lib/particle/client.rb, line 42
def inspect
  inspected = super

  # Only show last 4 of token, secret
  if @access_token
    inspected = inspected.gsub! @access_token, "#{'*'*36}#{@access_token[36..-1]}"
  end

  inspected
end