Class: StarkCore::Organization
- Inherits:
-
User
- Object
- Utils::SubResource
- Utils::Resource
- User
- StarkCore::Organization
- Defined in:
- lib/user/organization.rb
Overview
# Organization object The Organization object is an authentication entity for the SDK that represents your entire Organization, being able to access any Workspace underneath it and even create new Workspaces. Only a legal representative of your organization can register or change the Organization credentials. All requests to the Stark Bank and Stark Infra API must be authenticated via an SDK user, which must have been previously created at the Stark Bank or Stark Infra websites
before you can use it in this SDK. Organizations may be passed as the user parameter on each request or may be defined as the default user at the start (See README). If you are accessing a specific Workspace using Organization credentials, you should specify the workspace ID when building the Organization object or by request, using the Organization.replace(organization, workspace_id) method, which creates a copy of the organization object with the altered workspace ID. If you are listing or creating new Workspaces, the workspace_id should be nil.
## Parameters (required):
-
environment [string]: environment where the organization is being used. ex: ‘sandbox’ or ‘production’
-
id [string]: unique id required to identify organization. ex: ‘5656565656565656’
-
private_key [string]: PEM string of the private key linked to the organization. ex: ‘—–BEGIN PUBLIC KEY—–nMFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAEyTIHK6jYuik6ktM9FIF3yCEYzpLjO5X/ntqDioGM+R2RyW0QEo+1DG8BrUf4UXHSvCjtQ0yLppygz23z0yPZYfw==n—–END PUBLIC KEY—–’
-
workspace_id [string]: unique id of the accessed Workspace, if any. ex: nil or ‘4848484848484848’
## Attributes (return-only):
-
pem [string]: private key in pem format. ex: ‘—–BEGIN PUBLIC KEY—–nMFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAEyTIHK6jYuik6ktM9FIF3yCEYzpLjO5X/ntqDioGM+R2RyW0QEo+1DG8BrUf4UXHSvCjtQ0yLppygz23z0yPZYfw==n—–END PUBLIC KEY—–’
Instance Attribute Summary collapse
-
#workspace_id ⇒ Object
readonly
Returns the value of attribute workspace_id.
Attributes inherited from User
Attributes inherited from Utils::Resource
Class Method Summary collapse
Instance Method Summary collapse
- #access_id ⇒ Object
-
#initialize(id:, environment:, private_key:, workspace_id: nil) ⇒ Organization
constructor
A new instance of Organization.
Methods inherited from User
Methods inherited from Utils::SubResource
Constructor Details
#initialize(id:, environment:, private_key:, workspace_id: nil) ⇒ Organization
Returns a new instance of Organization.
32 33 34 35 |
# File 'lib/user/organization.rb', line 32 def initialize(id:, environment:, private_key:, workspace_id: nil) super(environment, id, private_key) @workspace_id = workspace_id end |
Instance Attribute Details
#workspace_id ⇒ Object (readonly)
Returns the value of attribute workspace_id.
31 32 33 |
# File 'lib/user/organization.rb', line 31 def workspace_id @workspace_id end |
Class Method Details
.replace(organization, workspace_id) ⇒ Object
43 44 45 46 47 48 49 50 |
# File 'lib/user/organization.rb', line 43 def self.replace(organization, workspace_id) Organization.new( environment: organization.environment, id: organization.id, private_key: organization.pem, workspace_id: workspace_id ) end |
Instance Method Details
#access_id ⇒ Object
37 38 39 40 41 |
# File 'lib/user/organization.rb', line 37 def access_id return "organization/#{@id}/workspace/#{@workspace_id}" if @workspace_id return "organization/#{@id}" end |