Class: SparteraApiSdk::Endpoints

Inherits:
ApiModelBase show all
Defined in:
lib/spartera_api_sdk/models/endpoints.rb

Overview

A configured API endpoint exposing seller data with access controls and rate limiting

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ Endpoints

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
# File 'lib/spartera_api_sdk/models/endpoints.rb', line 231

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `SparteraApiSdk::Endpoints` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  acceptable_attribute_map = self.class.acceptable_attribute_map
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!acceptable_attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `SparteraApiSdk::Endpoints`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'date_created')
    self.date_created = attributes[:'date_created']
  else
    self.date_created = nil
  end

  if attributes.key?(:'last_updated')
    self.last_updated = attributes[:'last_updated']
  else
    self.last_updated = nil
  end

  if attributes.key?(:'endpoint_id')
    self.endpoint_id = attributes[:'endpoint_id']
  end

  if attributes.key?(:'user_id')
    self.user_id = attributes[:'user_id']
  end

  if attributes.key?(:'company_id')
    self.company_id = attributes[:'company_id']
  else
    self.company_id = nil
  end

  if attributes.key?(:'connection_id')
    self.connection_id = attributes[:'connection_id']
  else
    self.connection_id = nil
  end

  if attributes.key?(:'industry_id')
    self.industry_id = attributes[:'industry_id']
  end

  if attributes.key?(:'auc_id')
    self.auc_id = attributes[:'auc_id']
  end

  if attributes.key?(:'approval_status')
    self.approval_status = attributes[:'approval_status']
  end

  if attributes.key?(:'approved_by_user_id')
    self.approved_by_user_id = attributes[:'approved_by_user_id']
  end

  if attributes.key?(:'approved_at')
    self.approved_at = attributes[:'approved_at']
  end

  if attributes.key?(:'sell_in_marketplace')
    self.sell_in_marketplace = attributes[:'sell_in_marketplace']
  else
    self.sell_in_marketplace = nil
  end

  if attributes.key?(:'price_credits')
    self.price_credits = attributes[:'price_credits']
  else
    self.price_credits = nil
  end

  if attributes.key?(:'name')
    self.name = attributes[:'name']
  else
    self.name = nil
  end

  if attributes.key?(:'slug')
    self.slug = attributes[:'slug']
  end

  if attributes.key?(:'description')
    self.description = attributes[:'description']
  end

  if attributes.key?(:'source_schema_name')
    self.source_schema_name = attributes[:'source_schema_name']
  end

  if attributes.key?(:'source_table_name')
    self.source_table_name = attributes[:'source_table_name']
  end

  if attributes.key?(:'customer_name')
    self.customer_name = attributes[:'customer_name']
  end

  if attributes.key?(:'price_usd')
    self.price_usd = attributes[:'price_usd']
  end

  if attributes.key?(:'endpoint_schema')
    self.endpoint_schema = attributes[:'endpoint_schema']
  end

  if attributes.key?(:'rate_limit_requests')
    self.rate_limit_requests = attributes[:'rate_limit_requests']
  end

  if attributes.key?(:'rate_limit_period')
    self.rate_limit_period = attributes[:'rate_limit_period']
  end

  if attributes.key?(:'rate_limit_granularity')
    self.rate_limit_granularity = attributes[:'rate_limit_granularity']
  end

  if attributes.key?(:'access_method')
    self.access_method = attributes[:'access_method']
  end

  if attributes.key?(:'access_whitelist')
    self.access_whitelist = attributes[:'access_whitelist']
  end

  if attributes.key?(:'status')
    self.status = attributes[:'status']
  else
    self.status = nil
  end

  if attributes.key?(:'tags')
    self.tags = attributes[:'tags']
  end

  if attributes.key?(:'last_accessed')
    self.last_accessed = attributes[:'last_accessed']
  end

  if attributes.key?(:'max_records_per_request')
    self.max_records_per_request = attributes[:'max_records_per_request']
  end

  if attributes.key?(:'sample_response')
    self.sample_response = attributes[:'sample_response']
  end

  if attributes.key?(:'active')
    self.active = attributes[:'active']
  else
    self.active = nil
  end
end

Instance Attribute Details

#access_methodObject

Access control method (OPEN, API_KEY, IP, EMAIL, DOMAIN)



92
93
94
# File 'lib/spartera_api_sdk/models/endpoints.rb', line 92

def access_method
  @access_method
end

#access_whitelistObject

List of allowed IPs, emails, or domains based on access_method. Format: ‘ip’|‘email’|‘domain’, values: [‘192.168.1.1’, …]



95
96
97
# File 'lib/spartera_api_sdk/models/endpoints.rb', line 95

def access_whitelist
  @access_whitelist
end

#activeObject

Required.



113
114
115
# File 'lib/spartera_api_sdk/models/endpoints.rb', line 113

