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

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

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:, request_options: {}) ⇒ Object

Parameters:



22
23
24
25
26
27
28
29
30
31
32
33
34
35
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
# File 'lib/stigg/models/v1/usage_report_params.rb', line 22

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 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, 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 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

Returns:

  • (Time, nil)


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

optional :created_at, Time, api_name: :createdAt

#customer_idString

Customer id

Returns:

  • (String)


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

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)


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

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

#feature_idString

Feature id

Returns:

  • (String)


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

required :feature_id, String, api_name: :featureId

#resource_idString?

Resource id

Returns:

  • (String, nil)


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

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

#update_behaviorSymbol, ...

The method by which the usage value should be updated



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

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

#valueInteger

The value to report for usage

Returns:

  • (Integer)


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

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 94