Module: Particle::Default

Defined in:
lib/particle/default.rb

Overview

Default configuration options for Client

Constant Summary collapse

API_ENDPOINT =
"https://api.particle.io".freeze
USER_AGENT =
"particlerb Ruby gem #{Particle::VERSION}".freeze

Class Method Summary collapse

Class Method Details

.access_tokenObject



23
24
25
# File 'lib/particle/default.rb', line 23

def access_token
  ENV['PARTICLE_ACCESS_TOKEN']
end

.api_endpointObject



19
20
21
# File 'lib/particle/default.rb', line 19

def api_endpoint
  ENV['PARTICLE_API_ENDPOINT'] || API_ENDPOINT
end

.connection_optionsHash

Default options for Faraday::Connection

Returns:

  • (Hash)


29
30
31
32
33
34
35
# File 'lib/particle/default.rb', line 29

def connection_options
  {
    :headers => {
      :user_agent => user_agent
    }
  }
end

.optionsHash

Configuration options

Returns:

  • (Hash)


15
16
17
# File 'lib/particle/default.rb', line 15

def options
  Hash[Particle::Configurable.keys.map { |key| [key, send(key)] }]
end

.user_agentString

Default User-Agent header string from USER_AGENT

Returns:

  • (String)


39
40
41
# File 'lib/particle/default.rb', line 39

def user_agent
  USER_AGENT
end