def active
  @active
end

#approval_statusObject

Approval status before marketplace publication



44
45
46
# File 'lib/spartera_api_sdk/models/endpoints.rb', line 44

def approval_status
  @approval_status
end

#approved_atObject

Timestamp of marketplace approval



50
51
52
# File 'lib/spartera_api_sdk/models/endpoints.rb', line 50

def approved_at
  @approved_at
end

#approved_by_user_idObject

User who approved this endpoint for marketplace



47
48
49
# File 'lib/spartera_api_sdk/models/endpoints.rb', line 47

def approved_by_user_id
  @approved_by_user_id
end

#auc_idObject

Primary use case for marketplace discovery



41
42
43
# File 'lib/spartera_api_sdk/models/endpoints.rb', line 41

def auc_id
  @auc_id
end

#company_idObject

References companies.company_id — A Spartera seller or buyer company account. See GET /companies for valid values. Required.



32
33
34
# File 'lib/spartera_api_sdk/models/endpoints.rb', line 32

def company_id
  @company_id
end

#connection_idObject

Connection to the data source



35
36
37
# File 'lib/spartera_api_sdk/models/endpoints.rb', line 35

def connection_id
  @connection_id
end

#customer_nameObject

Named customer for B2B deals (marketplace uses price_credits instead)



74
75
76
# File 'lib/spartera_api_sdk/models/endpoints.rb', line 74

def customer_name
  @customer_name
end

#date_createdObject

Required.



20
21
22
# File 'lib/spartera_api_sdk/models/endpoints.rb', line 20

def date_created
  @date_created
end

#descriptionObject

Description of what this endpoint provides



65
66
67
# File 'lib/spartera_api_sdk/models/endpoints.rb', line 65

def description
  @description
end

#endpoint_idObject

Unique identifier.



26
27
28
# File 'lib/spartera_api_sdk/models/endpoints.rb', line 26

def endpoint_id
  @endpoint_id
end

#endpoint_schemaObject

Column configurations including aggregations, filters, and visibility. Format: [{name, type, aggregation, filter, is_hidden, alias, …]}. This is the source of truth — SQL is generated at runtime from this configuration.



80
81
82
# File 'lib/spartera_api_sdk/models/endpoints.rb', line 80

def endpoint_schema
  @endpoint_schema
end

#industry_idObject

Industry / category for marketplace discovery



38
39
40
# File 'lib/spartera_api_sdk/models/endpoints.rb', line 38

def industry_id
  @industry_id
end

#last_accessedObject

When this endpoint was last called



104
105
106
# File 'lib/spartera_api_sdk/models/endpoints.rb', line 104

def last_accessed
  @last_accessed
end

#last_updatedObject

Required.



23
24
25
# File 'lib/spartera_api_sdk/models/endpoints.rb', line 23

def last_updated
  @last_updated
end

#max_records_per_requestObject

Seller-enforced row cap per request. Buyers cannot exceed this. Default 1000.



107
108
109
# File 'lib/spartera_api_sdk/models/endpoints.rb', line 107

def max_records_per_request
  @max_records_per_request
end

#nameObject

Human-readable name for the endpoint



59
60
61
# File 'lib/spartera_api_sdk/models/endpoints.rb', line 59

def name
  @name
end

#price_creditsObject

Credits deducted from the buyer’s pool per successful (200 OK) request. Same credit pool as assets. price_usd kept for billing records / dashboards.



56
57
58
# File 'lib/spartera_api_sdk/models/endpoints.rb', line 56

def price_credits
  @price_credits
end

#price_usdObject

USD reference price for billing records and seller dashboards



77
78
79
# File 'lib/spartera_api_sdk/models/endpoints.rb', line 77

def price_usd
  @price_usd
end

#rate_limit_granularityObject

How to group rate limits (IP, USER, COMPANY, API_KEY, GLOBAL)



89
90
91
# File 'lib/spartera_api_sdk/models/endpoints.rb', line 89

def rate_limit_granularity
  @rate_limit_granularity
end

#rate_limit_periodObject

Time period for rate limiting (HOUR, DAY, MONTH)



86
87
88
# File 'lib/spartera_api_sdk/models/endpoints.rb', line 86

def rate_limit_period
  @rate_limit_period
end

#rate_limit_requestsObject

Number of requests allowed per rate_limit_period



83
84
85
# File 'lib/spartera_api_sdk/models/endpoints.rb', line 83

def rate_limit_requests
  @rate_limit_requests
end

#sample_responseObject

Last successful request, response envelope. Saved on each successful marketplace run. Displayed as preview on product page load.



110
111
112
# File 'lib/spartera_api_sdk/models/endpoints.rb', line 110

def sample_response
  @sample_response
end

#sell_in_marketplaceObject

