Class: WeConnect::API

Inherits:
Object
  • Object
show all
Includes:
Authentication, Connection, WrAPI::Authentication, WrAPI::Connection, WrAPI::Request
Defined in:
lib/weconnect/api.rb

Direct Known Subclasses

Client

Constant Summary

Constants included from Authentication

WeConnect::Authentication::REFRESH_URL, WeConnect::Authentication::TOKENS, WeConnect::Authentication::TOKEN_URL

Instance Method Summary collapse

Methods included from Authentication

#api_process_token, #auth_tokens, #login, #refresh_token

Methods included from Connection

#reauth_connection

Constructor Details

#initialize(options = {}) ⇒ API

Creates a new API and copies settings from singleton



14
15
16
17
18
19
# File 'lib/weconnect/api.rb', line 14

def initialize(options = {})
  options = WeConnect.options.merge(options)
  WrAPI::Configuration::VALID_OPTIONS_KEYS.each do |key|
    send("#{key}=", options[key])
  end
end

Instance Method Details

#configObject



21
22
23
24
25
26
27
# File 'lib/weconnect/api.rb', line 21

def config
  conf = {}
  WrAPI::Configuration::VALID_OPTIONS_KEYS.each do |key|
    conf[key] = send key
  end
  conf
end