Class: WalmartApIs::CreateReportScheduleSpecification

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

Overview

CreateReportScheduleSpecification 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_type:, period:, marketplace_ids: SKIP, report_options: SKIP, next_report_creation_time: SKIP, additional_properties: nil) ⇒ CreateReportScheduleSpecification

Returns a new instance of CreateReportScheduleSpecification.



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/walmart_ap_is/models/create_report_schedule_specification.rb', line 58

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

  @report_type = report_type
  @period = period
  @marketplace_ids = marketplace_ids unless marketplace_ids == SKIP
  @report_options = report_options unless report_options == SKIP
  unless next_report_creation_time == SKIP
    @next_report_creation_time =
      next_report_creation_time
  end
  @additional_properties = additional_properties
end

Instance Attribute Details

#marketplace_idsArray[MarketplaceId]

TODO: Write general description for this method

Returns:



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

def marketplace_ids
  @marketplace_ids
end

#next_report_creation_timeDateTime

When to first run the schedule (default now)

Returns:

  • (DateTime)


31
32
33
# File 'lib/walmart_ap_is/models/create_report_schedule_specification.rb', line 31

def next_report_creation_time
  @next_report_creation_time
end

#periodPeriod1

TODO: Write general description for this method

Returns:



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

def period
  @period
end

#report_optionsHash[String, String]

TODO: Write general description for this method

Returns:

  • (Hash[String, String])


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

def report_options
  @report_options
end

#report_typeString

TODO: Write general description for this method

Returns:

  • (String)


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

def report_type
  @report_type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/walmart_ap_is/models/create_report_schedule_specification.rb', line 76

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  report_type = hash.key?('reportType') ? hash['reportType'] : nil
  period = hash.key?('period') ? hash['period'] : nil
  marketplace_ids =
    hash.key?('marketplaceIds') ? hash['marketplaceIds'] : SKIP
  report_options = hash.key?('reportOptions') ? hash['reportOptions'] : SKIP
  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.
  CreateReportScheduleSpecification.new(report_type: report_type,
                                        period: period,
                                        marketplace_ids: marketplace_ids,
                                        report_options: report_options,
                                        next_report_creation_time: next_report_creation_time,
                                        additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



34
35
36
37
38
39
40
41
42
# File 'lib/walmart_ap_is/models/create_report_schedule_specification.rb', line 34

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['report_type'] = 'reportType'
  @_hash['period'] = 'period'
  @_hash['marketplace_ids'] = 'marketplaceIds'
  @_hash['report_options'] = 'reportOptions'
  @_hash['next_report_creation_time'] = 'nextReportCreationTime'
  @_hash
end

.nullablesObject

An array for nullable fields



54
55
56
# File 'lib/walmart_ap_is/models/create_report_schedule_specification.rb', line 54

def self.nullables
  []
end

.optionalsObject

An array for optional fields



45
46
47
48
49
50
51
# File 'lib/walmart_ap_is/models/create_report_schedule_specification.rb', line 45

def self.optionals
  %w[
    marketplace_ids
    report_options
    next_report_creation_time
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



120
121
122
123
124
125
126
# File 'lib/walmart_ap_is/models/create_report_schedule_specification.rb', line 120

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

#to_custom_next_report_creation_timeObject



107
108
109
# File 'lib/walmart_ap_is/models/create_report_schedule_specification.rb', line 107

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.



112
113
114
115
116
117
# File 'lib/walmart_ap_is/models/create_report_schedule_specification.rb', line 112

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