Class: Seam::Http::SingleWorkspace

Inherits:
Object
  • Object
show all
Includes:
Routes
Defined in:
lib/seam/http_single_workspace.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Routes

#access_codes, #access_grants, #access_methods, #acs, #action_attempts, #client_sessions, #connect_webviews, #connected_accounts, #customers, #devices, #events, #instant_keys, #locks, #noise_sensors, #phones, #spaces, #thermostats, #unmanaged_access_codes, #unmanaged_devices, #user_identities, #webhooks, #workspaces

Constructor Details

#initialize(client: nil, api_key: nil, personal_access_token: nil, workspace_id: nil, endpoint: nil, wait_for_action_attempt: true, faraday_options: {}, faraday_retry_options: {}) ⇒ SingleWorkspace

Returns a new instance of SingleWorkspace.



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/seam/http_single_workspace.rb', line 19

def initialize(client: nil, api_key: nil, personal_access_token: nil, workspace_id: nil, endpoint: nil,
  wait_for_action_attempt: true, faraday_options: {}, faraday_retry_options: {})
  options = Http::Options.parse_options(api_key: api_key, personal_access_token: personal_access_token,
    workspace_id: workspace_id, endpoint: endpoint)
  @endpoint = options[:endpoint]
  @auth_headers = options[:auth_headers]
  @defaults = Seam::DeepHashAccessor.new({"wait_for_action_attempt" => wait_for_action_attempt})
  @client = client || Http::Request.create_faraday_client(@endpoint, @auth_headers, faraday_options,
    faraday_retry_options)

  initialize_routes(client: @client, defaults: @defaults)
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



17
18
19
# File 'lib/seam/http_single_workspace.rb', line 17

def client
  @client
end

#defaultsObject (readonly)

Returns the value of attribute defaults.



17
18
19
# File 'lib/seam/http_single_workspace.rb', line 17

def defaults
  @defaults
end

Class Method Details

.from_api_key(api_key, endpoint: nil, wait_for_action_attempt: false, faraday_options: {}, faraday_retry_options: {}) ⇒ Object



40
41
42
43
# File 'lib/seam/http_single_workspace.rb', line 40

def self.from_api_key(api_key, endpoint: nil, wait_for_action_attempt: false, faraday_options: {}, faraday_retry_options: {})
  new(api_key: api_key, endpoint: endpoint, wait_for_action_attempt: wait_for_action_attempt,
    faraday_options: faraday_options, faraday_retry_options: faraday_retry_options)
end

.from_personal_access_token(personal_access_token, workspace_id, endpoint: nil, wait_for_action_attempt: false, faraday_options: {}, faraday_retry_options: {}) ⇒ Object



45
46
47
48
# File 'lib/seam/http_single_workspace.rb', line 45

def self.from_personal_access_token(personal_access_token, workspace_id, endpoint: nil, wait_for_action_attempt: false, faraday_options: {}, faraday_retry_options: {})
  new(personal_access_token: personal_access_token, workspace_id: workspace_id, endpoint: endpoint,
    wait_for_action_attempt: wait_for_action_attempt, faraday_options: faraday_options, faraday_retry_options: faraday_retry_options)
end

Instance Method Details

#create_paginator(request, params = {}) ⇒ Object



36
37
38
# File 'lib/seam/http_single_workspace.rb', line 36

def create_paginator(request, params = {})
  Paginator.new(request, params)
end

#lts_versionObject



32
33
34
# File 'lib/seam/http_single_workspace.rb', line 32

def lts_version
  Seam::LTS_VERSION
end