Class: Stigg::Models::V1::UsageReportParams::Usage

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/stigg/models/v1/usage_report_params.rb,
sig/stigg/models/v1/usage_report_params.rbs

Defined Under Namespace

Modules: Dimension, UpdateBehavior

Instance Attribute Summary collapse

Class Method 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(usages:, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Object

Parameters:



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/stigg/models/v1/usage_report_params.rb', line 36

class Usage < Stigg::Internal::Type::BaseModel
  # @!attribute customer_id
  #   Customer id
  #
  #   @return [String]
  required :customer_id, String, api_name: :customerId

  # @!attribute feature_id
  #   Feature id
  #
  #   @return [String]
  required :feature_id, String, api_name: :featureId

  # @!attribute value
  #   The value to report for usage
  #
  #   @return [Integer]
  required :value, Integer

  # @!attribute created_at
  #   Timestamp of when the record was created
  #
  #   @return [Time, nil]
  optional :created_at, Time, api_name: :createdAt

  # @!attribute dimensions
  #   Additional dimensions for the usage report
  #
  #   @return [Hash{Symbol=>String, Float, Boolean}, nil]
  optional :dimensions,
           -> { Stigg::Internal::Type::HashOf[union: Stigg::V1::UsageReportParams::Usage::Dimension] }

  # @!attribute idempotency_key
  #   Idempotency key
  #
  #   @return [String, nil]
  optional :idempotency_key, String, api_name: :idempotencyKey

  # @!attribute resource_id
  #   Resource id
  #
  #   @return [String, nil]
  optional :resource_id, String, api_name: :resourceId, nil?: true

  # @!attribute update_behavior
  #   The method by which the usage value should be updated
  #
  #   @return [Symbol, Stigg::Models::V1::UsageReportParams::Usage::UpdateBehavior, nil]
  optional :update_behavior,
           enum: -> { Stigg::V1::UsageReportParams::Usage::UpdateBehavior },
           api_name: :updateBehavior

  # @!method initialize(customer_id:, feature_id:, value:, created_at: nil, dimensions: nil, idempotency_key: nil, resource_id: nil, update_behavior: nil)
  #   Single usage measurement
  #
  #   @param customer_id [String] Customer id
  #
  #   @param feature_id [String] Feature id
  #
  #   @param value [Integer] The value to report for usage
  #
  #   @param created_at [Time] Timestamp of when the record was created
  #
  #   @param dimensions [Hash{Symbol=>String, Float, Boolean}] Additional dimensions for the usage report
  #
  #   @param idempotency_key [String] Idempotency key
  #
  #   @param resource_id [String, nil] Resource id
  #
  #   @param update_behavior [Symbol, Stigg::Models::V1::UsageReportParams::Usage::UpdateBehavior] The method by which the usage value should be updated

  module Dimension
    extend Stigg::Internal::Type::Union

    variant String

    variant Float

    variant Stigg::Internal::Type::Boolean

    # @!method self.variants
    #   @return [Array(String, Float, Boolean)]
  end

  # The method by which the usage value should be updated
  #
  # @see Stigg::Models::V1::UsageReportParams::Usage#update_behavior
  module UpdateBehavior
    extend Stigg::Internal::Type::Enum

    DELTA = :DELTA
    SET = :SET

    # @!method self.values
    #   @return [Array<Symbol>]
  end
end

Instance Attribute Details

#created_atTime?

Timestamp of when the record was created

Parameters:

  • (Time)

Returns:

  • (Time, nil)


59
# File 'lib/stigg/models/v1/usage_report_params.rb', line 59

optional :created_at, Time, api_name: :createdAt

#customer_idString

Customer id

Parameters:

  • value (String)

Returns:

  • (String)


41
# File 'lib/stigg/models/v1/usage_report_params.rb', line 41

required :customer_id, String, api_name: :customerId

#dimensionsHash{Symbol=>String, Float, Boolean}?

Additional dimensions for the usage report

Returns:

  • (Hash{Symbol=>String, Float, Boolean}, nil)


65
66
# File 'lib/stigg/models/v1/usage_report_params.rb', line 65

optional :dimensions,
-> { Stigg::Internal::Type::HashOf[union: Stigg::V1::UsageReportParams::Usage::Dimension] }

#feature_idString

Feature id

Parameters:

  • value (String)

Returns:

  • (String)


47
# File 'lib/stigg/models/v1/usage_report_params.rb', line 47

required :feature_id, String, api_name: :featureId

#idempotency_keyString?

Idempotency key

Parameters:

  • (String)

Returns:

  • (String, nil)


72
# File 'lib/stigg/models/v1/usage_report_params.rb', line 72

optional :idempotency_key, String, api_name: :idempotencyKey

#resource_idString?

Resource id

Parameters:

  • value (String, nil)

Returns:

  • (String, nil)


78
# File 'lib/stigg/models/v1/usage_report_params.rb', line 78

optional :resource_id, String, api_name: :resourceId, nil?: true

#update_behaviorSymbol, ...

The method by which the usage value should be updated



84
85
86
# File 'lib/stigg/models/v1/usage_report_params.rb', line 84

optional :update_behavior,
enum: -> { Stigg::V1::UsageReportParams::Usage::UpdateBehavior },
api_name: :updateBehavior

#valueInteger

The value to report for usage

Parameters:

  • value (Integer)

Returns:

  • (Integer)


53
# File 'lib/stigg/models/v1/usage_report_params.rb', line 53

required :value, Integer

Class Method Details

.variantsArray(String, Float, Boolean)

Returns:

  • (Array(String, Float, Boolean))


# File 'lib/stigg/models/v1/usage_report_params.rb', line 116

Instance Method Details

#to_hash{

Returns:

  • ({)


92
# File 'sig/stigg/models/v1/usage_report_params.rbs', line 92

def to_hash: -> {