Class: Svix::AppUsageStatsIn
- Inherits:
-
Object
- Object
- Svix::AppUsageStatsIn
- Defined in:
- lib/svix/models/app_usage_stats_in.rb
Instance Attribute Summary collapse
-
#app_ids ⇒ Object
Specific app IDs or UIDs to aggregate stats for.
-
#since ⇒ Object
Returns the value of attribute since.
-
#until ⇒ Object
Returns the value of attribute until.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ AppUsageStatsIn
constructor
A new instance of AppUsageStatsIn.
- #serialize ⇒ Object
-
#to_json ⇒ Object
Serializes the object to a json string.
Constructor Details
#initialize(attributes = {}) ⇒ AppUsageStatsIn
Returns a new instance of AppUsageStatsIn.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/svix/models/app_usage_stats_in.rb', line 17 def initialize(attributes = {}) unless attributes.is_a?(Hash) fail(ArgumentError, "The input argument (attributes) must be a hash in `Svix::AppUsageStatsIn` new method") end attributes.each do |k, v| unless ALL_FIELD.include?(k.to_s) fail(ArgumentError, "The field #{k} is not part of Svix::AppUsageStatsIn") end instance_variable_set("@#{k}", v) instance_variable_set("@__#{k}_is_defined", true) end end |
Instance Attribute Details
#app_ids ⇒ Object
Specific app IDs or UIDs to aggregate stats for.
Note that if none of the given IDs or UIDs are resolved, a 422 response will be given.
10 11 12 |
# File 'lib/svix/models/app_usage_stats_in.rb', line 10 def app_ids @app_ids end |
#since ⇒ Object
Returns the value of attribute since.
11 12 13 |
# File 'lib/svix/models/app_usage_stats_in.rb', line 11 def since @since end |
#until ⇒ Object
Returns the value of attribute until.
12 13 14 |
# File 'lib/svix/models/app_usage_stats_in.rb', line 12 def until @until end |
Class Method Details
.deserialize(attributes = {}) ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/svix/models/app_usage_stats_in.rb', line 32 def self.deserialize(attributes = {}) attributes = attributes.transform_keys(&:to_s) attrs = Hash.new attrs["app_ids"] = attributes["appIds"] attrs["since"] = DateTime.rfc3339(attributes["since"]).to_time attrs["until"] = DateTime.rfc3339(attributes["until"]).to_time new(attrs) end |
Instance Method Details
#serialize ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/svix/models/app_usage_stats_in.rb', line 41 def serialize out = Hash.new out["appIds"] = Svix::serialize_primitive(@app_ids) if @app_ids out["since"] = Svix::serialize_primitive(@since) if @since out["until"] = Svix::serialize_primitive(@until) if @until out end |
#to_json ⇒ Object
Serializes the object to a json string
51 52 53 |
# File 'lib/svix/models/app_usage_stats_in.rb', line 51 def to_json JSON.dump(serialize) end |