Class: WalmartApIs::ReportSchedule

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/walmart_ap_is/models/report_schedule.rb

Overview

ReportSchedule Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(report_schedule_id:, report_type:, period:, next_report_creation_time: SKIP, additional_properties: nil) ⇒ ReportSchedule

Returns a new instance of ReportSchedule.



51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/walmart_ap_is/models/report_schedule.rb', line 51

def initialize(report_schedule_id:, report_type:, period:,
               next_report_creation_time: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @report_schedule_id = report_schedule_id
  @report_type = report_type
  @period = period
  unless next_report_creation_time == SKIP
    @next_report_creation_time =
      next_report_creation_time
  end
  @additional_properties = additional_properties
end

Instance Attribute Details

#next_report_creation_timeDateTime

ISO 8601 duration for schedule recurrence

Returns:

  • (DateTime)


27
28
29
# File 'lib/walmart_ap_is/models/report_schedule.rb', line 27

def next_report_creation_time
  @next_report_creation_time
end

#periodPeriod

ISO 8601 duration for schedule recurrence

Returns:



23
24
25
# File 'lib/walmart_ap_is/models/report_schedule.rb', line 23

def period
  @period
end

#report_schedule_idString

TODO: Write general description for this method

Returns:

  • (String)


15
16
17
# File 'lib/walmart_ap_is/models/report_schedule.rb', line 15

def report_schedule_id
  @report_schedule_id
end

#report_typeString

TODO: Write general description for this method

Returns:

  • (String)


19
20
21
# File 'lib/walmart_ap_is/models/report_schedule.rb', line 19

def report_type
  @report_type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/walmart_ap_is/models/report_schedule.rb', line 67

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  report_schedule_id =
    hash.key?('reportScheduleId') ? hash['reportScheduleId'] : nil
  report_type = hash.key?('reportType') ? hash['reportType'] : nil
  period = hash.key?('period') ? hash['period'] : nil
  next_report_creation_time = if hash.key?('nextReportCreationTime')
                                (DateTimeHelper.from_rfc3339(hash['nextReportCreationTime']) if hash['nextReportCreationTime'])
                              else
                                SKIP
                              end

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  ReportSchedule.new(report_schedule_id: report_schedule_id,
                     report_type: report_type,
                     period: period,
                     next_report_creation_time: next_report_creation_time,
                     additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



30
31
32
33
34
35
36
37
# File 'lib/walmart_ap_is/models/report_schedule.rb', line 30

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['report_schedule_id'] = 'reportScheduleId'
  @_hash['report_type'] = 'reportType'
  @_hash['period'] = 'period'
  @_hash['next_report_creation_time'] = 'nextReportCreationTime'
  @_hash
end

.nullablesObject

An array for nullable fields



47
48
49
# File 'lib/walmart_ap_is/models/report_schedule.rb', line 47

def self.nullables
  []
end

.optionalsObject

An array for optional fields



40
41
42
43
44
# File 'lib/walmart_ap_is/models/report_schedule.rb', line 40

def self.optionals
  %w[
    next_report_creation_time
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



109
110
111
112
113
114
# File 'lib/walmart_ap_is/models/report_schedule.rb', line 109

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} report_schedule_id: #{@report_schedule_id.inspect}, report_type:"\
  " #{@report_type.inspect}, period: #{@period.inspect}, next_report_creation_time:"\
  " #{@next_report_creation_time.inspect}, additional_properties: #{@additional_properties}>"
end

#to_custom_next_report_creation_timeObject



96
97
98
# File 'lib/walmart_ap_is/models/report_schedule.rb', line 96

def to_custom_next_report_creation_time
  DateTimeHelper.to_rfc3339(next_report_creation_time)
end

#to_sObject

Provides a human-readable string representation of the object.



101
102
103
104
105
106
# File 'lib/walmart_ap_is/models/report_schedule.rb', line 101

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} report_schedule_id: #{@report_schedule_id}, report_type: #{@report_type},"\
  " period: #{@period}, next_report_creation_time: #{@next_report_creation_time},"\
  " additional_properties: #{@additional_properties}>"
end