Class: PinterestSdkClient::ScheduleUpdateRequest

Inherits:
ApiModelBase
  • Object
show all
Defined in:
lib/pinterest_sdk/models/schedule_update_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 = {}) ⇒ ScheduleUpdateRequest

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
# File 'lib/pinterest_sdk/models/schedule_update_request.rb', line 114

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#delta_valueObject

Returns the value of attribute delta_value.



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

def delta_value
  @delta_value
end

#end_timestampObject

Schedule end time. Unix timestamp in seconds.



29
30
31
# File 'lib/pinterest_sdk/models/schedule_update_request.rb', line 29

def end_timestamp
  @end_timestamp
end

#entity_idObject

Returns the value of attribute entity_id.



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

def entity_id
  @entity_id
end

#entity_typeObject

Entity type



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

def entity_type
  @entity_type
end

#idObject

Schedule ID.



24
25
26
# File 'lib/pinterest_sdk/models/schedule_update_request.rb', line 24

def id
  @id
end

#nameObject

Returns the value of attribute name.



31
32
33
# File 'lib/pinterest_sdk/models/schedule_update_request.rb', line 31

def name
  @name
end

#schedule_actionObject

Returns the value of attribute schedule_action.



33
34
35
# File 'lib/pinterest_sdk/models/schedule_update_request.rb', line 33

def schedule_action
  @schedule_action
end

#schedule_statusObject

Returns the value of attribute schedule_status.



35
36
37
# File 'lib/pinterest_sdk/models/schedule_update_request.rb', line 35

def schedule_status
  @schedule_status
end

#schedule_typeObject

Returns the value of attribute schedule_type.



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

def schedule_type
  @schedule_type
end

#start_timestampObject

Schedule start time. Unix timestamp in seconds.



40
41
42
# File 'lib/pinterest_sdk/models/schedule_update_request.rb', line 40

def start_timestamp
  @start_timestamp
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



81
82
83
# File 'lib/pinterest_sdk/models/schedule_update_request.rb', line 81

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



86
87
88
# File 'lib/pinterest_sdk/models/schedule_update_request.rb', line 86

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/pinterest_sdk/models/schedule_update_request.rb', line 65

def self.attribute_map
  {
    :'entity_id' => :'entity_id',
    :'entity_type' => :'entity_type',
    :'id' => :'id',
    :'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



254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
# File 'lib/pinterest_sdk/models/schedule_update_request.rb', line 254

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



107
108
109
110
# File 'lib/pinterest_sdk/models/schedule_update_request.rb', line 107

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

.openapi_typesObject

Attribute type mapping.



91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/pinterest_sdk/models/schedule_update_request.rb', line 91

def self.openapi_types
  {
    :'entity_id' => :'String',
    :'entity_type' => :'String',
    :'id' => :'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



224
225
226
227
228
229
230
231
232
233
234
235
236
237
# File 'lib/pinterest_sdk/models/schedule_update_request.rb', line 224

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      entity_id == o.entity_id &&
      entity_type == o.entity_type &&
      id == o.id &&
      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


241
242
243
# File 'lib/pinterest_sdk/models/schedule_update_request.rb', line 241

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



247
248
249
# File 'lib/pinterest_sdk/models/schedule_update_request.rb', line 247

def hash
  [entity_id, entity_type, id, 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



173
174
175
176
177
178
179
180
181
182
183
184
185
186
# File 'lib/pinterest_sdk/models/schedule_update_request.rb', line 173

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  pattern = Regexp.new(/^[C]?\d+$/)
  if !@entity_id.nil? && @entity_id !~ pattern
    invalid_properties.push("invalid value for \"entity_id\", must conform to the pattern #{pattern}.")
  end

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



276
277
278
279
280
281
282
283
284
285
286
287
288
# File 'lib/pinterest_sdk/models/schedule_update_request.rb', line 276

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



190
191
192
193
194
195
# File 'lib/pinterest_sdk/models/schedule_update_request.rb', line 190

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if !@entity_id.nil? && @entity_id !~ Regexp.new(/^[C]?\d+$/)
  return false if @id.nil?
  true
end