Class: Orb::Models::BillableMetric

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/orb/models/billable_metric.rb,
sig/orb/models/billable_metric.rbs

Overview

See Also:

  • Orb::Resources::Metrics#create

Defined Under Namespace

Modules: Status

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Internal::Type::BaseModel

==, #==, #[], coerce, #deconstruct_keys, #deep_to_h, dump, fields, hash, #hash, inherited, inspect, #inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml

Methods included from Internal::Type::Converter

#coerce, coerce, #dump, dump, #inspect, inspect, meta_info, new_coerce_state, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Constructor Details

#initialize(id:, description:, item:, metadata:, name:, sql:, status:, parameter_definitions: nil) ⇒ Object

Some parameter documentations has been truncated, see Orb::Models::BillableMetric for more details.

The Metric resource represents a calculation of a quantity based on events. Metrics are defined by the query that transforms raw usage events into meaningful values for your customers.

Parameters:

  • id (String)
  • description (String, nil)
  • item (Orb::Models::Item)

    The Item resource represents a sellable product or good. Items are associated wi

  • metadata (Hash{Symbol=>String})

    User specified key-value pairs for the resource. If not present, this defaults t

  • name (String)
  • sql (String)

    The SQL definition of the metric. For metrics defined via configuration rather t

  • status (Symbol, Orb::Models::BillableMetric::Status)
  • parameter_definitions (Array<Hash{Symbol=>Object}>, nil) (defaults to: nil)


# File 'lib/orb/models/billable_metric.rb', line 58

Instance Attribute Details

#descriptionString?

Parameters:

  • value (String, nil)

Returns:

  • (String, nil)


15
# File 'lib/orb/models/billable_metric.rb', line 15

required :description, String, nil?: true

#idString

Parameters:

  • value (String)

Returns:

  • (String)


10
# File 'lib/orb/models/billable_metric.rb', line 10

required :id, String

#itemOrb::Models::Item

The Item resource represents a sellable product or good. Items are associated with all line items, billable metrics, and prices and are used for defining external sync behavior for invoices and tax calculation purposes.

Parameters:

Returns:



23
# File 'lib/orb/models/billable_metric.rb', line 23

required :item, -> { Orb::Item }

#metadataHash{Symbol=>String}

User specified key-value pairs for the resource. If not present, this defaults to an empty dictionary. Individual keys can be removed by setting the value to null, and the entire metadata mapping can be cleared by setting metadata to null.

Parameters:

  • value (::Hash[Symbol, String])

Returns:

  • (Hash{Symbol=>String})


32
# File 'lib/orb/models/billable_metric.rb', line 32

required :metadata, Orb::Internal::Type::HashOf[String]

#nameString

Parameters:

  • value (String)

Returns:

  • (String)


37
# File 'lib/orb/models/billable_metric.rb', line 37

required :name, String

#parameter_definitionsArray<Hash{Symbol=>Object}>?

Parameters:

  • value (::Array[::Hash[Symbol, top]], nil)

Returns:

  • (Array<Hash{Symbol=>Object}>, nil)


54
55
56
# File 'lib/orb/models/billable_metric.rb', line 54

optional :parameter_definitions,
Orb::Internal::Type::ArrayOf[Orb::Internal::Type::HashOf[Orb::Internal::Type::Unknown]],
nil?: true

#sqlString

The SQL definition of the metric. For metrics defined via configuration rather than SQL, this is a derived SQL representation.

Parameters:

  • value (String)

Returns:

  • (String)


44
# File 'lib/orb/models/billable_metric.rb', line 44

required :sql, String

#statusSymbol, Orb::Models::BillableMetric::Status

Parameters:

  • value (Orb::Models::BillableMetric::status)

Returns:



49
# File 'lib/orb/models/billable_metric.rb', line 49

required :status, enum: -> { Orb::BillableMetric::Status }

Instance Method Details

#to_hash{

Returns:

  • ({)


43
# File 'sig/orb/models/billable_metric.rbs', line 43

def to_hash: -> {