Class: Seam::Http::SingleWorkspace
- Inherits:
-
Object
- Object
- Seam::Http::SingleWorkspace
- Includes:
- Routes
- Defined in:
- lib/seam/http_single_workspace.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#defaults ⇒ Object
readonly
Returns the value of attribute defaults.
Class Method Summary collapse
- .from_api_key(api_key, endpoint: nil, wait_for_action_attempt: true, timeout: nil, faraday_options: {}, faraday_retry_options: {}) ⇒ Object
- .from_personal_access_token(personal_access_token, workspace_id, endpoint: nil, wait_for_action_attempt: true, timeout: nil, faraday_options: {}, faraday_retry_options: {}) ⇒ Object
Instance Method Summary collapse
- #create_paginator(request, params = {}) ⇒ Object
-
#initialize(client: nil, api_key: OPTION_NOT_PROVIDED, personal_access_token: OPTION_NOT_PROVIDED, workspace_id: OPTION_NOT_PROVIDED, endpoint: OPTION_NOT_PROVIDED, wait_for_action_attempt: OPTION_NOT_PROVIDED, timeout: OPTION_NOT_PROVIDED, faraday_options: OPTION_NOT_PROVIDED, faraday_retry_options: OPTION_NOT_PROVIDED) ⇒ SingleWorkspace
constructor
A new instance of SingleWorkspace.
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: OPTION_NOT_PROVIDED, personal_access_token: OPTION_NOT_PROVIDED, workspace_id: OPTION_NOT_PROVIDED, endpoint: OPTION_NOT_PROVIDED, wait_for_action_attempt: OPTION_NOT_PROVIDED, timeout: OPTION_NOT_PROVIDED, faraday_options: OPTION_NOT_PROVIDED, faraday_retry_options: OPTION_NOT_PROVIDED) ⇒ SingleWorkspace
Returns a new instance of SingleWorkspace.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/seam/http_single_workspace.rb', line 22 def initialize(client: nil, api_key: OPTION_NOT_PROVIDED, personal_access_token: OPTION_NOT_PROVIDED, workspace_id: OPTION_NOT_PROVIDED, endpoint: OPTION_NOT_PROVIDED, wait_for_action_attempt: OPTION_NOT_PROVIDED, timeout: OPTION_NOT_PROVIDED, faraday_options: OPTION_NOT_PROVIDED, faraday_retry_options: OPTION_NOT_PROVIDED) = { api_key: api_key, personal_access_token: personal_access_token, workspace_id: workspace_id, endpoint: endpoint, wait_for_action_attempt: wait_for_action_attempt, timeout: timeout, faraday_options: , faraday_retry_options: }.reject { |_, value| value.equal?(OPTION_NOT_PROVIDED) } = .keys - [:wait_for_action_attempt] if client && .any? raise Http::Options::SeamInvalidOptionsError.new( "The client option cannot be used with any other option, but received: #{.keys.join(", ")}" ) end wait_for_action_attempt = true if wait_for_action_attempt.equal?(OPTION_NOT_PROVIDED) @defaults = Seam::DeepHashAccessor.new({"wait_for_action_attempt" => wait_for_action_attempt}) # A client carries its own endpoint and authorization, so the auth # options are only parsed when one has to be built. @client = client || begin api_key = nil if api_key.equal?(OPTION_NOT_PROVIDED) personal_access_token = nil if personal_access_token.equal?(OPTION_NOT_PROVIDED) workspace_id = nil if workspace_id.equal?(OPTION_NOT_PROVIDED) endpoint = nil if endpoint.equal?(OPTION_NOT_PROVIDED) timeout = nil if timeout.equal?(OPTION_NOT_PROVIDED) = {} if .equal?(OPTION_NOT_PROVIDED) = {} if .equal?(OPTION_NOT_PROVIDED) = Http::Options.(api_key: api_key, personal_access_token: personal_access_token, workspace_id: workspace_id, endpoint: endpoint) @endpoint = [:endpoint] @auth_headers = [:auth_headers] Http::Request.create_faraday_client(@endpoint, @auth_headers, , , timeout: timeout) end initialize_routes(client: @client, defaults: @defaults) end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
17 18 19 |
# File 'lib/seam/http_single_workspace.rb', line 17 def client @client end |
#defaults ⇒ Object (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: true, timeout: nil, faraday_options: {}, faraday_retry_options: {}) ⇒ Object
74 75 76 77 |
# File 'lib/seam/http_single_workspace.rb', line 74 def self.from_api_key(api_key, endpoint: nil, wait_for_action_attempt: true, timeout: nil, faraday_options: {}, faraday_retry_options: {}) new(api_key: api_key, endpoint: endpoint, wait_for_action_attempt: wait_for_action_attempt, timeout: timeout, faraday_options: , faraday_retry_options: ) end |
.from_personal_access_token(personal_access_token, workspace_id, endpoint: nil, wait_for_action_attempt: true, timeout: nil, faraday_options: {}, faraday_retry_options: {}) ⇒ Object
79 80 81 82 |
# File 'lib/seam/http_single_workspace.rb', line 79 def self.from_personal_access_token(personal_access_token, workspace_id, endpoint: nil, wait_for_action_attempt: true, timeout: nil, 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, timeout: timeout, faraday_options: , faraday_retry_options: ) end |