Class: CyberSourceMergedSpec::CreateAdhocReportRequest

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/cyber_source_merged_spec/models/create_adhoc_report_request.rb

Overview

CreateAdhocReportRequest 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(organization_id: SKIP, report_definition_name: SKIP, report_fields: SKIP, report_mime_type: SKIP, report_name: SKIP, timezone: SKIP, report_start_time: SKIP, report_end_time: SKIP, report_filters: SKIP, report_preferences: SKIP, group_name: SKIP, additional_properties: nil) ⇒ CreateAdhocReportRequest

Returns a new instance of CreateAdhocReportRequest.



100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/cyber_source_merged_spec/models/create_adhoc_report_request.rb', line 100

def initialize(organization_id: SKIP, report_definition_name: SKIP,
               report_fields: SKIP, report_mime_type: SKIP,
               report_name: SKIP, timezone: SKIP, report_start_time: SKIP,
               report_end_time: SKIP, report_filters: SKIP,
               report_preferences: SKIP, group_name: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @organization_id = organization_id unless organization_id == SKIP
  @report_definition_name = report_definition_name unless report_definition_name == SKIP
  @report_fields = report_fields unless report_fields == SKIP
  @report_mime_type = report_mime_type unless report_mime_type == SKIP
  @report_name = report_name unless report_name == SKIP
  @timezone = timezone unless timezone == SKIP
  @report_start_time = report_start_time unless report_start_time == SKIP
  @report_end_time = report_end_time unless report_end_time == SKIP
  @report_filters = report_filters unless report_filters == SKIP
  @report_preferences = report_preferences unless report_preferences == SKIP
  @group_name = group_name unless group_name == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#group_nameString

Specifies the group name

Returns:

  • (String)


59
60
61
# File 'lib/cyber_source_merged_spec/models/create_adhoc_report_request.rb', line 59

def group_name
  @group_name
end

#organization_idString

Valid CyberSource Organization Id

Returns:

  • (String)


15
16
17
# File 'lib/cyber_source_merged_spec/models/create_adhoc_report_request.rb', line 15

def organization_id
  @organization_id
end

#report_definition_nameString

Valid CyberSource Organization Id

Returns:

  • (String)


19
20
21
# File 'lib/cyber_source_merged_spec/models/create_adhoc_report_request.rb', line 19

def report_definition_name
  @report_definition_name
end

#report_end_timeDateTime

End time of the report

Returns:

  • (DateTime)


47
48
49
# File 'lib/cyber_source_merged_spec/models/create_adhoc_report_request.rb', line 47

def report_end_time
  @report_end_time
end

#report_fieldsArray[String]

List of fields which needs to get included in a report

Returns:

  • (Array[String])


23
24
25
# File 'lib/cyber_source_merged_spec/models/create_adhoc_report_request.rb', line 23

def report_fields
  @report_fields
end

#report_filtersReportFilters

End time of the report

Returns:



51
52
53
# File 'lib/cyber_source_merged_spec/models/create_adhoc_report_request.rb', line 51

def report_filters
  @report_filters
end

#report_mime_typeString

'Format of the report'

Valid values:

  • application/xml
  • text/csv

Returns:

  • (String)


31
32
33
# File 'lib/cyber_source_merged_spec/models/create_adhoc_report_request.rb', line 31

def report_mime_type
  @report_mime_type
end

#report_nameString

Name of the report

Returns:

  • (String)


35
36
37
# File 'lib/cyber_source_merged_spec/models/create_adhoc_report_request.rb', line 35

def report_name
  @report_name
end

#report_preferencesReportPreferences

Report Preferences

Returns:



55
56
57
# File 'lib/cyber_source_merged_spec/models/create_adhoc_report_request.rb', line 55

def report_preferences
  @report_preferences
end

#report_start_timeDateTime

Start time of the report

Returns:

  • (DateTime)


43
44
45
# File 'lib/cyber_source_merged_spec/models/create_adhoc_report_request.rb', line 43

def report_start_time
  @report_start_time
end

#timezoneString

Timezone of the report

Returns:

  • (String)


39
40
41
# File 'lib/cyber_source_merged_spec/models/create_adhoc_report_request.rb', line 39

def timezone
  @timezone
end

Class Method Details

.from_element(root) ⇒ Object



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
# File 'lib/cyber_source_merged_spec/models/create_adhoc_report_request.rb', line 182

def self.from_element(root)
  organization_id = XmlUtilities.from_element(root, 'organizationId',
                                              String)
  report_definition_name = XmlUtilities.from_element(root,
                                                     'reportDefinitionName',
                                                     String)
  report_fields = XmlUtilities.from_element_to_array(root, 'reportFields',
                                                     String)
  report_mime_type = XmlUtilities.from_element(root, 'reportMimeType',
                                               String)
  report_name = XmlUtilities.from_element(root, 'reportName', String)
  timezone = XmlUtilities.from_element(root, 'timezone', String)
  report_start_time = XmlUtilities.from_element(root, 'reportStartTime',
                                                String,
                                                datetime_format: 'rfc3339')
  report_end_time = XmlUtilities.from_element(root, 'reportEndTime', String,
                                              datetime_format: 'rfc3339')
  report_filters = XmlUtilities.from_element(root, 'ReportFilters',
                                             ReportFilters)
  report_preferences = XmlUtilities.from_element(root, 'ReportPreferences',
                                                 ReportPreferences)
  group_name = XmlUtilities.from_element(root, 'groupName', String)

  new(organization_id: organization_id,
      report_definition_name: report_definition_name,
      report_fields: report_fields,
      report_mime_type: report_mime_type,
      report_name: report_name,
      timezone: timezone,
      report_start_time: report_start_time,
      report_end_time: report_end_time,
      report_filters: report_filters,
      report_preferences: report_preferences,
      group_name: group_name,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
170
171
172
# File 'lib/cyber_source_merged_spec/models/create_adhoc_report_request.rb', line 124

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  organization_id =
    hash.key?('organizationId') ? hash['organizationId'] : SKIP
  report_definition_name =
    hash.key?('reportDefinitionName') ? hash['reportDefinitionName'] : SKIP
  report_fields = hash.key?('reportFields') ? hash['reportFields'] : SKIP
  report_mime_type =
    hash.key?('reportMimeType') ? hash['reportMimeType'] : SKIP
  report_name = hash.key?('reportName') ? hash['reportName'] : SKIP
  timezone = hash.key?('timezone') ? hash['timezone'] : SKIP
  report_start_time = if hash.key?('reportStartTime')
                        (DateTimeHelper.from_rfc3339(hash['reportStartTime']) if hash['reportStartTime'])
                      else
                        SKIP
                      end
  report_end_time = if hash.key?('reportEndTime')
                      (DateTimeHelper.from_rfc3339(hash['reportEndTime']) if hash['reportEndTime'])
                    else
                      SKIP
                    end
  report_filters = ReportFilters.from_hash(hash['reportFilters']) if hash['reportFilters']
  report_preferences = ReportPreferences.from_hash(hash['reportPreferences']) if
    hash['reportPreferences']
  group_name = hash.key?('groupName') ? hash['groupName'] : 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.
  CreateAdhocReportRequest.new(organization_id: organization_id,
                               report_definition_name: report_definition_name,
                               report_fields: report_fields,
                               report_mime_type: report_mime_type,
                               report_name: report_name,
                               timezone: timezone,
                               report_start_time: report_start_time,
                               report_end_time: report_end_time,
                               report_filters: report_filters,
                               report_preferences: report_preferences,
                               group_name: group_name,
                               additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/cyber_source_merged_spec/models/create_adhoc_report_request.rb', line 62

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['organization_id'] = 'organizationId'
  @_hash['report_definition_name'] = 'reportDefinitionName'
  @_hash['report_fields'] = 'reportFields'
  @_hash['report_mime_type'] = 'reportMimeType'
  @_hash['report_name'] = 'reportName'
  @_hash['timezone'] = 'timezone'
  @_hash['report_start_time'] = 'reportStartTime'
  @_hash['report_end_time'] = 'reportEndTime'
  @_hash['report_filters'] = 'reportFilters'
  @_hash['report_preferences'] = 'reportPreferences'
  @_hash['group_name'] = 'groupName'
  @_hash
end

.nullablesObject

An array for nullable fields



96
97
98
# File 'lib/cyber_source_merged_spec/models/create_adhoc_report_request.rb', line 96

def self.nullables
  []
end

.optionalsObject

An array for optional fields



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/cyber_source_merged_spec/models/create_adhoc_report_request.rb', line 79

def self.optionals
  %w[
    organization_id
    report_definition_name
    report_fields
    report_mime_type
    report_name
    timezone
    report_start_time
    report_end_time
    report_filters
    report_preferences
    group_name
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



260
261
262
263
264
265
266
267
268
269
# File 'lib/cyber_source_merged_spec/models/create_adhoc_report_request.rb', line 260

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} organization_id: #{@organization_id.inspect}, report_definition_name:"\
  " #{@report_definition_name.inspect}, report_fields: #{@report_fields.inspect},"\
  " report_mime_type: #{@report_mime_type.inspect}, report_name: #{@report_name.inspect},"\
  " timezone: #{@timezone.inspect}, report_start_time: #{@report_start_time.inspect},"\
  " report_end_time: #{@report_end_time.inspect}, report_filters: #{@report_filters.inspect},"\
  " report_preferences: #{@report_preferences.inspect}, group_name: #{@group_name.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_custom_report_end_timeObject



178
179
180
# File 'lib/cyber_source_merged_spec/models/create_adhoc_report_request.rb', line 178

def to_custom_report_end_time
  DateTimeHelper.to_rfc3339(report_end_time)
end

#to_custom_report_start_timeObject



174
175
176
# File 'lib/cyber_source_merged_spec/models/create_adhoc_report_request.rb', line 174

def to_custom_report_start_time
  DateTimeHelper.to_rfc3339(report_start_time)
end

#to_sObject

Provides a human-readable string representation of the object.



249
250
251
252
253
254
255
256
257
# File 'lib/cyber_source_merged_spec/models/create_adhoc_report_request.rb', line 249

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} organization_id: #{@organization_id}, report_definition_name:"\
  " #{@report_definition_name}, report_fields: #{@report_fields}, report_mime_type:"\
  " #{@report_mime_type}, report_name: #{@report_name}, timezone: #{@timezone},"\
  " report_start_time: #{@report_start_time}, report_end_time: #{@report_end_time},"\
  " report_filters: #{@report_filters}, report_preferences: #{@report_preferences},"\
  " group_name: #{@group_name}, additional_properties: #{@additional_properties}>"
end

#to_xml_element(doc, root_name) ⇒ Object



219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
# File 'lib/cyber_source_merged_spec/models/create_adhoc_report_request.rb', line 219

def to_xml_element(doc, root_name)
  root = doc.create_element(root_name)

  XmlUtilities.add_as_subelement(doc, root, 'organizationId',
                                 organization_id)
  XmlUtilities.add_as_subelement(doc, root, 'reportDefinitionName',
                                 report_definition_name)
  XmlUtilities.add_array_as_subelement(doc, root, 'reportFields',
                                       report_fields)
  XmlUtilities.add_as_subelement(doc, root, 'reportMimeType',
                                 report_mime_type)
  XmlUtilities.add_as_subelement(doc, root, 'reportName', report_name)
  XmlUtilities.add_as_subelement(doc, root, 'timezone', timezone)
  XmlUtilities.add_as_subelement(doc, root, 'reportStartTime',
                                 report_start_time,
                                 datetime_format: 'rfc3339')
  XmlUtilities.add_as_subelement(doc, root, 'reportEndTime',
                                 report_end_time,
                                 datetime_format: 'rfc3339')
  XmlUtilities.add_as_subelement(doc, root, 'ReportFilters', report_filters)
  XmlUtilities.add_as_subelement(doc, root, 'ReportPreferences',
                                 report_preferences)
  XmlUtilities.add_as_subelement(doc, root, 'groupName', group_name)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end