Module: BillingApi::RatedUsageGet200ResponseInner

Defined in:
lib/pnap_billing_api/models/rated_usage_get200_response_inner.rb

Class Method Summary collapse

Class Method Details

.build(data) ⇒ Object

Builds the object

Parameters:

  • Data (Mixed)

    to be matched against the list of oneOf items

Returns:

  • (Object)

    Returns the model or the data itself



52
53
54
55
56
57
58
59
60
# File 'lib/pnap_billing_api/models/rated_usage_get200_response_inner.rb', line 52

def build(data)
  discriminator_value = data[openapi_discriminator_name]
  return nil if discriminator_value.nil?

  klass = openapi_discriminator_mapping[discriminator_value.to_s.to_sym]
  return nil unless klass

  BillingApi.const_get(klass).build_from_hash(data)
end

.openapi_discriminator_mappingObject

Discriminator’s mapping (OpenAPI v3)



39
40
41
42
43
44
45
46
47
# File 'lib/pnap_billing_api/models/rated_usage_get200_response_inner.rb', line 39

def openapi_discriminator_mapping
  {
    :'bandwidth' => :'BandwidthRecord',
    :'bmc-server' => :'ServerRecord',
    :'operating-system' => :'OperatingSystemRecord',
    :'public-ip' => :'PublicSubnetRecord',
    :'storage' => :'StorageRecord'
  }
end

.openapi_discriminator_nameObject

Discriminator’s property name (OpenAPI v3)



31
32
33
34
35
36
# File 'lib/pnap_billing_api/models/rated_usage_get200_response_inner.rb', line 31

def openapi_discriminator_name
  # This change in the mustache template is needed in order for the three endpoints that make use of oneOf to serialize the hash into an object properly.
  # These three endpoints are: GET /billing/v1/products, GET /billing/v1/rated-usage, and GET /billing/v1/rated-usage/month-to-date
  # Tests covering these endpoints in tc_billing_api test case: test_get_products, test_get_rated_usage, test_get_rated_usage_month_to_date
  :productCategory
end

.openapi_one_ofObject

List of class defined in oneOf (OpenAPI v3)



20
21
22
23
24
25
26
27
28
# File 'lib/pnap_billing_api/models/rated_usage_get200_response_inner.rb', line 20

def openapi_one_of
  [
    :'BandwidthRecord',
    :'OperatingSystemRecord',
    :'PublicSubnetRecord',
    :'ServerRecord',
    :'StorageRecord'
  ]
end