Class: Hook0::Generated::ApplicationInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/hook0/generated/models.rb

Overview

The ApplicationInfo the API declares.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(application_id:, consumption:, name:, onboarding_steps:, organization_id:, quotas:) ⇒ ApplicationInfo

Returns a new instance of ApplicationInfo.

Parameters:

  • application_id (String)

    carries application_id: Unique identifier of the application.

  • consumption (ApplicationInfoConsumption)

    carries consumption: Current consumption metrics for this application.

  • name (String)

    carries name: Name of the application. Length: 2-50 characters.

  • onboarding_steps (ApplicationInfoOnboardingSteps)

    carries onboarding_steps: Onboarding completion status for this application.

  • organization_id (String)

    carries organization_id: UUID of the organization this application belongs to.

  • quotas (ApplicationInfoQuotas)

    carries quotas: Quota limits for this application.



334
335
336
337
338
339
340
341
342
# File 'lib/hook0/generated/models.rb', line 334

def initialize(application_id:, consumption:, name:, onboarding_steps:, organization_id:, quotas:)
  @application_id = application_id
  @consumption = consumption
  @name = name
  @onboarding_steps = onboarding_steps
  @organization_id = organization_id
  @quotas = quotas
  freeze
end

Instance Attribute Details

#application_idObject (readonly)

Returns the value of attribute application_id.



319
320
321
# File 'lib/hook0/generated/models.rb', line 319

def application_id
  @application_id
end

#consumptionObject (readonly)

Returns the value of attribute consumption.



319
320
321
# File 'lib/hook0/generated/models.rb', line 319

def consumption
  @consumption
end

#nameObject (readonly)

Returns the value of attribute name.



319
320
321
# File 'lib/hook0/generated/models.rb', line 319

def name
  @name
end

#onboarding_stepsObject (readonly)

Returns the value of attribute onboarding_steps.



319
320
321
# File 'lib/hook0/generated/models.rb', line 319

def onboarding_steps
  @onboarding_steps
end

#organization_idObject (readonly)

Returns the value of attribute organization_id.



319
320
321
# File 'lib/hook0/generated/models.rb', line 319

def organization_id
  @organization_id
end

#quotasObject (readonly)

Returns the value of attribute quotas.



319
320
321
# File 'lib/hook0/generated/models.rb', line 319

def quotas
  @quotas
end

Class Method Details

.from_json(value) ⇒ ApplicationInfo

Read one out of what the API answered.

Parameters:

  • value (Object)

    the JSON document the API answered

Returns:



348
349
350
351
352
353
354
355
356
357
358
# File 'lib/hook0/generated/models.rb', line 348

def self.from_json(value)
  fields = Runtime.as_fields(value, "ApplicationInfo")
  new(
    application_id: Runtime.read(fields, "application_id", Runtime::UUID),
    consumption: Runtime.read(fields, "consumption", ApplicationInfoConsumption.method(:from_json)),
    name: Runtime.read(fields, "name", Runtime::TEXT),
    onboarding_steps: Runtime.read(fields, "onboarding_steps", ApplicationInfoOnboardingSteps.method(:from_json)),
    organization_id: Runtime.read(fields, "organization_id", Runtime::UUID),
    quotas: Runtime.read(fields, "quotas", ApplicationInfoQuotas.method(:from_json))
  )
end

Instance Method Details

#==(other) ⇒ Boolean Also known as: eql?

Whether that value carries the same members as this one.

Parameters:

  • other (Object)

Returns:

  • (Boolean)


378
379
380
# File 'lib/hook0/generated/models.rb', line 378

def ==(other)
  other.is_a?(ApplicationInfo) && to_h == other.to_h
end

#hashInteger

A value two equal instances share, so that either may key a hash.

Returns:

  • (Integer)


386
387
388
# File 'lib/hook0/generated/models.rb', line 386

def hash
  to_h.hash
end

#to_hHash{String => Object}

Write one back the way the API reads it.

Returns:

  • (Hash{String => Object})


363
364
365
366
367
368
369
370
371
372
# File 'lib/hook0/generated/models.rb', line 363

def to_h
  out = {}
  out["application_id"] = @application_id
  out["consumption"] = @consumption.to_h
  out["name"] = @name
  out["onboarding_steps"] = @onboarding_steps.to_h
  out["organization_id"] = @organization_id
  out["quotas"] = @quotas.to_h
  out
end