Module: Codelocks
- Defined in:
- lib/codelocks.rb,
lib/codelocks/lock.rb,
lib/codelocks/request.rb,
lib/codelocks/version.rb,
lib/codelocks/net_code.rb,
lib/codelocks/response.rb
Defined Under Namespace
Classes: CodelocksError, Lock, NetCode, Request, Response
Constant Summary collapse
- VERSION =
"2.0.1"
Class Attribute Summary collapse
-
.access_key ⇒ String
Return the access key.
-
.api_key ⇒ String
Return the configured API key or raise an exception.
-
.base_uri ⇒ String
The base URI used for API request.
Class Method Summary collapse
-
.connection ⇒ Faraday
Faraday connection object.
Class Attribute Details
.access_key ⇒ String
Return the access key. This is tied to the K3 Connect App. This can be nil, as for certain models of locks you will provide a 6 digit ID instead.
36 37 38 |
# File 'lib/codelocks.rb', line 36 def access_key @access_key || ENV['CODELOCKS_ACCESS_KEY'] end |
.api_key ⇒ String
Return the configured API key or raise an exception
27 28 29 |
# File 'lib/codelocks.rb', line 27 def api_key @api_key || ENV['CODELOCKS_API_KEY'] || (raise CodelocksError.new("No API key specified")) end |
.base_uri ⇒ String
The base URI used for API request
19 20 21 |
# File 'lib/codelocks.rb', line 19 def base_uri @base_uri || ENV['CODELOCKS_BASE_URI'] || (raise CodelocksError.new("No base URI specified")) end |
Class Method Details
.connection ⇒ Faraday
Faraday connection object
44 45 46 47 48 49 50 |
# File 'lib/codelocks.rb', line 44 def connection @connection ||= Faraday.new(url: base_uri) do |faraday| faraday.request :url_encoded faraday.response :logger faraday.adapter Faraday.default_adapter end end |