Class: UspsApi::EditPackageCampaignResponse

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/usps_api/models/edit_package_campaign_response.rb

Overview

EditPackageCampaignResponse 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(campaign_id: SKIP, mid: SKIP, submitter_name: SKIP, submitter_crid: SKIP, mail_owner_crid: SKIP, mail_owner_name: SKIP, campaign_code: SKIP, campaign_grouping_code: SKIP, campaign_title: SKIP, brand_display_name: SKIP, start_date: SKIP, end_date: SKIP, target_url: SKIP, ride_along: SKIP, add_barcode: SKIP, barcode_count: SKIP, cancel: SKIP, created_datetime: SKIP, delete: SKIP, full_edit: SKIP, last_modified_datetime: SKIP, limited_edit: SKIP, no_edit: SKIP, status: SKIP, submitted_datetime: SKIP, additional_properties: nil) ⇒ EditPackageCampaignResponse

Returns a new instance of EditPackageCampaignResponse.



205
206
207
208
209
210
211
212
213
214
215
216
217
218
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
# File 'lib/usps_api/models/edit_package_campaign_response.rb', line 205

def initialize(campaign_id: SKIP, mid: SKIP, submitter_name: SKIP,
               submitter_crid: SKIP, mail_owner_crid: SKIP,
               mail_owner_name: SKIP, campaign_code: SKIP,
               campaign_grouping_code: SKIP, campaign_title: SKIP,
               brand_display_name: SKIP, start_date: SKIP, end_date: SKIP,
               target_url: SKIP, ride_along: SKIP, add_barcode: SKIP,
               barcode_count: SKIP, cancel: SKIP, created_datetime: SKIP,
               delete: SKIP, full_edit: SKIP, last_modified_datetime: SKIP,
               limited_edit: SKIP, no_edit: SKIP, status: SKIP,
               submitted_datetime: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @campaign_id = campaign_id unless campaign_id == SKIP
  @mid = mid unless mid == SKIP
  @submitter_name = submitter_name unless submitter_name == SKIP
  @submitter_crid = submitter_crid unless submitter_crid == SKIP
  @mail_owner_crid = mail_owner_crid unless mail_owner_crid == SKIP
  @mail_owner_name = mail_owner_name unless mail_owner_name == SKIP
  @campaign_code = campaign_code unless campaign_code == SKIP
  @campaign_grouping_code = campaign_grouping_code unless campaign_grouping_code == SKIP
  @campaign_title = campaign_title unless campaign_title == SKIP
  @brand_display_name = brand_display_name unless brand_display_name == SKIP
  @start_date = start_date unless start_date == SKIP
  @end_date = end_date unless end_date == SKIP
  @target_url = target_url unless target_url == SKIP
  @ride_along = ride_along unless ride_along == SKIP
  @add_barcode = add_barcode unless add_barcode == SKIP
  @barcode_count = barcode_count unless barcode_count == SKIP
  @cancel = cancel unless cancel == SKIP
  @created_datetime = created_datetime unless created_datetime == SKIP
  @delete = delete unless delete == SKIP
  @full_edit = full_edit unless full_edit == SKIP
  @last_modified_datetime = last_modified_datetime unless last_modified_datetime == SKIP
  @limited_edit = limited_edit unless limited_edit == SKIP
  @no_edit = no_edit unless no_edit == SKIP
  @status = status unless status == SKIP
  @submitted_datetime =  unless  == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#add_barcodeTrueClass | FalseClass

Boolean that gives information on whether a campaign is eligible for packages added to it. This flag will be true only if the campaign has an End Date in the future.

Returns:

  • (TrueClass | FalseClass)


81
82
83
# File 'lib/usps_api/models/edit_package_campaign_response.rb', line 81

def add_barcode
  @add_barcode
end

#barcode_countFloat

Number of packages associated with the campaign.

Returns:

  • (Float)


85
86
87
# File 'lib/usps_api/models/edit_package_campaign_response.rb', line 85

def barcode_count
  @barcode_count
end

#brand_display_nameString

User defined field that is placed on Informed Delivery’s UIs when campaign is displayed.

Returns:

  • (String)


56
57
58
# File 'lib/usps_api/models/edit_package_campaign_response.rb', line 56

def brand_display_name
  @brand_display_name
end

#campaign_codeString

User defined field that describes the campaign being created. This field is put into the campaign reports created for the campaign.

Returns:

  • (String)


41
42
43
# File 'lib/usps_api/models/edit_package_campaign_response.rb', line 41

def campaign_code
  @campaign_code
end

#campaign_grouping_codeString

User defined field that describes the campaign being created. This field is put into the campaign reports created for the campaign.

Returns:

  • (String)


46
47
48
# File 'lib/usps_api/models/edit_package_campaign_response.rb', line 46

def campaign_grouping_code
  @campaign_grouping_code
end

#campaign_idString

Unique identifier for the campaign.

Returns:

  • (String)


15
16
17
# File 'lib/usps_api/models/edit_package_campaign_response.rb', line 15

def campaign_id
  @campaign_id
end

#campaign_titleString

User defined field that describes the campaign being created. This field is put into the campaign reports created for the campaign.

Returns:

  • (String)


51
52
53
# File 'lib/usps_api/models/edit_package_campaign_response.rb', line 51

def campaign_title
  @campaign_title
end

#cancelTrueClass | FalseClass

Boolean that gives information on whether a campaign is eligible for cancellation. This flag will be true only if the campaign is in an Active status.

Returns:

  • (TrueClass | FalseClass)


91
92
93
# File 'lib/usps_api/models/edit_package_campaign_response.rb', line 91

def cancel
  @cancel
end

#created_datetimeDateTime

Timestamp of initial campaign creation. This timestamp will be returned in UTC.

Returns:

  • (DateTime)


96
97
98
# File 'lib/usps_api/models/edit_package_campaign_response.rb', line 96

def created_datetime
  @created_datetime
end

#deleteTrueClass | FalseClass

Boolean that gives information on whether a campaign is eligible for deletion. This flag will be true only if the campaign is in a Submitted or Inactive status.

Returns:

  • (TrueClass | FalseClass)


102
103
104
# File 'lib/usps_api/models/edit_package_campaign_response.rb', line 102

def delete
  @delete
end

#end_dateDate

Last day campaign will be displayed

Returns:

  • (Date)


64
65
66
# File 'lib/usps_api/models/edit_package_campaign_response.rb', line 64

def end_date
  @end_date
end

#full_editTrueClass | FalseClass

Boolean that gives information on whether a campaign is eligible for edit inclusive of the campaign’s MID. This flag will be true only if the campaign is in a Submitted and does not have associated packages.

Returns:

  • (TrueClass | FalseClass)


108
109
110
# File 'lib/usps_api/models/edit_package_campaign_response.rb', line 108

def full_edit
  @full_edit
end

#last_modified_datetimeDateTime

Timestamp of last update made to campaign, inclusive of status changes that occur when a campaign activates or completes. This timestamp will be returned in UTC.

Returns:

  • (DateTime)


114
115
116
# File 'lib/usps_api/models/edit_package_campaign_response.rb', line 114

def last_modified_datetime
  @last_modified_datetime
end

#limited_editTrueClass | FalseClass

Boolean that gives information on whether a campaign is eligible for edit, not inclusive of the campaign’s MID. This flag will be true only if the campaign is in a Submitted status and already has associated packages.

Returns:

  • (TrueClass | FalseClass)


120
121
122
# File 'lib/usps_api/models/edit_package_campaign_response.rb', line 120

def limited_edit
  @limited_edit
end

#mail_owner_cridString

Customer Registration ID (CRID) of the Mail Owner associated with the Informed Delivery campaign.

Returns:

  • (String)


32
33
34
# File 'lib/usps_api/models/edit_package_campaign_response.rb', line 32

def mail_owner_crid
  @mail_owner_crid
end

#mail_owner_nameString

Name of the Mail Owner associated with the Informed Delivery campaign.

Returns:

  • (String)


36
37
38
# File 'lib/usps_api/models/edit_package_campaign_response.rb', line 36

def mail_owner_name
  @mail_owner_name
end

#midString

The Mailer ID associated with the campaign.

Returns:

  • (String)


19
20
21
# File 'lib/usps_api/models/edit_package_campaign_response.rb', line 19

def mid
  @mid
end

#no_editTrueClass | FalseClass

Boolean that gives information on whether a campaign is not eligible for edit. This flag will be true if the campaign has an Active, Complete, Cancelled, or Deleted status.

Returns:

  • (TrueClass | FalseClass)


126
127
128
# File 'lib/usps_api/models/edit_package_campaign_response.rb', line 126

def no_edit
  @no_edit
end

#ride_alongString

The image that is displayed for packages matched with a package campaign. When clicked, this image will take users to the Target URL of the campaign. This field is required.

Returns:

  • (String)


75
76
77
# File 'lib/usps_api/models/edit_package_campaign_response.rb', line 75

def ride_along
  @ride_along
end

#start_dateDate

First day campaign will be displayed

Returns:

  • (Date)


60
61
62
# File 'lib/usps_api/models/edit_package_campaign_response.rb', line 60

def start_date
  @start_date
end

#statusString

Status of campaign - possible values include Submitted, Active, Complete, Inactive, Cancelled, and Deleted.

Returns:

  • (String)


131
132
133
# File 'lib/usps_api/models/edit_package_campaign_response.rb', line 131

def status
  @status
end

#submitted_datetimeDateTime

Timestamp of initial campaign submission. This timestamp will be returned in UTC.

Returns:

  • (DateTime)


136
137
138
# File 'lib/usps_api/models/edit_package_campaign_response.rb', line 136

def 
  @submitted_datetime
end

#submitter_cridString

The campaign submitter’s Customer Registration ID (CRID).

Returns:

  • (String)


27
28
29
# File 'lib/usps_api/models/edit_package_campaign_response.rb', line 27

def submitter_crid
  @submitter_crid
end

#submitter_nameString

The campaign submitter’s Name.

Returns:

  • (String)


23
24
25
# File 'lib/usps_api/models/edit_package_campaign_response.rb', line 23

def submitter_name
  @submitter_name
end

#target_urlString

The URL that users are redirected to when clicking on the Ridealong image or Learn More link for a campaign. This field is required.

Returns:

  • (String)


69
70
71
# File 'lib/usps_api/models/edit_package_campaign_response.rb', line 69

def target_url
  @target_url
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
# File 'lib/usps_api/models/edit_package_campaign_response.rb', line 247

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  campaign_id = hash.key?('campaignID') ? hash['campaignID'] : SKIP
  mid = hash.key?('MID') ? hash['MID'] : SKIP
  submitter_name = hash.key?('submitterName') ? hash['submitterName'] : SKIP
  submitter_crid = hash.key?('submitterCRID') ? hash['submitterCRID'] : SKIP
  mail_owner_crid =
    hash.key?('mailOwnerCRID') ? hash['mailOwnerCRID'] : SKIP
  mail_owner_name =
    hash.key?('mailOwnerName') ? hash['mailOwnerName'] : SKIP
  campaign_code = hash.key?('campaignCode') ? hash['campaignCode'] : SKIP
  campaign_grouping_code =
    hash.key?('campaignGroupingCode') ? hash['campaignGroupingCode'] : SKIP
  campaign_title = hash.key?('campaignTitle') ? hash['campaignTitle'] : SKIP
  brand_display_name =
    hash.key?('brandDisplayName') ? hash['brandDisplayName'] : SKIP
  start_date = hash.key?('startDate') ? hash['startDate'] : SKIP
  end_date = hash.key?('endDate') ? hash['endDate'] : SKIP
  target_url = hash.key?('targetUrl') ? hash['targetUrl'] : SKIP
  ride_along = hash.key?('rideAlong') ? hash['rideAlong'] : SKIP
  add_barcode = hash.key?('addBarcode') ? hash['addBarcode'] : SKIP
  barcode_count = hash.key?('barcodeCount') ? hash['barcodeCount'] : SKIP
  cancel = hash.key?('cancel') ? hash['cancel'] : SKIP
  created_datetime = if hash.key?('createdDatetime')
                       (DateTimeHelper.from_rfc3339(hash['createdDatetime']) if hash['createdDatetime'])
                     else
                       SKIP
                     end
  delete = hash.key?('delete') ? hash['delete'] : SKIP
  full_edit = hash.key?('fullEdit') ? hash['fullEdit'] : SKIP
  last_modified_datetime = if hash.key?('lastModifiedDatetime')
                             (DateTimeHelper.from_rfc3339(hash['lastModifiedDatetime']) if hash['lastModifiedDatetime'])
                           else
                             SKIP
                           end
  limited_edit = hash.key?('limitedEdit') ? hash['limitedEdit'] : SKIP
  no_edit = hash.key?('noEdit') ? hash['noEdit'] : SKIP
  status = hash.key?('status') ? hash['status'] : SKIP
   = if hash.key?('submittedDatetime')
                         (DateTimeHelper.from_rfc3339(hash['submittedDatetime']) if hash['submittedDatetime'])
                       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.
  EditPackageCampaignResponse.new(campaign_id: campaign_id,
                                  mid: mid,
                                  submitter_name: submitter_name,
                                  submitter_crid: submitter_crid,
                                  mail_owner_crid: mail_owner_crid,
                                  mail_owner_name: mail_owner_name,
                                  campaign_code: campaign_code,
                                  campaign_grouping_code: campaign_grouping_code,
                                  campaign_title: campaign_title,
                                  brand_display_name: brand_display_name,
                                  start_date: start_date,
                                  end_date: end_date,
                                  target_url: target_url,
                                  ride_along: ride_along,
                                  add_barcode: add_barcode,
                                  barcode_count: barcode_count,
                                  cancel: cancel,
                                  created_datetime: created_datetime,
                                  delete: delete,
                                  full_edit: full_edit,
                                  last_modified_datetime: last_modified_datetime,
                                  limited_edit: limited_edit,
                                  no_edit: no_edit,
                                  status: status,
                                  submitted_datetime: ,
                                  additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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
# File 'lib/usps_api/models/edit_package_campaign_response.rb', line 139

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['campaign_id'] = 'campaignID'
  @_hash['mid'] = 'MID'
  @_hash['submitter_name'] = 'submitterName'
  @_hash['submitter_crid'] = 'submitterCRID'
  @_hash['mail_owner_crid'] = 'mailOwnerCRID'
  @_hash['mail_owner_name'] = 'mailOwnerName'
  @_hash['campaign_code'] = 'campaignCode'
  @_hash['campaign_grouping_code'] = 'campaignGroupingCode'
  @_hash['campaign_title'] = 'campaignTitle'
  @_hash['brand_display_name'] = 'brandDisplayName'
  @_hash['start_date'] = 'startDate'
  @_hash['end_date'] = 'endDate'
  @_hash['target_url'] = 'targetUrl'
  @_hash['ride_along'] = 'rideAlong'
  @_hash['add_barcode'] = 'addBarcode'
  @_hash['barcode_count'] = 'barcodeCount'
  @_hash['cancel'] = 'cancel'
  @_hash['created_datetime'] = 'createdDatetime'
  @_hash['delete'] = 'delete'
  @_hash['full_edit'] = 'fullEdit'
  @_hash['last_modified_datetime'] = 'lastModifiedDatetime'
  @_hash['limited_edit'] = 'limitedEdit'
  @_hash['no_edit'] = 'noEdit'
  @_hash['status'] = 'status'
  @_hash['submitted_datetime'] = 'submittedDatetime'
  @_hash
end

.nullablesObject

An array for nullable fields



201
202
203
# File 'lib/usps_api/models/edit_package_campaign_response.rb', line 201

def self.nullables
  []
end

.optionalsObject

An array for optional fields



170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
# File 'lib/usps_api/models/edit_package_campaign_response.rb', line 170

def self.optionals
  %w[
    campaign_id
    mid
    submitter_name
    submitter_crid
    mail_owner_crid
    mail_owner_name
    campaign_code
    campaign_grouping_code
    campaign_title
    brand_display_name
    start_date
    end_date
    target_url
    ride_along
    add_barcode
    barcode_count
    cancel
    created_datetime
    delete
    full_edit
    last_modified_datetime
    limited_edit
    no_edit
    status
    submitted_datetime
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
# File 'lib/usps_api/models/edit_package_campaign_response.rb', line 358

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} campaign_id: #{@campaign_id.inspect}, mid: #{@mid.inspect}, submitter_name:"\
  " #{@submitter_name.inspect}, submitter_crid: #{@submitter_crid.inspect}, mail_owner_crid:"\
  " #{@mail_owner_crid.inspect}, mail_owner_name: #{@mail_owner_name.inspect}, campaign_code:"\
  " #{@campaign_code.inspect}, campaign_grouping_code: #{@campaign_grouping_code.inspect},"\
  " campaign_title: #{@campaign_title.inspect}, brand_display_name:"\
  " #{@brand_display_name.inspect}, start_date: #{@start_date.inspect}, end_date:"\
  " #{@end_date.inspect}, target_url: #{@target_url.inspect}, ride_along:"\
  " #{@ride_along.inspect}, add_barcode: #{@add_barcode.inspect}, barcode_count:"\
  " #{@barcode_count.inspect}, cancel: #{@cancel.inspect}, created_datetime:"\
  " #{@created_datetime.inspect}, delete: #{@delete.inspect}, full_edit:"\
  " #{@full_edit.inspect}, last_modified_datetime: #{@last_modified_datetime.inspect},"\
  " limited_edit: #{@limited_edit.inspect}, no_edit: #{@no_edit.inspect}, status:"\
  " #{@status.inspect}, submitted_datetime: #{@submitted_datetime.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_custom_created_datetimeObject



329
330
331
# File 'lib/usps_api/models/edit_package_campaign_response.rb', line 329

def to_custom_created_datetime
  DateTimeHelper.to_rfc3339(created_datetime)
end

#to_custom_last_modified_datetimeObject



333
334
335
# File 'lib/usps_api/models/edit_package_campaign_response.rb', line 333

def to_custom_last_modified_datetime
  DateTimeHelper.to_rfc3339(last_modified_datetime)
end

#to_custom_submitted_datetimeObject



337
338
339
# File 'lib/usps_api/models/edit_package_campaign_response.rb', line 337

def 
  DateTimeHelper.to_rfc3339()
end

#to_sObject

Provides a human-readable string representation of the object.



342
343
344
345
346
347
348
349
350
351
352
353
354
355
# File 'lib/usps_api/models/edit_package_campaign_response.rb', line 342

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} campaign_id: #{@campaign_id}, mid: #{@mid}, submitter_name:"\
  " #{@submitter_name}, submitter_crid: #{@submitter_crid}, mail_owner_crid:"\
  " #{@mail_owner_crid}, mail_owner_name: #{@mail_owner_name}, campaign_code:"\
  " #{@campaign_code}, campaign_grouping_code: #{@campaign_grouping_code}, campaign_title:"\
  " #{@campaign_title}, brand_display_name: #{@brand_display_name}, start_date:"\
  " #{@start_date}, end_date: #{@end_date}, target_url: #{@target_url}, ride_along:"\
  " #{@ride_along}, add_barcode: #{@add_barcode}, barcode_count: #{@barcode_count}, cancel:"\
  " #{@cancel}, created_datetime: #{@created_datetime}, delete: #{@delete}, full_edit:"\
  " #{@full_edit}, last_modified_datetime: #{@last_modified_datetime}, limited_edit:"\
  " #{@limited_edit}, no_edit: #{@no_edit}, status: #{@status}, submitted_datetime:"\
  " #{@submitted_datetime}, additional_properties: #{@additional_properties}>"
end