Class: CyberSourceMergedSpec::PredefinedSubscriptionRequestBean

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

Overview

PredefinedSubscriptionRequestBean 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_definition_name:, subscription_type:, report_name: SKIP, report_mime_type: SKIP, report_frequency: SKIP, report_interval: SKIP, timezone: SKIP, start_time: SKIP, start_day: SKIP, subscription_status: SKIP, additional_properties: nil) ⇒ PredefinedSubscriptionRequestBean

Returns a new instance of PredefinedSubscriptionRequestBean.



120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/cyber_source_merged_spec/models/predefined_subscription_request_bean.rb', line 120

def initialize(report_definition_name:, subscription_type:,
               report_name: SKIP, report_mime_type: SKIP,
               report_frequency: SKIP, report_interval: SKIP,
               timezone: SKIP, start_time: SKIP, start_day: SKIP,
               subscription_status: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @report_definition_name = report_definition_name
  @subscription_type = subscription_type
  @report_name = report_name unless report_name == SKIP
  @report_mime_type = report_mime_type unless report_mime_type == SKIP
  @report_frequency = report_frequency unless report_frequency == SKIP
  @report_interval = report_interval unless report_interval == SKIP
  @timezone = timezone unless timezone == SKIP
  @start_time = start_time unless start_time == SKIP
  @start_day = start_day unless start_day == SKIP
  @subscription_status = subscription_status unless subscription_status == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#report_definition_nameString

Valid Report Definition Name

Returns:

  • (String)


14
15
16
# File 'lib/cyber_source_merged_spec/models/predefined_subscription_request_bean.rb', line 14

def report_definition_name
  @report_definition_name
end

#report_frequencyString

'The frequency for which subscription is created. For Standard we can have DAILY, WEEKLY and MONTHLY. But for Classic we will have only DAILY.' NOTE: Do not document USER_DEFINED Frequency field in developer center Valid Values:

  • 'DAILY'
  • 'WEEKLY'
  • 'MONTHLY'
  • 'USER_DEFINED'

Returns:

  • (String)


48
49
50
# File 'lib/cyber_source_merged_spec/models/predefined_subscription_request_bean.rb', line 48

def report_frequency
  @report_frequency
end

#report_intervalString

If the reportFrequency is User-defined, reportInterval should be in ISO 8601 time format Please refer the following link to know more about ISO 8601 format.Rfc Time Format Example time format for 2 hours and 30 Mins:

  • PT2H30M NOTE: Do not document reportInterval field in developer center

Returns:

  • (String)


58
59
60
# File 'lib/cyber_source_merged_spec/models/predefined_subscription_request_bean.rb', line 58

def report_interval
  @report_interval
end

#report_mime_typeString

Report Format
Valid Values:

- application/xml
- text/csv

Returns:

  • (String)


37
38
39
# File 'lib/cyber_source_merged_spec/models/predefined_subscription_request_bean.rb', line 37

def report_mime_type
  @report_mime_type
end

#report_nameString

The subscription type for which report definition is required. Valid values are CLASSIC and STANDARD. Valid Values:

- CLASSIC
- STANDARD

Returns:

  • (String)


30
31
32
# File 'lib/cyber_source_merged_spec/models/predefined_subscription_request_bean.rb', line 30

def report_name
  @report_name
end

#start_dayInteger

This is the start day if the frequency is WEEKLY or MONTHLY. The value varies from 1-7 for WEEKLY and 1-31 for MONTHLY. For WEEKLY 1 means Sunday and 7 means Saturday. By default the value is 1.

Returns:

  • (Integer)


75
76
77
# File 'lib/cyber_source_merged_spec/models/predefined_subscription_request_bean.rb', line 75

def start_day
  @start_day
end

#start_timeString

The hour at which the report generation should start. It should be in hhmm format. By Default it will be 0000. The format is 24 hours format.

Returns:

  • (String)


69
70
71
# File 'lib/cyber_source_merged_spec/models/predefined_subscription_request_bean.rb', line 69

def start_time
  @start_time
end

#subscription_statusString

The status for subscription which is either created or updated. By default it is ACTIVE. Valid Values:

- ACTIVE
- INACTIVE

Returns:

  • (String)


83
84
85
# File 'lib/cyber_source_merged_spec/models/predefined_subscription_request_bean.rb', line 83

def subscription_status
  @subscription_status
end

#subscription_typeString

The subscription type for which report definition is required. Valid values are CLASSIC and STANDARD. Valid Values:

- CLASSIC
- STANDARD

Returns:

  • (String)


22
23
24
# File 'lib/cyber_source_merged_spec/models/predefined_subscription_request_bean.rb', line 22

def subscription_type
  @subscription_type
end

#timezoneString

By Default the timezone for Standard subscription is PST. And for Classic subscription it will be GMT. If user provides any other time zone apart from PST for Standard subscription api should error out.

Returns:

  • (String)


64
65
66
# File 'lib/cyber_source_merged_spec/models/predefined_subscription_request_bean.rb', line 64

def timezone
  @timezone
end

Class Method Details

.from_element(root) ⇒ Object



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

def self.from_element(root)
  report_definition_name = XmlUtilities.from_element(root,
                                                     'reportDefinitionName',
                                                     String)
  subscription_type = XmlUtilities.from_element(root, 'subscriptionType',
                                                String)
  report_name = XmlUtilities.from_element(root, 'reportName', String)
  report_mime_type = XmlUtilities.from_element(root, 'reportMimeType',
                                               String)
  report_frequency = XmlUtilities.from_element(root, 'reportFrequency',
                                               String)
  report_interval = XmlUtilities.from_element(root, 'reportInterval',
                                              String)
  timezone = XmlUtilities.from_element(root, 'timezone', String)
  start_time = XmlUtilities.from_element(root, 'startTime', String)
  start_day = XmlUtilities.from_element(root, 'startDay', Integer)
  subscription_status = XmlUtilities.from_element(root,
                                                  'subscriptionStatus',
                                                  String)

  new(report_definition_name: report_definition_name,
      subscription_type: subscription_type,
      report_name: report_name,
      report_mime_type: report_mime_type,
      report_frequency: report_frequency,
      report_interval: report_interval,
      timezone: timezone,
      start_time: start_time,
      start_day: start_day,
      subscription_status: subscription_status,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
173
174
175
176
177
178
179
180
181
182
# File 'lib/cyber_source_merged_spec/models/predefined_subscription_request_bean.rb', line 142

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  report_definition_name =
    hash.key?('reportDefinitionName') ? hash['reportDefinitionName'] : nil
  subscription_type =
    hash.key?('subscriptionType') ? hash['subscriptionType'] : nil
  report_name = hash.key?('reportName') ? hash['reportName'] : SKIP
  report_mime_type =
    hash.key?('reportMimeType') ? hash['reportMimeType'] : SKIP
  report_frequency =
    hash.key?('reportFrequency') ? hash['reportFrequency'] : SKIP
  report_interval =
    hash.key?('reportInterval') ? hash['reportInterval'] : SKIP
  timezone = hash.key?('timezone') ? hash['timezone'] : SKIP
  start_time = hash.key?('startTime') ? hash['startTime'] : SKIP
  start_day = hash.key?('startDay') ? hash['startDay'] : SKIP
  subscription_status =
    hash.key?('subscriptionStatus') ? hash['subscriptionStatus'] : 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.
  PredefinedSubscriptionRequestBean.new(report_definition_name: report_definition_name,
                                        subscription_type: subscription_type,
                                        report_name: report_name,
                                        report_mime_type: report_mime_type,
                                        report_frequency: report_frequency,
                                        report_interval: report_interval,
                                        timezone: timezone,
                                        start_time: start_time,
                                        start_day: start_day,
                                        subscription_status: subscription_status,
                                        additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/cyber_source_merged_spec/models/predefined_subscription_request_bean.rb', line 86

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['report_definition_name'] = 'reportDefinitionName'
  @_hash['subscription_type'] = 'subscriptionType'
  @_hash['report_name'] = 'reportName'
  @_hash['report_mime_type'] = 'reportMimeType'
  @_hash['report_frequency'] = 'reportFrequency'
  @_hash['report_interval'] = 'reportInterval'
  @_hash['timezone'] = 'timezone'
  @_hash['start_time'] = 'startTime'
  @_hash['start_day'] = 'startDay'
  @_hash['subscription_status'] = 'subscriptionStatus'
  @_hash
end

.nullablesObject

An array for nullable fields



116
117
118
# File 'lib/cyber_source_merged_spec/models/predefined_subscription_request_bean.rb', line 116

def self.nullables
  []
end

.optionalsObject

An array for optional fields



102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/cyber_source_merged_spec/models/predefined_subscription_request_bean.rb', line 102

def self.optionals
  %w[
    report_name
    report_mime_type
    report_frequency
    report_interval
    timezone
    start_time
    start_day
    subscription_status
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



254
255
256
257
258
259
260
261
262
263
# File 'lib/cyber_source_merged_spec/models/predefined_subscription_request_bean.rb', line 254

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} report_definition_name: #{@report_definition_name.inspect},"\
  " subscription_type: #{@subscription_type.inspect}, report_name: #{@report_name.inspect},"\
  " report_mime_type: #{@report_mime_type.inspect}, report_frequency:"\
  " #{@report_frequency.inspect}, report_interval: #{@report_interval.inspect}, timezone:"\
  " #{@timezone.inspect}, start_time: #{@start_time.inspect}, start_day:"\
  " #{@start_day.inspect}, subscription_status: #{@subscription_status.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



243
244
245
246
247
248
249
250
251
# File 'lib/cyber_source_merged_spec/models/predefined_subscription_request_bean.rb', line 243

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} report_definition_name: #{@report_definition_name}, subscription_type:"\
  " #{@subscription_type}, report_name: #{@report_name}, report_mime_type:"\
  " #{@report_mime_type}, report_frequency: #{@report_frequency}, report_interval:"\
  " #{@report_interval}, timezone: #{@timezone}, start_time: #{@start_time}, start_day:"\
  " #{@start_day}, subscription_status: #{@subscription_status}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_xml_element(doc, root_name) ⇒ Object



217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
# File 'lib/cyber_source_merged_spec/models/predefined_subscription_request_bean.rb', line 217

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

  XmlUtilities.add_as_subelement(doc, root, 'reportDefinitionName',
                                 report_definition_name)
  XmlUtilities.add_as_subelement(doc, root, 'subscriptionType',
                                 subscription_type)
  XmlUtilities.add_as_subelement(doc, root, 'reportName', report_name)
  XmlUtilities.add_as_subelement(doc, root, 'reportMimeType',
                                 report_mime_type)
  XmlUtilities.add_as_subelement(doc, root, 'reportFrequency',
                                 report_frequency)
  XmlUtilities.add_as_subelement(doc, root, 'reportInterval',
                                 report_interval)
  XmlUtilities.add_as_subelement(doc, root, 'timezone', timezone)
  XmlUtilities.add_as_subelement(doc, root, 'startTime', start_time)
  XmlUtilities.add_as_subelement(doc, root, 'startDay', start_day)
  XmlUtilities.add_as_subelement(doc, root, 'subscriptionStatus',
                                 subscription_status)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end