Class: Bfwd::MutableBillingEntity

Inherits:
Object
  • Object
show all
Defined in:
lib/bf_ruby2/models/mutable_billing_entity.rb

Overview

Mutable entities are those entities that can be updated after their initial creation.

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ MutableBillingEntity

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
# File 'lib/bf_ruby2/models/mutable_billing_entity.rb', line 154

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}

  if attributes.has_key?(:'created')
    self.created = attributes[:'created']
  end

  if attributes.has_key?(:'changedBy')
    self.changed_by = attributes[:'changedBy']
  end

  if attributes.has_key?(:'updated')
    self.updated = attributes[:'updated']
  end

  if attributes.has_key?(:'id')
    self.id = attributes[:'id']
  end

  if attributes.has_key?(:'configID')
    self.config_id = attributes[:'configID']
  end

  if attributes.has_key?(:'organizationID')
    self.organization_id = attributes[:'organizationID']
  end

  if attributes.has_key?(:'state')
    self.state = attributes[:'state']
  end

  if attributes.has_key?(:'type')
    self.type = attributes[:'type']
  end

  if attributes.has_key?(:'scope')
    self.scope = attributes[:'scope']
  end

  if attributes.has_key?(:'target')
    self.target = attributes[:'target']
  end

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

  if attributes.has_key?(:'description')
    self.description = attributes[:'description']
  end

  if attributes.has_key?(:'dataFrom')
    self.data_from = attributes[:'dataFrom']
  end

  if attributes.has_key?(:'dataTill')
    self.data_till = attributes[:'dataTill']
  end

  if attributes.has_key?(:'started')
    self.started = attributes[:'started']
  end

  if attributes.has_key?(:'stopped')
    self.stopped = attributes[:'stopped']
  end

  if attributes.has_key?(:'createdBy')
    self.created_by = attributes[:'createdBy']
  end

  if attributes.has_key?(:'maxRetryTimes')
    self.max_retry_times = attributes[:'maxRetryTimes']
  end

  if attributes.has_key?(:'retryAttempted')
    self.retry_attempted = attributes[:'retryAttempted']
  end

  if attributes.has_key?(:'deleted')
    self.deleted = attributes[:'deleted']
  else
    self.deleted = false
  end

end

Instance Attribute Details

#changed_byObject

{ "description" : "ID of the user who last updated the entity.", "verbs":[] }



22
23
24
# File 'lib/bf_ruby2/models/mutable_billing_entity.rb', line 22

def changed_by
  @changed_by
end

#config_idObject

This is config id which links to this sync job.



31
32
33
# File 'lib/bf_ruby2/models/mutable_billing_entity.rb', line 31

def config_id
  @config_id
end

#createdObject

{ "description" : "The UTC DateTime when the object was created.", "verbs":[] }



19
20
21
# File 'lib/bf_ruby2/models/mutable_billing_entity.rb', line 19

def created
  @created
end

#created_byObject

The account who created the synch job.



67
68
69
# File 'lib/bf_ruby2/models/mutable_billing_entity.rb', line 67

def created_by
  @created_by
end

#data_fromObject

UTC DateTime of the start of the data to sync.



55
56
57
# File 'lib/bf_ruby2/models/mutable_billing_entity.rb', line 55

def data_from
  @data_from
end

#data_tillObject

UTC DateTime of the start of the data to sync.



58
59
60
# File 'lib/bf_ruby2/models/mutable_billing_entity.rb', line 58

def data_till
  @data_till
end

#deletedObject

Is the sync job deleted.



76
77
78
# File 'lib/bf_ruby2/models/mutable_billing_entity.rb', line 76

def deleted
  @deleted
end

#descriptionObject

Description of the Job.



52
53
54
# File 'lib/bf_ruby2/models/mutable_billing_entity.rb', line 52

def description
  @description
end

#idObject

ID of the Synchronization Job.



28
29
30
# File 'lib/bf_ruby2/models/mutable_billing_entity.rb', line 28

def id
  @id
end

#max_retry_timesObject

The max number of times the records will try to resync.



70
71
72
# File 'lib/bf_ruby2/models/mutable_billing_entity.rb', line 70

def max_retry_times
  @max_retry_times
end

#nameObject

Name of the Job.



49
50
51
# File 'lib/bf_ruby2/models/mutable_billing_entity.rb', line 49

def name
  @name
end

#organization_idObject

Organization associated with the refund.



34
35
36
# File 'lib/bf_ruby2/models/mutable_billing_entity.rb', line 34

def organization_id
  @organization_id
end

#retry_attemptedObject

The number of times the records tried to resync.



73
74
75
# File 'lib/bf_ruby2/models/mutable_billing_entity.rb', line 73

def retry_attempted
  @retry_attempted
end

#scopeObject

The scope of the data synch’d.



43
44
45
# File 'lib/bf_ruby2/models/mutable_billing_entity.rb', line 43

def scope
  @scope
end

#startedObject

UTC DateTime of the end of the data to sync.



61
62
63
# File 'lib/bf_ruby2/models/mutable_billing_entity.rb', line 61

def started
  @started
end

#stateObject

This is the state of job. Pending jobs have not run. Complete jobs have run without error. Failed jobs have one of more errors. Cancelled jobs did not run.



37
38
39
# File 'lib/bf_ruby2/models/mutable_billing_entity.rb', line 37

def state
  @state
end

#stoppedObject

UTC DateTime of the start of the data to sync.



64
65
66
# File 'lib/bf_ruby2/models/mutable_billing_entity.rb', line 64

def stopped
  @stopped
end

#targetObject

This is the target of the job.



