Module: BillingApi::ProductsGet200ResponseInner

Defined in:
lib/pnap_billing_api/models/products_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



49
50
51
52
53
54
55
56
57
# File 'lib/pnap_billing_api/models/products_get200_response_inner.rb', line 49

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)



36
37
38
39
40
41
42
43
44
# File 'lib/pnap_billing_api/models/products_get200_response_inner.rb', line 36

def openapi_discriminator_mapping
  {
    :'BANDWIDTH' => :'Product',
    :'OPERATING_SYSTEM' => :'Product',
    :'PUBLIC_IP' => :'Product',
    :'SERVER' => :'ServerProduct',
    :'STORAGE' => :'Product'
  }
end

.openapi_discriminator_nameObject

Discriminator’s property name (OpenAPI v3)



28
29
30
31
32
33
# File 'lib/pnap_billing_api/models/products_get200_response_inner.rb', line 28

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
# File 'lib/pnap_billing_api/models/products_get200_response_inner.rb', line 20

def openapi_one_of
  [
    :'Product',
    :'ServerProduct'
  ]
end