Class: Seam::Http::WithoutWorkspace
- Inherits:
-
Object
- Object
- Seam::Http::WithoutWorkspace
- Defined in:
- lib/seam/http_without_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
Instance Method Summary collapse
-
#initialize(client: nil, personal_access_token: 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) ⇒ WithoutWorkspace
constructor
A new instance of WithoutWorkspace.
- #workspaces ⇒ Object
Constructor Details
#initialize(client: nil, personal_access_token: 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) ⇒ WithoutWorkspace
Returns a new instance of WithoutWorkspace.
19 20 21 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 |
# File 'lib/seam/http_without_workspace.rb', line 19 def initialize(client: nil, personal_access_token: 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) = { personal_access_token: personal_access_token, 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) @wait_for_action_attempt = wait_for_action_attempt @defaults = {"wait_for_action_attempt" => wait_for_action_attempt} @client = client || begin personal_access_token = nil if personal_access_token.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.(personal_access_token: personal_access_token, endpoint: endpoint) @endpoint = [:endpoint] @auth_headers = [:auth_headers] Http::Request.create_faraday_client(@endpoint, @auth_headers, , , timeout: timeout) end end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
14 15 16 |
# File 'lib/seam/http_without_workspace.rb', line 14 def client @client end |
#defaults ⇒ Object (readonly)
Returns the value of attribute defaults.
14 15 16 |
# File 'lib/seam/http_without_workspace.rb', line 14 def defaults @defaults end |
Class Method Details
.from_personal_access_token(personal_access_token, endpoint: nil, wait_for_action_attempt: true, timeout: nil, faraday_options: {}, faraday_retry_options: {}) ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/seam/http_without_workspace.rb', line 63 def self.from_personal_access_token(personal_access_token, endpoint: nil, wait_for_action_attempt: true, timeout: nil, faraday_options: {}, faraday_retry_options: {}) new( personal_access_token: personal_access_token, endpoint: endpoint, wait_for_action_attempt: wait_for_action_attempt, timeout: timeout, faraday_options: , faraday_retry_options: ) end |
Instance Method Details
#workspaces ⇒ Object
59 60 61 |
# File 'lib/seam/http_without_workspace.rb', line 59 def workspaces @workspaces ||= WorkspacesProxy.new(Seam::Clients::Workspaces.new(client: @client, defaults: @defaults)) end |