Class: PinterestSdkClient::ScheduleCreateRequest

Inherits:
ApiModelBase
  • Object
show all
Defined in:
lib/pinterest_sdk/models/schedule_create_request.rb

Defined Under Namespace

Classes: EnumAttributeValidator

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 = {}) ⇒ ScheduleCreateRequest

Initializes the object

Parameters:

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

    Model attributes in the form of hash



109
110
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
# File 'lib/pinterest_sdk/models/schedule_create_request.rb', line 109

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `PinterestSdkClient::ScheduleCreateRequest` 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 `PinterestSdkClient::ScheduleCreateRequest`. 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?(:'entity_id')
    self.entity_id = attributes[:'entity_id']
  else
    self.entity_id = nil
  end

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

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

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

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

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

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

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

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

Instance Attribute Details

#delta_valueObject

Returns the value of attribute delta_value.



23
24
25
# File 'lib/pinterest_sdk/models/schedule_create_request.rb', line 23

def delta_value
  @delta_value
end

#end_timestampObject

Schedule end time. Unix timestamp in seconds.



26
27
28
# File 'lib/pinterest_sdk/models/schedule_create_request.rb', line 26

def end_timestamp
  @end_timestamp
end

#entity_idObject

Returns the value of attribute entity_id.



18
19
20
# File 'lib/pinterest_sdk/models/schedule_create_request.rb', line 18

def entity_id
  @entity_id
end

#entity_typeObject

Entity type



21
22
23
# File 'lib/pinterest_sdk/models/schedule_create_request.rb', line 21

def entity_type
  @entity_type
end

#nameObject

Returns the value of attribute name.



28
29
30
# File 'lib/pinterest_sdk/models/schedule_create_request.rb', line 28

def name
  @name
end

#schedule_actionObject

Returns the value of attribute schedule_action.



30
31
32
# File 'lib/pinterest_sdk/models/schedule_create_request.rb', line 30

def schedule_action
  @schedule_action
end

#schedule_statusObject

Returns the value of attribute schedule_status.



32
33
34
# File 'lib/pinterest_sdk/models/schedule_create_request.rb', line 32

def schedule_status
  @schedule_status
end

#schedule_typeObject

Returns the value of attribute schedule_type.



34
35
36
# File 'lib/pinterest_sdk/models/schedule_create_request.rb', line 34

def schedule_type
  @schedule_type
end

#start_timestampObject

Schedule start time. Unix timestamp in seconds.



37
38
39
# File 'lib/pinterest_sdk/models/schedule_create_request.rb', line 37

def start_timestamp
  @start_timestamp
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



77
78
79
# File 'lib/pinterest_sdk/models/schedule_create_request.rb', line 77

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



82
83
84
# File 'lib/pinterest_sdk/models/schedule_create_request.rb', line 82

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/pinterest_sdk/models/schedule_create_request.rb', line 62

def self.attribute_map
  {
    :'entity_id' => :'entity_id',
    :'entity_type' => :'entity_type',
    :'delta_value' => :'delta_value',
    :'end_timestamp' => :'end_timestamp',
    :'name' => :'name',
    :'schedule_action' => :'schedule_action',
    :'schedule_status' => :'schedule_status',
    :'schedule_type' => :'schedule_type',
    :'start_timestamp' => :'start_timestamp'
  }
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



370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
# File 'lib/pinterest_sdk/models/schedule_create_request.rb', line 370

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



102
103
104
105
# File 'lib/pinterest_sdk/models/schedule_create_request.rb', line 102

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

.openapi_typesObject

Attribute type mapping.



87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/pinterest_sdk/models/schedule_create_request.rb', line 87

def self.openapi_types
  {
    :'entity_id' => :'String',
    :'entity_type' => :'String',
    :'delta_value' => :'ScheduleCommonDeltaValue',
    :'end_timestamp' => :'Integer',
    :'name' => :'String',
    :'schedule_action' => :'ScheduleAction',
    :'schedule_status' => :'ScheduleStatus',
    :'schedule_type' => :'ScheduleType',
    :'start_timestamp' => :'Integer'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



341
342
343
344
345
346
347
348
349
350
351
352
353
# File 'lib/pinterest_sdk/models/schedule_create_request.rb', line 341

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      entity_id == o.entity_id &&
      entity_type == o.entity_type &&
      delta_value == o.delta_value &&
      end_timestamp == o.end_timestamp &&
      name == o.name &&
      schedule_action == o.schedule_action &&
      schedule_status == o.schedule_status &&
      schedule_type == o.schedule_type &&
      start_timestamp == o.start_timestamp
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


357
358
359
# File 'lib/pinterest_sdk/models/schedule_create_request.rb', line 357

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



363
364
365
# File 'lib/pinterest_sdk/models/schedule_create_request.rb', line 363

def hash
  [entity_id, entity_type, delta_value, end_timestamp, name, schedule_action, schedule_status, schedule_type, start_timestamp].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
# File 'lib/pinterest_sdk/models/schedule_create_request.rb', line 180

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

  pattern = Regexp.new(/^[C]?\d+$/)
  if @entity_id !~ pattern
    invalid_properties.push("invalid value for \"entity_id\", must conform to the pattern #{pattern}.")
  end

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

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

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

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

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

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

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

  if @start_timestamp.nil?
    invalid_properties.push('invalid value for "start_timestamp", start_timestamp 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



392
393
394
395
396
397
398
399
400
401
402
403
404
# File 'lib/pinterest_sdk/models/schedule_create_request.rb', line 392

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



229
230
231
232
233
234
235
236
237
238
239
240
241
242
# File 'lib/pinterest_sdk/models/schedule_create_request.rb', line 229

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @entity_id.nil?
  return false if @entity_id !~ Regexp.new(/^[C]?\d+$/)
  return false if @entity_type.nil?
  return false if @delta_value.nil?
  return false if @end_timestamp.nil?
  return false if @name.nil?
  return false if @schedule_action.nil?
  return false if @schedule_status.nil?
  return false if @schedule_type.nil?
  return false if @start_timestamp.nil?
  true
end