Class: Verizon::DistributionSchedule
- Defined in:
- lib/verizon/models/distribution_schedule.rb
Overview
The distribution schedule parameters for broadcast messages.
Instance Attribute Summary collapse
-
#duration ⇒ Integer
The amount of time (in minutes) while the messages needs to be sent out.
-
#repeat_period ⇒ Integer
The period (in seconds) that the message needs to be repeatedly send out.
-
#start_time ⇒ DateTime
The time (in UTC) when the message transmission should be started.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(repeat_period:, duration:, start_time: SKIP) ⇒ DistributionSchedule
constructor
A new instance of DistributionSchedule.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_start_time ⇒ Object
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(repeat_period:, duration:, start_time: SKIP) ⇒ DistributionSchedule
Returns a new instance of DistributionSchedule.
46 47 48 49 50 |
# File 'lib/verizon/models/distribution_schedule.rb', line 46 def initialize(repeat_period:, duration:, start_time: SKIP) @repeat_period = repeat_period @duration = duration @start_time = start_time unless start_time == SKIP end |
Instance Attribute Details
#duration ⇒ Integer
The amount of time (in minutes) while the messages needs to be sent out.
19 20 21 |
# File 'lib/verizon/models/distribution_schedule.rb', line 19 def duration @duration end |
#repeat_period ⇒ Integer
The period (in seconds) that the message needs to be repeatedly send out.
15 16 17 |
# File 'lib/verizon/models/distribution_schedule.rb', line 15 def repeat_period @repeat_period end |
#start_time ⇒ DateTime
The time (in UTC) when the message transmission should be started.
23 24 25 |
# File 'lib/verizon/models/distribution_schedule.rb', line 23 def start_time @start_time end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/verizon/models/distribution_schedule.rb', line 53 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. repeat_period = hash.key?('repeatPeriod') ? hash['repeatPeriod'] : nil duration = hash.key?('duration') ? hash['duration'] : nil start_time = if hash.key?('startTime') (DateTimeHelper.from_rfc3339(hash['startTime']) if hash['startTime']) else SKIP end # Create object from extracted values. DistributionSchedule.new(repeat_period: repeat_period, duration: duration, start_time: start_time) end |
.names ⇒ Object
A mapping from model property names to API property names.
26 27 28 29 30 31 32 |
# File 'lib/verizon/models/distribution_schedule.rb', line 26 def self.names @_hash = {} if @_hash.nil? @_hash['repeat_period'] = 'repeatPeriod' @_hash['duration'] = 'duration' @_hash['start_time'] = 'startTime' @_hash end |
.nullables ⇒ Object
An array for nullable fields
42 43 44 |
# File 'lib/verizon/models/distribution_schedule.rb', line 42 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
35 36 37 38 39 |
# File 'lib/verizon/models/distribution_schedule.rb', line 35 def self.optionals %w[ start_time ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/verizon/models/distribution_schedule.rb', line 77 def self.validate(value) if value.instance_of? self return ( APIHelper.valid_type?(value.repeat_period, ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value.duration, ->(val) { val.instance_of? Integer }) ) end return false unless value.instance_of? Hash ( APIHelper.valid_type?(value['repeatPeriod'], ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value['duration'], ->(val) { val.instance_of? Integer }) ) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
105 106 107 108 109 |
# File 'lib/verizon/models/distribution_schedule.rb', line 105 def inspect class_name = self.class.name.split('::').last "<#{class_name} repeat_period: #{@repeat_period.inspect}, duration: #{@duration.inspect},"\ " start_time: #{@start_time.inspect}>" end |
#to_custom_start_time ⇒ Object
71 72 73 |
# File 'lib/verizon/models/distribution_schedule.rb', line 71 def to_custom_start_time DateTimeHelper.to_rfc3339(start_time) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
98 99 100 101 102 |
# File 'lib/verizon/models/distribution_schedule.rb', line 98 def to_s class_name = self.class.name.split('::').last "<#{class_name} repeat_period: #{@repeat_period}, duration: #{@duration}, start_time:"\ " #{@start_time}>" end |