Class: WalmartApIs::CreateReportSpecification

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

Overview

CreateReportSpecification 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:, data_start_time: SKIP, data_end_time: SKIP, report_options: SKIP, marketplace_ids: SKIP, additional_properties: nil) ⇒ CreateReportSpecification

Returns a new instance of CreateReportSpecification.



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

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

  @report_type = report_type
  @data_start_time = data_start_time unless data_start_time == SKIP
  @data_end_time = data_end_time unless data_end_time == SKIP
  @report_options = report_options unless report_options == SKIP
  @marketplace_ids = marketplace_ids unless marketplace_ids == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#data_end_timeDateTime

Report type — Walmart Partner Reporting Platform enum name. Runtime availability is CCM-controlled; consult PRP docs for current PROD-enabled types.

Returns:

  • (DateTime)


29
30
31
# File 'lib/walmart_ap_is/models/create_report_specification.rb', line 29

def data_end_time
  @data_end_time
end

#data_start_timeDateTime

Report type — Walmart Partner Reporting Platform enum name. Runtime availability is CCM-controlled; consult PRP docs for current PROD-enabled types.

Returns:

  • (DateTime)


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

def data_start_time
  @data_start_time
end

#marketplace_idsArray[MarketplaceId]

Additional report-type-specific options

Returns:



37
38
39
# File 'lib/walmart_ap_is/models/create_report_specification.rb', line 37

def marketplace_ids
  @marketplace_ids
end

#report_optionsHash[String, String]

Additional report-type-specific options

Returns:

  • (Hash[String, String])


33
34
35
# File 'lib/walmart_ap_is/models/create_report_specification.rb', line 33

def report_options
  @report_options
end

#report_typeReportType

Report type — Walmart Partner Reporting Platform enum name. Runtime availability is CCM-controlled; consult PRP docs for current PROD-enabled types.

Returns:



17
18
19
# File 'lib/walmart_ap_is/models/create_report_specification.rb', line 17

def report_type
  @report_type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
106
107
108
109
110
111
112
113
# File 'lib/walmart_ap_is/models/create_report_specification.rb', line 80

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  report_type = hash.key?('reportType') ? hash['reportType'] : nil
  data_start_time = if hash.key?('dataStartTime')
                      (DateTimeHelper.from_rfc3339(hash['dataStartTime']) if hash['dataStartTime'])
                    else
                      SKIP
                    end
  data_end_time = if hash.key?('dataEndTime')
                    (DateTimeHelper.from_rfc3339(hash['dataEndTime']) if hash['dataEndTime'])
                  else
                    SKIP
                  end
  report_options = hash.key?('reportOptions') ? hash['reportOptions'] : SKIP
  marketplace_ids =
    hash.key?('marketplaceIds') ? hash['marketplaceIds'] : SKIP

  # 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.
  CreateReportSpecification.new(report_type: report_type,
                                data_start_time: data_start_time,
                                data_end_time: data_end_time,
                                report_options: report_options,
                                marketplace_ids: marketplace_ids,
                                additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



40
41
42
43
44
45
46
47
48
# File 'lib/walmart_ap_is/models/create_report_specification.rb', line 40

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['report_type'] = 'reportType'
  @_hash['data_start_time'] = 'dataStartTime'
  @_hash['data_end_time'] = 'dataEndTime'
  @_hash['report_options'] = 'reportOptions'
  @_hash['marketplace_ids'] = 'marketplaceIds'
  @_hash
end

.nullablesObject

An array for nullable fields



61
62
63
# File 'lib/walmart_ap_is/models/create_report_specification.rb', line 61

def self.nullables
  []
end

.optionalsObject

An array for optional fields



51
52
53
54
55
56
57
58
# File 'lib/walmart_ap_is/models/create_report_specification.rb', line 51

def self.optionals
  %w[
    data_start_time
    data_end_time
    report_options
    marketplace_ids
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



132
133
134
135
136
137
138
# File 'lib/walmart_ap_is/models/create_report_specification.rb', line 132

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

#to_custom_data_end_timeObject



119
120
121
# File 'lib/walmart_ap_is/models/create_report_specification.rb', line 119

def to_custom_data_end_time
  DateTimeHelper.to_rfc3339(data_end_time)
end

#to_custom_data_start_timeObject



115
116
117
# File 'lib/walmart_ap_is/models/create_report_specification.rb', line 115

def to_custom_data_start_time
  DateTimeHelper.to_rfc3339(data_start_time)
end

#to_sObject

Provides a human-readable string representation of the object.



124
125
126
127
128
129
# File 'lib/walmart_ap_is/models/create_report_specification.rb', line 124

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