46
47
48
# File 'lib/bf_ruby2/models/mutable_billing_entity.rb', line 46

def target
  @target
end

#typeObject

This is the type of job. Incremental jobs just sync changes, fully jobs sync all data.



40
41
42
# File 'lib/bf_ruby2/models/mutable_billing_entity.rb', line 40

def type
  @type
end

#updatedObject

{ "description" : "The UTC DateTime when the object was last updated.", "verbs":[] }



25
26
27
# File 'lib/bf_ruby2/models/mutable_billing_entity.rb', line 25

def updated
  @updated
end

Class Method Details

.attribute_mapObject

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



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/bf_ruby2/models/mutable_billing_entity.rb', line 101

def self.attribute_map
  {
    :'created' => :'created',
    :'changed_by' => :'changedBy',
    :'updated' => :'updated',
    :'id' => :'id',
    :'config_id' => :'configID',
    :'organization_id' => :'organizationID',
    :'state' => :'state',
    :'type' => :'type',
    :'scope' => :'scope',
    :'target' => :'target',
    :'name' => :'name',
    :'description' => :'description',
    :'data_from' => :'dataFrom',
    :'data_till' => :'dataTill',
    :'started' => :'started',
    :'stopped' => :'stopped',
    :'created_by' => :'createdBy',
    :'max_retry_times' => :'maxRetryTimes',
    :'retry_attempted' => :'retryAttempted',
    :'deleted' => :'deleted'
  }
end

.swagger_typesObject

Attribute type mapping.



127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# File 'lib/bf_ruby2/models/mutable_billing_entity.rb', line 127

def self.swagger_types
  {
    :'created' => :'DateTime',
    :'changed_by' => :'String',
    :'updated' => :'DateTime',
    :'id' => :'String',
    :'config_id' => :'String',
    :'organization_id' => :'String',
    :'state' => :'String',
    :'type' => :'String',
    :'scope' => :'String',
    :'target' => :'String',
    :'name' => :'String',
    :'description' => :'String',
    :'data_from' => :'DateTime',
    :'data_till' => :'DateTime',
    :'started' => :'DateTime',
    :'stopped' => :'DateTime',
    :'created_by' => :'String',
    :'max_retry_times' => :'Integer',
    :'retry_attempted' => :'Integer',
    :'deleted' => :'BOOLEAN'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
# File 'lib/bf_ruby2/models/mutable_billing_entity.rb', line 362

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      created == o.created &&
      changed_by == o.changed_by &&
      updated == o.updated &&
      id == o.id &&
      config_id == o.config_id &&
      organization_id == o.organization_id &&
      state == o.state &&
      type == o.type &&
      scope == o.scope &&
      target == o.target &&
      name == o.name &&
      description == o.description &&
      data_from == o.data_from &&
      data_till == o.data_till &&
      started == o.started &&
      stopped == o.stopped &&
      created_by == o.created_by &&
      max_retry_times == o.max_retry_times &&
      retry_attempted == o.retry_attempted &&
      deleted == o.deleted
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
# File 'lib/bf_ruby2/models/mutable_billing_entity.rb', line 423

def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    DateTime.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :BOOLEAN
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    temp_model = Bfwd.const_get(type).new
    temp_model.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



489
490
491
492
493
494
495
496
497
498
499
500
501
# File 'lib/bf_ruby2/models/mutable_billing_entity.rb', line 489

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map{ |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
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



402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
# File 'lib/bf_ruby2/models/mutable_billing_entity.rb', line 402

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.swagger_types.each_pair do |key, type|
    if type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


389
390
391
# File 'lib/bf_ruby2/models/mutable_billing_entity.rb', line 389

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



395
396
397
# File 'lib/bf_ruby2/models/mutable_billing_entity.rb', line 395

def hash
  [created, changed_by, updated, id, config_id, organization_id, state, type, scope, target, name, description, data_from, data_till, started, stopped, created_by, max_retry_times, retry_attempted, deleted].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properies with the reasons



246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
# File 'lib/bf_ruby2/models/mutable_billing_entity.rb', line 246

def list_invalid_properties
  invalid_properties = Array.new
  if @config_id.nil?
    invalid_properties.push("invalid value for 'config_id', config_id cannot be nil.")
  end

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

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

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

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

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

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

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

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

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

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

  return invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



469
470
471
# File 'lib/bf_ruby2/models/mutable_billing_entity.rb', line 469

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



475
476
477
478
479
480
481
482
483
# File 'lib/bf_ruby2/models/mutable_billing_entity.rb', line 475

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    next if value.nil?
    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



463
464
465
# File 'lib/bf_ruby2/models/mutable_billing_entity.rb', line 463

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
# File 'lib/bf_ruby2/models/mutable_billing_entity.rb', line 297

def valid?
  return false if @config_id.nil?
  return false if @organization_id.nil?
  return false if @state.nil?
  state_validator = EnumAttributeValidator.new('String', ["Pending", "Complete", "Failed", "Cancelled", "Processing"])
  return false unless state_validator.valid?(@state)
  return false if @type.nil?
  type_validator = EnumAttributeValidator.new('String', ["Incremental", "Full"])
  return false unless type_validator.valid?(@type)
  return false if @scope.nil?
  scope_validator = EnumAttributeValidator.new('String', ["Manual", "Scheduled"])
  return false unless scope_validator.valid?(@scope)
  return false if @target.nil?
  target_validator = EnumAttributeValidator.new('String', ["Salesforce"])
  return false unless target_validator.valid?(@target)
  return false if @name.nil?
  return false if @description.nil?
  return false if @max_retry_times.nil?
  return false if @retry_attempted.nil?
  return false if @deleted.nil?
  return true
end