Class: Svix::CronConfig
- Inherits:
-
Object
- Object
- Svix::CronConfig
- Defined in:
- lib/svix/models/cron_config.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#content_type ⇒ Object
Override the default content-type.
-
#payload ⇒ Object
Returns the value of attribute payload.
-
#schedule ⇒ Object
Returns the value of attribute schedule.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ CronConfig
constructor
A new instance of CronConfig.
- #serialize ⇒ Object
-
#to_json ⇒ Object
Serializes the object to a json string.
Constructor Details
#initialize(attributes = {}) ⇒ CronConfig
Returns a new instance of CronConfig.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/svix/models/cron_config.rb', line 17 def initialize(attributes = {}) unless attributes.is_a?(Hash) fail(ArgumentError, "The input argument (attributes) must be a hash in `Svix::CronConfig` 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::CronConfig") end instance_variable_set("@#{k}", v) instance_variable_set("@__#{k}_is_defined", true) end end |
Instance Attribute Details
#content_type ⇒ Object
Override the default content-type.
Recommended if the payload is not JSON.
10 11 12 |
# File 'lib/svix/models/cron_config.rb', line 10 def content_type @content_type end |
#payload ⇒ Object
Returns the value of attribute payload.
11 12 13 |
# File 'lib/svix/models/cron_config.rb', line 11 def payload @payload end |
#schedule ⇒ Object
Returns the value of attribute schedule.
12 13 14 |
# File 'lib/svix/models/cron_config.rb', line 12 def schedule @schedule end |
Class Method Details
.deserialize(attributes = {}) ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/svix/models/cron_config.rb', line 32 def self.deserialize(attributes = {}) attributes = attributes.transform_keys(&:to_s) attrs = Hash.new attrs["content_type"] = attributes["contentType"] attrs["payload"] = attributes["payload"] attrs["schedule"] = attributes["schedule"] new(attrs) end |
Instance Method Details
#serialize ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/svix/models/cron_config.rb', line 41 def serialize out = Hash.new out["contentType"] = Svix::serialize_primitive(@content_type) if @content_type out["payload"] = Svix::serialize_primitive(@payload) if @payload out["schedule"] = Svix::serialize_primitive(@schedule) if @schedule out end |
#to_json ⇒ Object
Serializes the object to a json string
51 52 53 |
# File 'lib/svix/models/cron_config.rb', line 51 def to_json JSON.dump(serialize) end |