Whether this endpoint appears in the public marketplace



53
54
55
# File 'lib/spartera_api_sdk/models/endpoints.rb', line 53

def sell_in_marketplace
  @sell_in_marketplace
end

#slugObject

Human-readable, URL-safe slug derived from name at creation time. e.g. ‘NFL Live Moneyline & Spread Odds’ → ‘nfl-live-moneyline-spread-odds’. Never changes after creation. Unique within company (DB constraint). Creation fails with 409 if a duplicate name exists in the same company.



62
63
64
# File 'lib/spartera_api_sdk/models/endpoints.rb', line 62

def slug
  @slug
end

#source_schema_nameObject

Schema/database name where the table resides



68
69
70
# File 'lib/spartera_api_sdk/models/endpoints.rb', line 68

def source_schema_name
  @source_schema_name
end

#source_table_nameObject

Table name to query from



71
72
73
# File 'lib/spartera_api_sdk/models/endpoints.rb', line 71

def source_table_name
  @source_table_name
end

#statusObject

Current status of the endpoint (ACTIVE, INACTIVE, DEPRECATED)



98
99
100
# File 'lib/spartera_api_sdk/models/endpoints.rb', line 98

def status
  @status
end

#tagsObject

Comma-separated tags for organizing endpoints



101
102
103
# File 'lib/spartera_api_sdk/models/endpoints.rb', line 101

def tags
  @tags
end

#user_idObject

User who created this endpoint



29
30
31
# File 'lib/spartera_api_sdk/models/endpoints.rb', line 29

def user_id
  @user_id
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



176
177
178
# File 'lib/spartera_api_sdk/models/endpoints.rb', line 176

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



181
182
183
# File 'lib/spartera_api_sdk/models/endpoints.rb', line 181

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# File 'lib/spartera_api_sdk/models/endpoints.rb', line 138

