seatschart 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +44 -9
- data/lib/seatschart/api/audit_api.rb +2 -2
- data/lib/seatschart/api/auth_api.rb +4 -4
- data/lib/seatschart/api/billing_api.rb +93 -12
- data/lib/seatschart/api/charts_api.rb +52 -52
- data/lib/seatschart/api/events_api.rb +110 -104
- data/lib/seatschart/api/seasons_api.rb +88 -88
- data/lib/seatschart/api/seats_api.rb +6 -6
- data/lib/seatschart/api/usage_api.rb +4 -4
- data/lib/seatschart/api/workspace_api.rb +52 -40
- data/lib/seatschart/models/{api_error.rb → api_error_body.rb} +7 -7
- data/lib/seatschart/models/delete_api_workspaces_by_workspace_id_members_by_user_id200_response.rb +221 -0
- data/lib/seatschart/models/get_api_workspaces_by_workspace_id_invitations200_response.rb +239 -0
- data/lib/seatschart/models/get_api_workspaces_by_workspace_id_invitations200_response_invitations_inner.rb +286 -0
- data/lib/seatschart/models/get_api_workspaces_by_workspace_id_members200_response.rb +239 -0
- data/lib/seatschart/models/get_api_workspaces_by_workspace_id_members200_response_members_inner.rb +288 -0
- data/lib/seatschart/models/get_api_workspaces_overview200_response.rb +288 -0
- data/lib/seatschart/models/get_api_workspaces_overview200_response_account.rb +270 -0
- data/lib/seatschart/models/get_api_workspaces_overview200_response_account_charts.rb +233 -0
- data/lib/seatschart/models/get_api_workspaces_overview200_response_account_plan.rb +237 -0
- data/lib/seatschart/models/get_api_workspaces_overview200_response_items_inner.rb +439 -0
- data/lib/seatschart/models/get_api_workspaces_overview200_response_items_inner_revenue.rb +234 -0
- data/lib/seatschart/models/get_api_workspaces_overview200_response_items_inner_usage.rb +271 -0
- data/lib/seatschart/models/get_api_workspaces_overview200_response_seats.rb +431 -0
- data/lib/seatschart/models/get_api_workspaces_overview200_response_seats_overage.rb +233 -0
- data/lib/seatschart/models/get_api_workspaces_overview200_response_seats_projected.rb +237 -0
- data/lib/seatschart/models/get_api_workspaces_overview200_response_totals.rb +318 -0
- data/lib/seatschart/models/get_api_workspaces_overview200_response_totals_revenue.rb +238 -0
- data/lib/seatschart/models/get_api_workspaces_overview200_response_totals_seats.rb +253 -0
- data/lib/seatschart/models/post_api_billing_actions_change_plan_request.rb +256 -0
- data/lib/seatschart/models/post_api_events_by_event_id_actions_update_extra_data_request_objects_inner.rb +0 -2
- data/lib/seatschart/models/post_api_sandboxes201_response.rb +0 -4
- data/lib/seatschart/models/post_api_sandboxes_by_sandbox_id_actions_reset200_response.rb +0 -2
- data/lib/seatschart/models/post_api_workspaces200_response.rb +0 -4
- data/lib/seatschart/models/post_api_workspaces_by_workspace_id_invitations201_response.rb +238 -0
- data/lib/seatschart/models/post_api_workspaces_by_workspace_id_invitations201_response_invitation.rb +286 -0
- data/lib/seatschart/version.rb +1 -1
- data/lib/seatschart/workspaces.rb +172 -0
- data/lib/seatschart.rb +23 -3
- metadata +25 -5
- data/lib/seatschart/models/get_api_workspaces_created_by_api_parameter.rb +0 -103
- data/lib/seatschart/models/get_api_workspaces_overview_created_by_api_parameter.rb +0 -103
data/lib/seatschart/models/post_api_workspaces_by_workspace_id_invitations201_response_invitation.rb
ADDED
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#SeatsChart API
|
|
3
|
+
|
|
4
|
+
#Seat inventory and locking API for B2B2C integrations. Authenticate using `x-api-key` (partners) or `Authorization: Bearer` with an HS256 JWT.
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.11.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module SeatsChart
|
|
17
|
+
class PostApiWorkspacesByWorkspaceIdInvitations201ResponseInvitation
|
|
18
|
+
attr_accessor :id
|
|
19
|
+
|
|
20
|
+
attr_accessor :email
|
|
21
|
+
|
|
22
|
+
# Workspace role: `admin`, `map_editor` or `viewer`.
|
|
23
|
+
attr_accessor :role
|
|
24
|
+
|
|
25
|
+
attr_accessor :expires_at
|
|
26
|
+
|
|
27
|
+
attr_accessor :workspace_name
|
|
28
|
+
|
|
29
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
30
|
+
def self.attribute_map
|
|
31
|
+
{
|
|
32
|
+
:'id' => :'id',
|
|
33
|
+
:'email' => :'email',
|
|
34
|
+
:'role' => :'role',
|
|
35
|
+
:'expires_at' => :'expiresAt',
|
|
36
|
+
:'workspace_name' => :'workspaceName'
|
|
37
|
+
}
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Returns all the JSON keys this model knows about
|
|
41
|
+
def self.acceptable_attributes
|
|
42
|
+
attribute_map.values
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Attribute type mapping.
|
|
46
|
+
def self.openapi_types
|
|
47
|
+
{
|
|
48
|
+
:'id' => :'String',
|
|
49
|
+
:'email' => :'String',
|
|
50
|
+
:'role' => :'String',
|
|
51
|
+
:'expires_at' => :'Time',
|
|
52
|
+
:'workspace_name' => :'String'
|
|
53
|
+
}
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# List of attributes with nullable: true
|
|
57
|
+
def self.openapi_nullable
|
|
58
|
+
Set.new([
|
|
59
|
+
])
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# Initializes the object
|
|
63
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
64
|
+
def initialize(attributes = {})
|
|
65
|
+
if (!attributes.is_a?(Hash))
|
|
66
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `SeatsChart::PostApiWorkspacesByWorkspaceIdInvitations201ResponseInvitation` initialize method"
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
70
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
71
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
72
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `SeatsChart::PostApiWorkspacesByWorkspaceIdInvitations201ResponseInvitation`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
73
|
+
end
|
|
74
|
+
h[k.to_sym] = v
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if attributes.key?(:'id')
|
|
78
|
+
self.id = attributes[:'id']
|
|
79
|
+
else
|
|
80
|
+
self.id = nil
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
if attributes.key?(:'email')
|
|
84
|
+
self.email = attributes[:'email']
|
|
85
|
+
else
|
|
86
|
+
self.email = nil
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
if attributes.key?(:'role')
|
|
90
|
+
self.role = attributes[:'role']
|
|
91
|
+
else
|
|
92
|
+
self.role = nil
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
if attributes.key?(:'expires_at')
|
|
96
|
+
self.expires_at = attributes[:'expires_at']
|
|
97
|
+
else
|
|
98
|
+
self.expires_at = nil
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
if attributes.key?(:'workspace_name')
|
|
102
|
+
self.workspace_name = attributes[:'workspace_name']
|
|
103
|
+
else
|
|
104
|
+
self.workspace_name = nil
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
109
|
+
# @return Array for valid properties with the reasons
|
|
110
|
+
def list_invalid_properties
|
|
111
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
112
|
+
invalid_properties = Array.new
|
|
113
|
+
if @id.nil?
|
|
114
|
+
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
if @email.nil?
|
|
118
|
+
invalid_properties.push('invalid value for "email", email cannot be nil.')
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
if @role.nil?
|
|
122
|
+
invalid_properties.push('invalid value for "role", role cannot be nil.')
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
if @expires_at.nil?
|
|
126
|
+
invalid_properties.push('invalid value for "expires_at", expires_at cannot be nil.')
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
if @workspace_name.nil?
|
|
130
|
+
invalid_properties.push('invalid value for "workspace_name", workspace_name cannot be nil.')
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
invalid_properties
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
# Check to see if the all the properties in the model are valid
|
|
137
|
+
# @return true if the model is valid
|
|
138
|
+
def valid?
|
|
139
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
140
|
+
return false if @id.nil?
|
|
141
|
+
return false if @email.nil?
|
|
142
|
+
return false if @role.nil?
|
|
143
|
+
return false if @expires_at.nil?
|
|
144
|
+
return false if @workspace_name.nil?
|
|
145
|
+
true
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
# Checks equality by comparing each attribute.
|
|
149
|
+
# @param [Object] Object to be compared
|
|
150
|
+
def ==(o)
|
|
151
|
+
return true if self.equal?(o)
|
|
152
|
+
self.class == o.class &&
|
|
153
|
+
id == o.id &&
|
|
154
|
+
email == o.email &&
|
|
155
|
+
role == o.role &&
|
|
156
|
+
expires_at == o.expires_at &&
|
|
157
|
+
workspace_name == o.workspace_name
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
# @see the `==` method
|
|
161
|
+
# @param [Object] Object to be compared
|
|
162
|
+
def eql?(o)
|
|
163
|
+
self == o
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
# Calculates hash code according to all attributes.
|
|
167
|
+
# @return [Integer] Hash code
|
|
168
|
+
def hash
|
|
169
|
+
[id, email, role, expires_at, workspace_name].hash
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
# Builds the object from hash
|
|
173
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
174
|
+
# @return [Object] Returns the model itself
|
|
175
|
+
def self.build_from_hash(attributes)
|
|
176
|
+
return nil unless attributes.is_a?(Hash)
|
|
177
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
178
|
+
transformed_hash = {}
|
|
179
|
+
openapi_types.each_pair do |key, type|
|
|
180
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
181
|
+
transformed_hash["#{key}"] = nil
|
|
182
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
183
|
+
# check to ensure the input is an array given that the attribute
|
|
184
|
+
# is documented as an array but the input is not
|
|
185
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
186
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
187
|
+
end
|
|
188
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
189
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
190
|
+
end
|
|
191
|
+
end
|
|
192
|
+
new(transformed_hash)
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
# Deserializes the data based on type
|
|
196
|
+
# @param string type Data type
|
|
197
|
+
# @param string value Value to be deserialized
|
|
198
|
+
# @return [Object] Deserialized data
|
|
199
|
+
def self._deserialize(type, value)
|
|
200
|
+
case type.to_sym
|
|
201
|
+
when :Time
|
|
202
|
+
Time.parse(value)
|
|
203
|
+
when :Date
|
|
204
|
+
Date.parse(value)
|
|
205
|
+
when :String
|
|
206
|
+
value.to_s
|
|
207
|
+
when :Integer
|
|
208
|
+
value.to_i
|
|
209
|
+
when :Float
|
|
210
|
+
value.to_f
|
|
211
|
+
when :Boolean
|
|
212
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
213
|
+
true
|
|
214
|
+
else
|
|
215
|
+
false
|
|
216
|
+
end
|
|
217
|
+
when :Object
|
|
218
|
+
# generic object (usually a Hash), return directly
|
|
219
|
+
value
|
|
220
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
221
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
222
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
223
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
224
|
+
k_type = Regexp.last_match[:k_type]
|
|
225
|
+
v_type = Regexp.last_match[:v_type]
|
|
226
|
+
{}.tap do |hash|
|
|
227
|
+
value.each do |k, v|
|
|
228
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
229
|
+
end
|
|
230
|
+
end
|
|
231
|
+
else # model
|
|
232
|
+
# models (e.g. Pet) or oneOf
|
|
233
|
+
klass = SeatsChart.const_get(type)
|
|
234
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
235
|
+
end
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
# Returns the string representation of the object
|
|
239
|
+
# @return [String] String presentation of the object
|
|
240
|
+
def to_s
|
|
241
|
+
to_hash.to_s
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
245
|
+
# @return [Hash] Returns the object in the form of hash
|
|
246
|
+
def to_body
|
|
247
|
+
to_hash
|
|
248
|
+
end
|
|
249
|
+
|
|
250
|
+
# Returns the object in the form of hash
|
|
251
|
+
# @return [Hash] Returns the object in the form of hash
|
|
252
|
+
def to_hash
|
|
253
|
+
hash = {}
|
|
254
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
255
|
+
value = self.send(attr)
|
|
256
|
+
if value.nil?
|
|
257
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
258
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
259
|
+
end
|
|
260
|
+
|
|
261
|
+
hash[param] = _to_hash(value)
|
|
262
|
+
end
|
|
263
|
+
hash
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
# Outputs non-array value in the form of hash
|
|
267
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
268
|
+
# @param [Object] value Any valid value
|
|
269
|
+
# @return [Hash] Returns the value in the form of hash
|
|
270
|
+
def _to_hash(value)
|
|
271
|
+
if value.is_a?(Array)
|
|
272
|
+
value.compact.map { |v| _to_hash(v) }
|
|
273
|
+
elsif value.is_a?(Hash)
|
|
274
|
+
{}.tap do |hash|
|
|
275
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
276
|
+
end
|
|
277
|
+
elsif value.respond_to? :to_hash
|
|
278
|
+
value.to_hash
|
|
279
|
+
else
|
|
280
|
+
value
|
|
281
|
+
end
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
end
|
|
285
|
+
|
|
286
|
+
end
|
data/lib/seatschart/version.rb
CHANGED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# One workspace per organizer (ticketing platforms) for the SeatsChart Ruby client.
|
|
4
|
+
# Copied into the generated gem (lib/seatschart/workspaces.rb) and required from lib/seatschart.rb by
|
|
5
|
+
# scripts/generate-server-sdks.sh.
|
|
6
|
+
#
|
|
7
|
+
# A platform operates every organizer workspace it administers with one workspace admin key:
|
|
8
|
+
#
|
|
9
|
+
# org = SeatsChart.for_workspace('org-1042') # every call sends X-Workspace-Key: org-1042
|
|
10
|
+
# SeatsChart::EmbedApi.new(org).post_api_embed_tokens(...)
|
|
11
|
+
# workspaces = SeatsChart::Workspaces.new
|
|
12
|
+
# created = workspaces.create({ displayName: 'Teatro Aurora', externalId: 'org-1042',
|
|
13
|
+
# templateWorkspaceId: 'org-template', issueKey: { name: 'Server key' } },
|
|
14
|
+
# idempotency_key: 'provision-org-1042')
|
|
15
|
+
# workspaces.list_all_overview(created_by_api: true).each { |row| puts row.external_id }
|
|
16
|
+
#
|
|
17
|
+
# Bodies are the generated request models or hashes with the API's JSON field names. Every workspace_id argument also
|
|
18
|
+
# takes the external id you gave the workspace.
|
|
19
|
+
require 'securerandom'
|
|
20
|
+
|
|
21
|
+
module SeatsChart
|
|
22
|
+
WORKSPACE_KEY_HEADER = 'X-Workspace-Key'
|
|
23
|
+
|
|
24
|
+
# A copy of api_client (default: ApiClient.default) whose every call carries X-Workspace-Key and acts exactly as that
|
|
25
|
+
# workspace's own full-access key would (its rate limits, usage and audit trail). The original is unchanged; both
|
|
26
|
+
# share the configuration and the retry policy. Ordinary keys get 403 ERR_WORKSPACE_HEADER_NOT_ALLOWED; a workspace of
|
|
27
|
+
# another account answers 404.
|
|
28
|
+
def self.for_workspace(id_or_external_id, api_client = nil)
|
|
29
|
+
workspace = id_or_external_id.to_s.strip
|
|
30
|
+
raise ArgumentError, 'for_workspace needs a workspace id or external id' if workspace.empty?
|
|
31
|
+
|
|
32
|
+
client = api_client || ApiClient.default
|
|
33
|
+
scoped = client.dup
|
|
34
|
+
scoped.default_headers = client.default_headers.merge(WORKSPACE_KEY_HEADER => workspace)
|
|
35
|
+
scoped
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# The organizer workspace calls named like the TypeScript SDK (workspaces.create, getByExternalId, keys, members,
|
|
39
|
+
# invitations, overview). The generated WorkspaceApi stays available for every other workspace route.
|
|
40
|
+
class Workspaces
|
|
41
|
+
attr_reader :keys, :members, :invitations
|
|
42
|
+
|
|
43
|
+
def initialize(api_client = nil, api: nil)
|
|
44
|
+
@api = api || WorkspaceApi.new(api_client || ApiClient.default)
|
|
45
|
+
@keys = Keys.new(@api)
|
|
46
|
+
@members = Members.new(@api)
|
|
47
|
+
@invitations = Invitations.new(@api)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# POST /api/workspaces: displayName and, for an organizer, externalId, templateWorkspaceId and issueKey. Always
|
|
51
|
+
# sent with an Idempotency-Key (yours, or a fresh one the retries reuse): a replay returns the same workspace with
|
|
52
|
+
# idempotent_replay true and every secret nil.
|
|
53
|
+
def create(body, idempotency_key: nil)
|
|
54
|
+
key = idempotency_key.to_s.strip.empty? ? SecureRandom.uuid : idempotency_key
|
|
55
|
+
@api.post_api_workspaces(Workspaces.model(:PostApiWorkspacesRequest, body), idempotency_key: key)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def get(workspace_id)
|
|
59
|
+
@api.get_api_workspaces_by_workspace_id(workspace_id)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# The workspace with this external id among the workspaces you belong to (404 otherwise).
|
|
63
|
+
def get_by_external_id(external_id)
|
|
64
|
+
@api.get_api_workspaces_by_external_id_by_external_id(external_id)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# Consolidated overview per workspace and in total. Filters: external_id, status, created_by_api, created_from,
|
|
68
|
+
# created_to, month, limit, cursor.
|
|
69
|
+
def overview(**query)
|
|
70
|
+
@api.get_api_workspaces_overview(query)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# Every overview item matching the filters, page after page (walks next_cursor). Without a block: an Enumerator.
|
|
74
|
+
def list_all_overview(**query, &block)
|
|
75
|
+
return enum_for(:list_all_overview, **query) unless block
|
|
76
|
+
|
|
77
|
+
query.delete(:cursor)
|
|
78
|
+
cursor = nil
|
|
79
|
+
loop do
|
|
80
|
+
page = overview(**query, **(cursor ? { cursor: cursor } : {}))
|
|
81
|
+
Array(Workspaces.field(page, :items)).each(&block)
|
|
82
|
+
cursor = Workspaces.field(page, :next_cursor)
|
|
83
|
+
break if cursor.nil? || cursor.to_s.empty?
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# A hash body (JSON field names) becomes the generated model `name`; a model passes through.
|
|
88
|
+
def self.model(name, body)
|
|
89
|
+
return body unless body.is_a?(Hash)
|
|
90
|
+
|
|
91
|
+
SeatsChart.const_get(name).build_from_hash(body)
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
# Reads a field of a generated model (snake_case reader) or a hash (camelCase JSON name or symbol).
|
|
95
|
+
def self.field(value, name)
|
|
96
|
+
return value.public_send(name) if value.respond_to?(name)
|
|
97
|
+
return nil unless value.is_a?(Hash)
|
|
98
|
+
|
|
99
|
+
camel = name.to_s.gsub(/_([a-z])/) { Regexp.last_match(1).upcase }
|
|
100
|
+
[name, name.to_s, camel, camel.to_sym].each { |k| return value[k] if value.key?(k) }
|
|
101
|
+
nil
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
# API keys of a workspace you administer (workspace admin keys are read only here).
|
|
105
|
+
class Keys
|
|
106
|
+
def initialize(api)
|
|
107
|
+
@api = api
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
def list(workspace_id)
|
|
111
|
+
@api.get_api_workspaces_by_workspace_id_keys(workspace_id)
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
# New ordinary key (full access by default, or scopes); its secret is returned once.
|
|
115
|
+
def create(workspace_id, body)
|
|
116
|
+
@api.post_api_workspaces_by_workspace_id_keys(workspace_id, Workspaces.model(:PostApiWorkspacesByWorkspaceIdKeysRequest, body))
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
# Renames or rescopes a key (next request).
|
|
120
|
+
def update(workspace_id, key_id, body)
|
|
121
|
+
@api.patch_api_workspaces_by_workspace_id_keys_by_key_id(workspace_id, key_id,
|
|
122
|
+
Workspaces.model(:PatchApiWorkspacesByWorkspaceIdKeysByKeyIdRequest, body))
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
# New secret for the same key (returned once); the old one stops at once.
|
|
126
|
+
def rotate(workspace_id, key_id)
|
|
127
|
+
@api.post_api_workspaces_by_workspace_id_keys_by_key_id_actions_rotate(workspace_id, key_id)
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
def revoke(workspace_id, key_id)
|
|
131
|
+
@api.delete_api_workspaces_by_workspace_id_keys_by_key_id(workspace_id, key_id)
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
# Dashboard members of a workspace you administer.
|
|
136
|
+
class Members
|
|
137
|
+
def initialize(api)
|
|
138
|
+
@api = api
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
def list(workspace_id)
|
|
142
|
+
@api.get_api_workspaces_by_workspace_id_members(workspace_id)
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
# Removes a member (not the last admin, not yourself).
|
|
146
|
+
def remove(workspace_id, user_id)
|
|
147
|
+
@api.delete_api_workspaces_by_workspace_id_members_by_user_id(workspace_id, user_id)
|
|
148
|
+
end
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
# Invitations of an organizer's team to the dashboard of its workspace.
|
|
152
|
+
class Invitations
|
|
153
|
+
def initialize(api)
|
|
154
|
+
@api = api
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
def list(workspace_id)
|
|
158
|
+
@api.get_api_workspaces_by_workspace_id_invitations(workspace_id)
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
# Invites { email:, role: } (admin, map_editor or viewer); invite_token is returned once.
|
|
162
|
+
def create(workspace_id, body)
|
|
163
|
+
@api.post_api_workspaces_by_workspace_id_invitations(workspace_id,
|
|
164
|
+
Workspaces.model(:PostApiWorkspacesByWorkspaceIdInvitationsRequest, body))
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
def revoke(workspace_id, invitation_id)
|
|
168
|
+
@api.delete_api_workspaces_by_workspace_id_invitations_by_invitation_id(workspace_id, invitation_id)
|
|
169
|
+
end
|
|
170
|
+
end
|
|
171
|
+
end
|
|
172
|
+
end
|
data/lib/seatschart.rb
CHANGED
|
@@ -17,11 +17,12 @@ require 'seatschart/version'
|
|
|
17
17
|
require 'seatschart/configuration'
|
|
18
18
|
|
|
19
19
|
# Models
|
|
20
|
-
require 'seatschart/models/
|
|
20
|
+
require 'seatschart/models/api_error_body'
|
|
21
21
|
require 'seatschart/models/api_error_params_value'
|
|
22
22
|
require 'seatschart/models/delete_api_sandboxes_by_sandbox_id200_response'
|
|
23
23
|
require 'seatschart/models/delete_api_workspaces_by_workspace_id200_response'
|
|
24
24
|
require 'seatschart/models/delete_api_workspaces_by_workspace_id_keys_by_key_id200_response'
|
|
25
|
+
require 'seatschart/models/delete_api_workspaces_by_workspace_id_members_by_user_id200_response'
|
|
25
26
|
require 'seatschart/models/get_api_charts_by_chart_id_versions200_response'
|
|
26
27
|
require 'seatschart/models/get_api_charts_by_chart_id_versions200_response_items_inner'
|
|
27
28
|
require 'seatschart/models/get_api_charts_by_chart_id_versions200_response_items_inner_published_by'
|
|
@@ -59,10 +60,25 @@ require 'seatschart/models/get_api_workspace_settings200_response_overrides'
|
|
|
59
60
|
require 'seatschart/models/get_api_workspace_settings200_response_sources'
|
|
60
61
|
require 'seatschart/models/get_api_workspaces200_response'
|
|
61
62
|
require 'seatschart/models/get_api_workspaces200_response_items_inner'
|
|
63
|
+
require 'seatschart/models/get_api_workspaces_by_workspace_id_invitations200_response'
|
|
64
|
+
require 'seatschart/models/get_api_workspaces_by_workspace_id_invitations200_response_invitations_inner'
|
|
62
65
|
require 'seatschart/models/get_api_workspaces_by_workspace_id_keys200_response'
|
|
63
66
|
require 'seatschart/models/get_api_workspaces_by_workspace_id_keys200_response_api_keys_inner'
|
|
64
|
-
require 'seatschart/models/
|
|
65
|
-
require 'seatschart/models/
|
|
67
|
+
require 'seatschart/models/get_api_workspaces_by_workspace_id_members200_response'
|
|
68
|
+
require 'seatschart/models/get_api_workspaces_by_workspace_id_members200_response_members_inner'
|
|
69
|
+
require 'seatschart/models/get_api_workspaces_overview200_response'
|
|
70
|
+
require 'seatschart/models/get_api_workspaces_overview200_response_account'
|
|
71
|
+
require 'seatschart/models/get_api_workspaces_overview200_response_account_charts'
|
|
72
|
+
require 'seatschart/models/get_api_workspaces_overview200_response_account_plan'
|
|
73
|
+
require 'seatschart/models/get_api_workspaces_overview200_response_items_inner'
|
|
74
|
+
require 'seatschart/models/get_api_workspaces_overview200_response_items_inner_revenue'
|
|
75
|
+
require 'seatschart/models/get_api_workspaces_overview200_response_items_inner_usage'
|
|
76
|
+
require 'seatschart/models/get_api_workspaces_overview200_response_seats'
|
|
77
|
+
require 'seatschart/models/get_api_workspaces_overview200_response_seats_overage'
|
|
78
|
+
require 'seatschart/models/get_api_workspaces_overview200_response_seats_projected'
|
|
79
|
+
require 'seatschart/models/get_api_workspaces_overview200_response_totals'
|
|
80
|
+
require 'seatschart/models/get_api_workspaces_overview200_response_totals_revenue'
|
|
81
|
+
require 'seatschart/models/get_api_workspaces_overview200_response_totals_seats'
|
|
66
82
|
require 'seatschart/models/patch_api_charts_by_chart_id_categories_by_category_id_request'
|
|
67
83
|
require 'seatschart/models/patch_api_charts_by_chart_id_request'
|
|
68
84
|
require 'seatschart/models/patch_api_events_by_event_id_inventory_channels_by_channel_key_id_request'
|
|
@@ -98,6 +114,7 @@ require 'seatschart/models/post_api_auth_new_workspace_request'
|
|
|
98
114
|
require 'seatschart/models/post_api_auth_refresh_request'
|
|
99
115
|
require 'seatschart/models/post_api_auth_signup_request'
|
|
100
116
|
require 'seatschart/models/post_api_auth_switch_workspace_request'
|
|
117
|
+
require 'seatschart/models/post_api_billing_actions_change_plan_request'
|
|
101
118
|
require 'seatschart/models/post_api_billing_checkout_session_request'
|
|
102
119
|
require 'seatschart/models/post_api_billing_confirm_checkout_request'
|
|
103
120
|
require 'seatschart/models/post_api_charts_by_chart_id_actions_archive200_response'
|
|
@@ -212,6 +229,8 @@ require 'seatschart/models/post_api_workspaces200_response_template'
|
|
|
212
229
|
require 'seatschart/models/post_api_workspaces200_response_template_webhooks_inner'
|
|
213
230
|
require 'seatschart/models/post_api_workspaces_by_workspace_id_actions_delete200_response'
|
|
214
231
|
require 'seatschart/models/post_api_workspaces_by_workspace_id_actions_delete_request'
|
|
232
|
+
require 'seatschart/models/post_api_workspaces_by_workspace_id_invitations201_response'
|
|
233
|
+
require 'seatschart/models/post_api_workspaces_by_workspace_id_invitations201_response_invitation'
|
|
215
234
|
require 'seatschart/models/post_api_workspaces_by_workspace_id_invitations_request'
|
|
216
235
|
require 'seatschart/models/post_api_workspaces_by_workspace_id_keys201_response'
|
|
217
236
|
require 'seatschart/models/post_api_workspaces_by_workspace_id_keys201_response_api_key'
|
|
@@ -282,3 +301,4 @@ module SeatsChart
|
|
|
282
301
|
end
|
|
283
302
|
end
|
|
284
303
|
require 'seatschart/retry'
|
|
304
|
+
require 'seatschart/workspaces'
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: seatschart
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- SeatsChart
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-11-
|
|
11
|
+
date: 2026-11-14 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: typhoeus
|
|
@@ -90,11 +90,12 @@ files:
|
|
|
90
90
|
- lib/seatschart/api_client.rb
|
|
91
91
|
- lib/seatschart/api_error.rb
|
|
92
92
|
- lib/seatschart/configuration.rb
|
|
93
|
-
- lib/seatschart/models/
|
|
93
|
+
- lib/seatschart/models/api_error_body.rb
|
|
94
94
|
- lib/seatschart/models/api_error_params_value.rb
|
|
95
95
|
- lib/seatschart/models/delete_api_sandboxes_by_sandbox_id200_response.rb
|
|
96
96
|
- lib/seatschart/models/delete_api_workspaces_by_workspace_id200_response.rb
|
|
97
97
|
- lib/seatschart/models/delete_api_workspaces_by_workspace_id_keys_by_key_id200_response.rb
|
|
98
|
+
- lib/seatschart/models/delete_api_workspaces_by_workspace_id_members_by_user_id200_response.rb
|
|
98
99
|
- lib/seatschart/models/get_api_charts_by_chart_id_versions200_response.rb
|
|
99
100
|
- lib/seatschart/models/get_api_charts_by_chart_id_versions200_response_items_inner.rb
|
|
100
101
|
- lib/seatschart/models/get_api_charts_by_chart_id_versions200_response_items_inner_published_by.rb
|
|
@@ -132,10 +133,25 @@ files:
|
|
|
132
133
|
- lib/seatschart/models/get_api_workspace_settings200_response_sources.rb
|
|
133
134
|
- lib/seatschart/models/get_api_workspaces200_response.rb
|
|
134
135
|
- lib/seatschart/models/get_api_workspaces200_response_items_inner.rb
|
|
136
|
+
- lib/seatschart/models/get_api_workspaces_by_workspace_id_invitations200_response.rb
|
|
137
|
+
- lib/seatschart/models/get_api_workspaces_by_workspace_id_invitations200_response_invitations_inner.rb
|
|
135
138
|
- lib/seatschart/models/get_api_workspaces_by_workspace_id_keys200_response.rb
|
|
136
139
|
- lib/seatschart/models/get_api_workspaces_by_workspace_id_keys200_response_api_keys_inner.rb
|
|
137
|
-
- lib/seatschart/models/
|
|
138
|
-
- lib/seatschart/models/
|
|
140
|
+
- lib/seatschart/models/get_api_workspaces_by_workspace_id_members200_response.rb
|
|
141
|
+
- lib/seatschart/models/get_api_workspaces_by_workspace_id_members200_response_members_inner.rb
|
|
142
|
+
- lib/seatschart/models/get_api_workspaces_overview200_response.rb
|
|
143
|
+
- lib/seatschart/models/get_api_workspaces_overview200_response_account.rb
|
|
144
|
+
- lib/seatschart/models/get_api_workspaces_overview200_response_account_charts.rb
|
|
145
|
+
- lib/seatschart/models/get_api_workspaces_overview200_response_account_plan.rb
|
|
146
|
+
- lib/seatschart/models/get_api_workspaces_overview200_response_items_inner.rb
|
|
147
|
+
- lib/seatschart/models/get_api_workspaces_overview200_response_items_inner_revenue.rb
|
|
148
|
+
- lib/seatschart/models/get_api_workspaces_overview200_response_items_inner_usage.rb
|
|
149
|
+
- lib/seatschart/models/get_api_workspaces_overview200_response_seats.rb
|
|
150
|
+
- lib/seatschart/models/get_api_workspaces_overview200_response_seats_overage.rb
|
|
151
|
+
- lib/seatschart/models/get_api_workspaces_overview200_response_seats_projected.rb
|
|
152
|
+
- lib/seatschart/models/get_api_workspaces_overview200_response_totals.rb
|
|
153
|
+
- lib/seatschart/models/get_api_workspaces_overview200_response_totals_revenue.rb
|
|
154
|
+
- lib/seatschart/models/get_api_workspaces_overview200_response_totals_seats.rb
|
|
139
155
|
- lib/seatschart/models/patch_api_charts_by_chart_id_categories_by_category_id_request.rb
|
|
140
156
|
- lib/seatschart/models/patch_api_charts_by_chart_id_request.rb
|
|
141
157
|
- lib/seatschart/models/patch_api_events_by_event_id_inventory_channels_by_channel_key_id_request.rb
|
|
@@ -171,6 +187,7 @@ files:
|
|
|
171
187
|
- lib/seatschart/models/post_api_auth_refresh_request.rb
|
|
172
188
|
- lib/seatschart/models/post_api_auth_signup_request.rb
|
|
173
189
|
- lib/seatschart/models/post_api_auth_switch_workspace_request.rb
|
|
190
|
+
- lib/seatschart/models/post_api_billing_actions_change_plan_request.rb
|
|
174
191
|
- lib/seatschart/models/post_api_billing_checkout_session_request.rb
|
|
175
192
|
- lib/seatschart/models/post_api_billing_confirm_checkout_request.rb
|
|
176
193
|
- lib/seatschart/models/post_api_charts_by_chart_id_actions_archive200_response.rb
|
|
@@ -285,6 +302,8 @@ files:
|
|
|
285
302
|
- lib/seatschart/models/post_api_workspaces200_response_template_webhooks_inner.rb
|
|
286
303
|
- lib/seatschart/models/post_api_workspaces_by_workspace_id_actions_delete200_response.rb
|
|
287
304
|
- lib/seatschart/models/post_api_workspaces_by_workspace_id_actions_delete_request.rb
|
|
305
|
+
- lib/seatschart/models/post_api_workspaces_by_workspace_id_invitations201_response.rb
|
|
306
|
+
- lib/seatschart/models/post_api_workspaces_by_workspace_id_invitations201_response_invitation.rb
|
|
288
307
|
- lib/seatschart/models/post_api_workspaces_by_workspace_id_invitations_request.rb
|
|
289
308
|
- lib/seatschart/models/post_api_workspaces_by_workspace_id_keys201_response.rb
|
|
290
309
|
- lib/seatschart/models/post_api_workspaces_by_workspace_id_keys201_response_api_key.rb
|
|
@@ -311,6 +330,7 @@ files:
|
|
|
311
330
|
- lib/seatschart/models/put_internal_status_notices_request_notices_inner.rb
|
|
312
331
|
- lib/seatschart/retry.rb
|
|
313
332
|
- lib/seatschart/version.rb
|
|
333
|
+
- lib/seatschart/workspaces.rb
|
|
314
334
|
homepage: https://github.com/seatschart
|
|
315
335
|
licenses:
|
|
316
336
|
- MIT
|