Class: Lockally::V1UsageGet200Response

Inherits:
ApiModelBase show all
Defined in:
lib/lockally/models/v1_usage_get200_response.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ V1UsageGet200Response

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# File 'lib/lockally/models/v1_usage_get200_response.rb', line 111

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Lockally::V1UsageGet200Response` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  acceptable_attribute_map = self.class.acceptable_attribute_map
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!acceptable_attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `Lockally::V1UsageGet200Response`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'mailboxes_active')
    self.mailboxes_active = attributes[:'mailboxes_active']
  else
    self.mailboxes_active = nil
  end

  if attributes.key?(:'mailboxes_total')
    self.mailboxes_total = attributes[:'mailboxes_total']
  end

  if attributes.key?(:'domains_verified')
    self.domains_verified = attributes[:'domains_verified']
  end

  if attributes.key?(:'domains_total')
    self.domains_total = attributes[:'domains_total']
  end

  if attributes.key?(:'messages_sent_last_60s')
    self.messages_sent_last_60s = attributes[:'messages_sent_last_60s']
  end

  if attributes.key?(:'messages_sent_today_utc')
    self.messages_sent_today_utc = attributes[:'messages_sent_today_utc']
  end

  if attributes.key?(:'messages_sent_last_30d')
    self.messages_sent_last_30d = attributes[:'messages_sent_last_30d']
  end

  if attributes.key?(:'bytes_stored')
    self.bytes_stored = attributes[:'bytes_stored']
  end

  if attributes.key?(:'rate_cap_per_min')
    self.rate_cap_per_min = attributes[:'rate_cap_per_min']
  end

  if attributes.key?(:'daily_msg_quota')
    self.daily_msg_quota = attributes[:'daily_msg_quota']
  end

  if attributes.key?(:'webhooks_total')
    self.webhooks_total = attributes[:'webhooks_total']
  end

  if attributes.key?(:'webhooks_paused')
    self.webhooks_paused = attributes[:'webhooks_paused']
  end

  if attributes.key?(:'generated_at')
    self.generated_at = attributes[:'generated_at']
  else
    self.generated_at = nil
  end
end

Instance Attribute Details

#bytes_storedObject

Lifetime sum of messages.size_bytes for this tenant.



39
40
41
# File 'lib/lockally/models/v1_usage_get200_response.rb', line 39

def bytes_stored
  @bytes_stored
end

#daily_msg_quotaObject

Per-tenant daily send quota (UTC day boundary).



45
46
47
# File 'lib/lockally/models/v1_usage_get200_response.rb', line 45

def daily_msg_quota
  @daily_msg_quota
end

#domains_totalObject

Returns the value of attribute domains_total.



27
28
29
# File 'lib/lockally/models/v1_usage_get200_response.rb', line 27

def domains_total
  @domains_total
end

#domains_verifiedObject

Domains that have passed DNS verification.



25
26
27
# File 'lib/lockally/models/v1_usage_get200_response.rb', line 25

def domains_verified
  @domains_verified
end

#generated_atObject

When this snapshot was generated, RFC 3339 UTC.



53
54
55
# File 'lib/lockally/models/v1_usage_get200_response.rb', line 53

def generated_at
  @generated_at
end

#mailboxes_activeObject

Mailboxes that are neither disabled nor soft-deleted.



19
20
21
# File 'lib/lockally/models/v1_usage_get200_response.rb', line 19

def mailboxes_active
  @mailboxes_active
end

#mailboxes_totalObject

All mailboxes for this tenant, including disabled/soft-deleted.



22
23
24
# File 'lib/lockally/models/v1_usage_get200_response.rb', line 22

def mailboxes_total
  @mailboxes_total
end

#messages_sent_last_30dObject

Rolling 30-day send count (not calendar month).



36
37
38
# File 'lib/lockally/models/v1_usage_get200_response.rb', line 36

def messages_sent_last_30d
  @messages_sent_last_30d
end

#messages_sent_last_60sObject

Sends in the 60-second window ending now. Used by the rate-cap check.



30
31
32
# File 'lib/lockally/models/v1_usage_get200_response.rb', line 30

def messages_sent_last_60s
  @messages_sent_last_60s
end

#messages_sent_today_utcObject

Sends since 00:00 UTC. Compared against daily_msg_quota.



33
34
35
# File 'lib/lockally/models/v1_usage_get200_response.rb', line 33

def messages_sent_today_utc
  @messages_sent_today_utc
end

#rate_cap_per_minObject

Per-tenant outbound rate cap (sends per minute).



42
43
44
# File 'lib/lockally/models/v1_usage_get200_response.rb', line 42

def rate_cap_per_min
  @rate_cap_per_min
end

#webhooks_pausedObject

Webhook subscriptions auto-paused after 50 consecutive failures (LT2).



50
51
52
# File 'lib/lockally/models/v1_usage_get200_response.rb', line 50

def webhooks_paused
  @webhooks_paused
end

#webhooks_totalObject

Returns the value of attribute webhooks_total.



47
48
49
# File 'lib/lockally/models/v1_usage_get200_response.rb', line 47

def webhooks_total
  @webhooks_total
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



75
76
77
# File 'lib/lockally/models/v1_usage_get200_response.rb', line 75

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



80
81
82
# File 'lib/lockally/models/v1_usage_get200_response.rb', line 80

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/lockally/models/v1_usage_get200_response.rb', line 56

def self.attribute_map
  {
    :'mailboxes_active' => :'mailboxes_active',
    :'mailboxes_total' => :'mailboxes_total',
    :'domains_verified' => :'domains_verified',
    :'domains_total' => :'domains_total',
    :'messages_sent_last_60s' => :'messages_sent_last_60s',
    :'messages_sent_today_utc' => :'messages_sent_today_utc',
    :'messages_sent_last_30d' => :'messages_sent_last_30d',
    :'bytes_stored' => :'bytes_stored',
    :'rate_cap_per_min' => :'rate_cap_per_min',
    :'daily_msg_quota' => :'daily_msg_quota',
    :'webhooks_total' => :'webhooks_total',
    :'webhooks_paused' => :'webhooks_paused',
    :'generated_at' => :'generated_at'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
# File 'lib/lockally/models/v1_usage_get200_response.rb', line 262

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



104
105
106
107
# File 'lib/lockally/models/v1_usage_get200_response.rb', line 104

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/lockally/models/v1_usage_get200_response.rb', line 85

def self.openapi_types
  {
    :'mailboxes_active' => :'Integer',
    :'mailboxes_total' => :'Integer',
    :'domains_verified' => :'Integer',
    :'domains_total' => :'Integer',
    :'messages_sent_last_60s' => :'Integer',
    :'messages_sent_today_utc' => :'Integer',
    :'messages_sent_last_30d' => :'Integer',
    :'bytes_stored' => :'Integer',
    :'rate_cap_per_min' => :'Integer',
    :'daily_msg_quota' => :'Integer',
    :'webhooks_total' => :'Integer',
    :'webhooks_paused' => :'Integer',
    :'generated_at' => :'Time'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
# File 'lib/lockally/models/v1_usage_get200_response.rb', line 229

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      mailboxes_active == o.mailboxes_active &&
      mailboxes_total == o.mailboxes_total &&
      domains_verified == o.domains_verified &&
      domains_total == o.domains_total &&
      messages_sent_last_60s == o.messages_sent_last_60s &&
      messages_sent_today_utc == o.messages_sent_today_utc &&
      messages_sent_last_30d == o.messages_sent_last_30d &&
      bytes_stored == o.bytes_stored &&
      rate_cap_per_min == o.rate_cap_per_min &&
      daily_msg_quota == o.daily_msg_quota &&
      webhooks_total == o.webhooks_total &&
      webhooks_paused == o.webhooks_paused &&
      generated_at == o.generated_at
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


249
250
251
# File 'lib/lockally/models/v1_usage_get200_response.rb', line 249

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



255
256
257
# File 'lib/lockally/models/v1_usage_get200_response.rb', line 255

def hash
  [mailboxes_active, mailboxes_total, domains_verified, domains_total, messages_sent_last_60s, messages_sent_today_utc, messages_sent_last_30d, bytes_stored, rate_cap_per_min, daily_msg_quota, webhooks_total, webhooks_paused, generated_at].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



184
185
186
187
188
189
190
191
192
193
194
195
196
# File 'lib/lockally/models/v1_usage_get200_response.rb', line 184

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if @mailboxes_active.nil?
    invalid_properties.push('invalid value for "mailboxes_active", mailboxes_active cannot be nil.')
  end

  if @generated_at.nil?
    invalid_properties.push('invalid value for "generated_at", generated_at cannot be nil.')
  end

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



284
285
286
287
288
289
290
291
292
293
294
295
296
# File 'lib/lockally/models/v1_usage_get200_response.rb', line 284

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



200
201
202
203
204
205
# File 'lib/lockally/models/v1_usage_get200_response.rb', line 200

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @mailboxes_active.nil?
  return false if @generated_at.nil?
  true
end