Class: Zernio::RecyclingState
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- Zernio::RecyclingState
- Defined in:
- lib/zernio-sdk/models/recycling_state.rb
Overview
Current recycling configuration and state on a post
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#content_variation_index ⇒ Object
Current position in the content variations rotation (read-only).
-
#content_variations ⇒ Object
Content variations for recycled copies (if configured).
-
#enabled ⇒ Object
Whether recycling is currently active.
-
#expire_count ⇒ Object
Returns the value of attribute expire_count.
-
#expire_date ⇒ Object
Returns the value of attribute expire_date.
-
#gap ⇒ Object
Number of interval units between reposts.
-
#gap_freq ⇒ Object
Interval unit (week or month).
-
#last_recycled_at ⇒ Object
When the last recycled copy was created (read-only).
-
#next_recycle_at ⇒ Object
When the next recycled copy will be created (read-only).
-
#recycle_count ⇒ Object
How many recycled copies have been created so far (read-only).
-
#start_date ⇒ Object
Returns the value of attribute start_date.
Class Method Summary collapse
-
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ RecyclingState
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Methods inherited from ApiModelBase
_deserialize, #_to_hash, #to_body, #to_s
Constructor Details
#initialize(attributes = {}) ⇒ RecyclingState
Initializes the object
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 181 182 |
# File 'lib/zernio-sdk/models/recycling_state.rb', line 123 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::RecyclingState` 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 `Zernio::RecyclingState`. 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?(:'enabled') self.enabled = attributes[:'enabled'] end if attributes.key?(:'gap') self.gap = attributes[:'gap'] end if attributes.key?(:'gap_freq') self.gap_freq = attributes[:'gap_freq'] end if attributes.key?(:'start_date') self.start_date = attributes[:'start_date'] end if attributes.key?(:'expire_count') self.expire_count = attributes[:'expire_count'] end if attributes.key?(:'expire_date') self.expire_date = attributes[:'expire_date'] end if attributes.key?(:'content_variations') if (value = attributes[:'content_variations']).is_a?(Array) self.content_variations = value end end if attributes.key?(:'content_variation_index') self.content_variation_index = attributes[:'content_variation_index'] end if attributes.key?(:'recycle_count') self.recycle_count = attributes[:'recycle_count'] end if attributes.key?(:'next_recycle_at') self.next_recycle_at = attributes[:'next_recycle_at'] end if attributes.key?(:'last_recycled_at') self.last_recycled_at = attributes[:'last_recycled_at'] end end |
Instance Attribute Details
#content_variation_index ⇒ Object
Current position in the content variations rotation (read-only)
38 39 40 |
# File 'lib/zernio-sdk/models/recycling_state.rb', line 38 def content_variation_index @content_variation_index end |
#content_variations ⇒ Object
Content variations for recycled copies (if configured)
35 36 37 |
# File 'lib/zernio-sdk/models/recycling_state.rb', line 35 def content_variations @content_variations end |
#enabled ⇒ Object
Whether recycling is currently active
20 21 22 |
# File 'lib/zernio-sdk/models/recycling_state.rb', line 20 def enabled @enabled end |
#expire_count ⇒ Object
Returns the value of attribute expire_count.
30 31 32 |
# File 'lib/zernio-sdk/models/recycling_state.rb', line 30 def expire_count @expire_count end |
#expire_date ⇒ Object
Returns the value of attribute expire_date.
32 33 34 |
# File 'lib/zernio-sdk/models/recycling_state.rb', line 32 def expire_date @expire_date end |
#gap ⇒ Object
Number of interval units between reposts
23 24 25 |
# File 'lib/zernio-sdk/models/recycling_state.rb', line 23 def gap @gap end |
#gap_freq ⇒ Object
Interval unit (week or month)
26 27 28 |
# File 'lib/zernio-sdk/models/recycling_state.rb', line 26 def gap_freq @gap_freq end |
#last_recycled_at ⇒ Object
When the last recycled copy was created (read-only)
47 48 49 |
# File 'lib/zernio-sdk/models/recycling_state.rb', line 47 def last_recycled_at @last_recycled_at end |
#next_recycle_at ⇒ Object
When the next recycled copy will be created (read-only)
44 45 46 |
# File 'lib/zernio-sdk/models/recycling_state.rb', line 44 def next_recycle_at @next_recycle_at end |
#recycle_count ⇒ Object
How many recycled copies have been created so far (read-only)
41 42 43 |
# File 'lib/zernio-sdk/models/recycling_state.rb', line 41 def recycle_count @recycle_count end |
#start_date ⇒ Object
Returns the value of attribute start_date.
28 29 30 |
# File 'lib/zernio-sdk/models/recycling_state.rb', line 28 def start_date @start_date end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
89 90 91 |
# File 'lib/zernio-sdk/models/recycling_state.rb', line 89 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
94 95 96 |
# File 'lib/zernio-sdk/models/recycling_state.rb', line 94 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/zernio-sdk/models/recycling_state.rb', line 72 def self.attribute_map { :'enabled' => :'enabled', :'gap' => :'gap', :'gap_freq' => :'gapFreq', :'start_date' => :'startDate', :'expire_count' => :'expireCount', :'expire_date' => :'expireDate', :'content_variations' => :'contentVariations', :'content_variation_index' => :'contentVariationIndex', :'recycle_count' => :'recycleCount', :'next_recycle_at' => :'nextRecycleAt', :'last_recycled_at' => :'lastRecycledAt' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 |
# File 'lib/zernio-sdk/models/recycling_state.rb', line 244 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_nullable ⇒ Object
List of attributes with nullable: true
116 117 118 119 |
# File 'lib/zernio-sdk/models/recycling_state.rb', line 116 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/zernio-sdk/models/recycling_state.rb', line 99 def self.openapi_types { :'enabled' => :'Boolean', :'gap' => :'Integer', :'gap_freq' => :'String', :'start_date' => :'Time', :'expire_count' => :'Integer', :'expire_date' => :'Time', :'content_variations' => :'Array<String>', :'content_variation_index' => :'Integer', :'recycle_count' => :'Integer', :'next_recycle_at' => :'Time', :'last_recycled_at' => :'Time' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 |
# File 'lib/zernio-sdk/models/recycling_state.rb', line 213 def ==(o) return true if self.equal?(o) self.class == o.class && enabled == o.enabled && gap == o.gap && gap_freq == o.gap_freq && start_date == o.start_date && expire_count == o.expire_count && expire_date == o.expire_date && content_variations == o.content_variations && content_variation_index == o.content_variation_index && recycle_count == o.recycle_count && next_recycle_at == o.next_recycle_at && last_recycled_at == o.last_recycled_at end |
#eql?(o) ⇒ Boolean
231 232 233 |
# File 'lib/zernio-sdk/models/recycling_state.rb', line 231 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
237 238 239 |
# File 'lib/zernio-sdk/models/recycling_state.rb', line 237 def hash [enabled, gap, gap_freq, start_date, expire_count, expire_date, content_variations, content_variation_index, recycle_count, next_recycle_at, last_recycled_at].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
186 187 188 189 190 |
# File 'lib/zernio-sdk/models/recycling_state.rb', line 186 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
266 267 268 269 270 271 272 273 274 275 276 277 278 |
# File 'lib/zernio-sdk/models/recycling_state.rb', line 266 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
194 195 196 197 198 199 |
# File 'lib/zernio-sdk/models/recycling_state.rb', line 194 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' gap_freq_validator = EnumAttributeValidator.new('String', ["week", "month"]) return false unless gap_freq_validator.valid?(@gap_freq) true end |