def self.attribute_map
  {
    :'date_created' => :'date_created',
    :'last_updated' => :'last_updated',
    :'endpoint_id' => :'endpoint_id',
    :'user_id' => :'user_id',
    :'company_id' => :'company_id',
    :'connection_id' => :'connection_id',
    :'industry_id' => :'industry_id',
    :'auc_id' => :'auc_id',
    :'approval_status' => :'approval_status',
    :'approved_by_user_id' => :'approved_by_user_id',
    :'approved_at' => :'approved_at',
    :'sell_in_marketplace' => :'sell_in_marketplace',
    :'price_credits' => :'price_credits',
    :'name' => :'name',
    :'slug' => :'slug',
    :'description' => :'description',
    :'source_schema_name' => :'source_schema_name',
    :'source_table_name' => :'source_table_name',
    :'customer_name' => :'customer_name',
    :'price_usd' => :'price_usd',
    :'endpoint_schema' => :'endpoint_schema',
    :'rate_limit_requests' => :'rate_limit_requests',
    :'rate_limit_period' => :'rate_limit_period',
    :'rate_limit_granularity' => :'rate_limit_granularity',
    :'access_method' => :'access_method',
    :'access_whitelist' => :'access_whitelist',
    :'status' => :'status',
    :'tags' => :'tags',
    :'last_accessed' => :'last_accessed',
    :'max_records_per_request' => :'max_records_per_request',
    :'sample_response' => :'sample_response',
    :'active' => :'active'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
# File 'lib/spartera_api_sdk/models/endpoints.rb', line 646

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



224
225
226
227
# File 'lib/spartera_api_sdk/models/endpoints.rb', line 224

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
# File 'lib/spartera_api_sdk/models/endpoints.rb', line 186

def self.openapi_types
  {
    :'date_created' => :'Time',
    :'last_updated' => :'Time',
    :'endpoint_id' => :'String',
    :'user_id' => :'String',
    :'company_id' => :'String',
    :'connection_id' => :'String',
    :'industry_id' => :'Integer',
    :'auc_id' => :'Integer',
    :'approval_status' => :'String',
    :'approved_by_user_id' => :'String',
    :'approved_at' => :'Time',
    :'sell_in_marketplace' => :'Boolean',
    :'price_credits' => :'Integer',
    :'name' => :'String',
    :'slug' => :'String',
    :'description' => :'String',
    :'source_schema_name' => :'String',
    :'source_table_name' => :'String',
    :'customer_name' => :'String',
    :'price_usd' => :'Float',
    :'endpoint_schema' => :'Object',
    :'rate_limit_requests' => :'Integer',
    :'rate_limit_period' => :'String',
    :'rate_limit_granularity' => :'String',
    :'access_method' => :'String',
    :'access_whitelist' => :'Object',
    :'status' => :'String',
    :'tags' => :'String',
    :'last_accessed' => :'Time',
    :'max_records_per_request' => :'Integer',
    :'sample_response' => :'Object',
    :'active' => :'Boolean'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
# File 'lib/spartera_api_sdk/models/endpoints.rb', line 594

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      date_created == o.date_created &&
      last_updated == o.last_updated &&
      endpoint_id == o.endpoint_id &&
      user_id == o.user_id &&
      company_id == o.company_id &&
      connection_id == o.connection_id &&
      industry_id == o.industry_id &&
      auc_id == o.auc_id &&
      approval_status == o.approval_status &&
      approved_by_user_id == o.approved_by_user_id &&
      approved_at == o.approved_at &&
      sell_in_marketplace == o.sell_in_marketplace &&
      price_credits == o.price_credits &&
      name == o.name &&
      slug == o.slug &&
      description == o.description &&
      source_schema_name == o.source_schema_name &&
      source_table_name == o.source_table_name &&
      customer_name == o.customer_name &&
      price_usd == o.price_usd &&
      endpoint_schema == o.endpoint_schema &&
      rate_limit_requests == o.rate_limit_requests &&
      rate_limit_period == o.rate_limit_period &&
      rate_limit_granularity == o.rate_limit_granularity &&
      access_method == o.access_method &&
      access_whitelist == o.access_whitelist &&
      status == o.status &&
      tags == o.tags &&
      last_accessed == o.last_accessed &&
      max_records_per_request == o.max_records_per_request &&
      sample_response == o.sample_response &&
      active == o.active
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


633
634
635
# File 'lib/spartera_api_sdk/models/endpoints.rb', line 633

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



639
640
641
# File 'lib/spartera_api_sdk/models/endpoints.rb', line 639

def hash
  [date_created, last_updated, endpoint_id, user_id, company_id, connection_id, industry_id, auc_id, approval_status, approved_by_user_id, approved_at, sell_in_marketplace, price_credits, name, slug, description, source_schema_name, source_table_name, customer_name, price_usd, endpoint_schema, rate_limit_requests, rate_limit_period, rate_limit_granularity, access_method, access_whitelist, status, tags, last_accessed, max_records_per_request, sample_response, active].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
# File 'lib/spartera_api_sdk/models/endpoints.rb', line 394

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if @date_created.nil?
    invalid_properties.push('invalid value for "date_created", date_created cannot be nil.')
  end

  if @last_updated.nil?
    invalid_properties.push('invalid value for "last_updated", last_updated cannot be nil.')
  end

  if @company_id.nil?
    invalid_properties.push('invalid value for "company_id", company_id cannot be nil.')
  end

  if @connection_id.nil?
    invalid_properties.push('invalid value for "connection_id", connection_id cannot be nil.')
  end

  if @sell_in_marketplace.nil?
    invalid_properties.push('invalid value for "sell_in_marketplace", sell_in_marketplace cannot be nil.')
  end

  if @price_credits.nil?
    invalid_properties.push('invalid value for "price_credits", price_credits cannot be nil.')
  end

  if @name.nil?
    invalid_properties.push('invalid value for "name", name cannot be nil.')
  end

  if @status.nil?
    invalid_properties.push('invalid value for "status", status cannot be nil.')
  end

  if @active.nil?
    invalid_properties.push('invalid value for "active", active cannot be nil.')
  end

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



668
669
670
671
672
673
674
675
676
677
678
679
680
# File 'lib/spartera_api_sdk/models/endpoints.rb', line 668

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
# File 'lib/spartera_api_sdk/models/endpoints.rb', line 438

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @date_created.nil?
  return false if @last_updated.nil?
  return false if @company_id.nil?
  return false if @connection_id.nil?
  approval_status_validator = EnumAttributeValidator.new('String', ["PENDING", "APPROVED", "REJECTED", "NEEDS_REVISION"])
  return false unless approval_status_validator.valid?(@approval_status)
  return false if @sell_in_marketplace.nil?
  return false if @price_credits.nil?
  return false if @name.nil?
  rate_limit_period_validator = EnumAttributeValidator.new('String', ["SECOND", "MINUTE", "HOUR", "DAY"])
  return false unless rate_limit_period_validator.valid?(@rate_limit_period)
  rate_limit_granularity_validator = EnumAttributeValidator.new('String', ["USER", "COMPANY", "IP", "GLOBAL"])
  return false unless rate_limit_granularity_validator.valid?(@rate_limit_granularity)
  access_method_validator = EnumAttributeValidator.new('String', ["OPEN", "API_KEY", "IP", "EMAIL", "DOMAIN"])
  return false unless access_method_validator.valid?(@access_method)
  return false if @status.nil?
  status_validator = EnumAttributeValidator.new('String', ["ACTIVE", "INACTIVE", "DEPRECATED"])
  return false unless status_validator.valid?(@status)
  return false if @active.nil?
  true
end