Class: UspsApi::Campaign2
- Defined in:
- lib/usps_api/models/campaign2.rb
Overview
Campaign2 Model.
Instance Attribute Summary collapse
-
#add_barcode ⇒ TrueClass | FalseClass
Boolean that gives information on whether a campaign is eligible for packages added to it.
-
#barcode_count ⇒ Float
Number of packages associated with the campaign.
-
#brand_display_name ⇒ String
User defined field that is placed on Informed Delivery’s UIs when campaign is displayed.
-
#campaign_code ⇒ String
User defined field that describes the campaign being created.
-
#campaign_grouping_code ⇒ String
User defined field that describes the campaign being created.
-
#campaign_id ⇒ String
Unique identifier for the campaign.
-
#campaign_title ⇒ String
User defined field that describes the campaign being created.
-
#cancel ⇒ TrueClass | FalseClass
Boolean that gives information on whether a campaign is eligible for cancellation.
-
#created_datetime ⇒ DateTime
Timestamp of initial campaign creation.
-
#delete ⇒ TrueClass | FalseClass
Boolean that gives information on whether a campaign is eligible for deletion.
-
#end_date ⇒ Date
Last day campaign will be displayed.
-
#full_edit ⇒ TrueClass | FalseClass
Boolean that gives information on whether a campaign is eligible for edit inclusive of the campaign’s MID.
-
#last_modified_datetime ⇒ DateTime
Timestamp of last update made to campaign, inclusive of status changes that occur when a campaign activates or completes.
-
#limited_edit ⇒ TrueClass | FalseClass
Boolean that gives information on whether a campaign is eligible for edit, not inclusive of the campaign’s MID.
-
#mail_owner_crid ⇒ String
Customer Registration ID (CRID) of the Mail Owner associated with the Informed Delivery campaign.
-
#mail_owner_name ⇒ String
Name of the Mail Owner associated with the Informed Delivery campaign.
-
#mid ⇒ String
The Mailer ID associated with the campaign.
-
#no_edit ⇒ TrueClass | FalseClass
Boolean that gives information on whether a campaign is not eligible for edit.
-
#start_date ⇒ Date
First day campaign will be displayed.
-
#status ⇒ String
Status of campaign - possible values include Submitted, Active, Complete, Inactive, Cancelled, and Deleted.
-
#submitted_datetime ⇒ DateTime
Timestamp of initial campaign submission.
-
#submitter_crid ⇒ String
The campaign submitter’s Customer Registration ID (CRID).
-
#submitter_name ⇒ String
The campaign submitter’s Name.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#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, 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) ⇒ Campaign2
constructor
A new instance of Campaign2.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_created_datetime ⇒ Object
- #to_custom_last_modified_datetime ⇒ Object
- #to_custom_submitted_datetime ⇒ Object
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
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, 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) ⇒ Campaign2
Returns a new instance of Campaign2.
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 218 219 220 221 222 223 224 225 226 227 |
# File 'lib/usps_api/models/campaign2.rb', line 190 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, 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 @add_barcode = unless == SKIP @barcode_count = unless == 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 = submitted_datetime unless submitted_datetime == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#add_barcode ⇒ TrueClass | 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.
70 71 72 |
# File 'lib/usps_api/models/campaign2.rb', line 70 def @add_barcode end |
#barcode_count ⇒ Float
Number of packages associated with the campaign.
74 75 76 |
# File 'lib/usps_api/models/campaign2.rb', line 74 def @barcode_count end |
#brand_display_name ⇒ String
User defined field that is placed on Informed Delivery’s UIs when campaign is displayed.
56 57 58 |
# File 'lib/usps_api/models/campaign2.rb', line 56 def brand_display_name @brand_display_name end |
#campaign_code ⇒ String
User defined field that describes the campaign being created. This field is put into the campaign reports created for the campaign.
41 42 43 |
# File 'lib/usps_api/models/campaign2.rb', line 41 def campaign_code @campaign_code end |
#campaign_grouping_code ⇒ String
User defined field that describes the campaign being created. This field is put into the campaign reports created for the campaign.
46 47 48 |
# File 'lib/usps_api/models/campaign2.rb', line 46 def campaign_grouping_code @campaign_grouping_code end |
#campaign_id ⇒ String
Unique identifier for the campaign.
15 16 17 |
# File 'lib/usps_api/models/campaign2.rb', line 15 def campaign_id @campaign_id end |
#campaign_title ⇒ String
User defined field that describes the campaign being created. This field is put into the campaign reports created for the campaign.
51 52 53 |
# File 'lib/usps_api/models/campaign2.rb', line 51 def campaign_title @campaign_title end |
#cancel ⇒ TrueClass | 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.
80 81 82 |
# File 'lib/usps_api/models/campaign2.rb', line 80 def cancel @cancel end |
#created_datetime ⇒ DateTime
Timestamp of initial campaign creation. This timestamp will be returned in UTC.
85 86 87 |
# File 'lib/usps_api/models/campaign2.rb', line 85 def created_datetime @created_datetime end |
#delete ⇒ TrueClass | 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.
91 92 93 |
# File 'lib/usps_api/models/campaign2.rb', line 91 def delete @delete end |
#end_date ⇒ Date
Last day campaign will be displayed
64 65 66 |
# File 'lib/usps_api/models/campaign2.rb', line 64 def end_date @end_date end |
#full_edit ⇒ TrueClass | 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.
97 98 99 |
# File 'lib/usps_api/models/campaign2.rb', line 97 def full_edit @full_edit end |
#last_modified_datetime ⇒ DateTime
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.
103 104 105 |
# File 'lib/usps_api/models/campaign2.rb', line 103 def last_modified_datetime @last_modified_datetime end |
#limited_edit ⇒ TrueClass | 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.
109 110 111 |
# File 'lib/usps_api/models/campaign2.rb', line 109 def limited_edit @limited_edit end |
#mail_owner_crid ⇒ String
Customer Registration ID (CRID) of the Mail Owner associated with the Informed Delivery campaign.
32 33 34 |
# File 'lib/usps_api/models/campaign2.rb', line 32 def mail_owner_crid @mail_owner_crid end |
#mail_owner_name ⇒ String
Name of the Mail Owner associated with the Informed Delivery campaign.
36 37 38 |
# File 'lib/usps_api/models/campaign2.rb', line 36 def mail_owner_name @mail_owner_name end |
#mid ⇒ String
The Mailer ID associated with the campaign.
19 20 21 |
# File 'lib/usps_api/models/campaign2.rb', line 19 def mid @mid end |
#no_edit ⇒ TrueClass | 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.
115 116 117 |
# File 'lib/usps_api/models/campaign2.rb', line 115 def no_edit @no_edit end |
#start_date ⇒ Date
First day campaign will be displayed
60 61 62 |
# File 'lib/usps_api/models/campaign2.rb', line 60 def start_date @start_date end |
#status ⇒ String
Status of campaign - possible values include Submitted, Active, Complete, Inactive, Cancelled, and Deleted
120 121 122 |
# File 'lib/usps_api/models/campaign2.rb', line 120 def status @status end |
#submitted_datetime ⇒ DateTime
Timestamp of initial campaign submission. This timestamp will be returned in UTC.
125 126 127 |
# File 'lib/usps_api/models/campaign2.rb', line 125 def submitted_datetime @submitted_datetime end |
#submitter_crid ⇒ String
The campaign submitter’s Customer Registration ID (CRID).
27 28 29 |
# File 'lib/usps_api/models/campaign2.rb', line 27 def submitter_crid @submitter_crid end |
#submitter_name ⇒ String
The campaign submitter’s Name.
23 24 25 |
# File 'lib/usps_api/models/campaign2.rb', line 23 def submitter_name @submitter_name end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 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 |
# File 'lib/usps_api/models/campaign2.rb', line 230 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 = hash.key?('addBarcode') ? hash['addBarcode'] : SKIP = 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 submitted_datetime = 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. Campaign2.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, add_barcode: , 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 |
.names ⇒ Object
A mapping from model property names to API property names.
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 |
# File 'lib/usps_api/models/campaign2.rb', line 128 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['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 |
.nullables ⇒ Object
An array for nullable fields
186 187 188 |
# File 'lib/usps_api/models/campaign2.rb', line 186 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
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 183 |
# File 'lib/usps_api/models/campaign2.rb', line 157 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 add_barcode barcode_count cancel created_datetime delete full_edit last_modified_datetime limited_edit no_edit status submitted_datetime ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 |
# File 'lib/usps_api/models/campaign2.rb', line 337 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}, 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_datetime ⇒ Object
308 309 310 |
# File 'lib/usps_api/models/campaign2.rb', line 308 def to_custom_created_datetime DateTimeHelper.to_rfc3339(created_datetime) end |
#to_custom_last_modified_datetime ⇒ Object
312 313 314 |
# File 'lib/usps_api/models/campaign2.rb', line 312 def to_custom_last_modified_datetime DateTimeHelper.to_rfc3339(last_modified_datetime) end |
#to_custom_submitted_datetime ⇒ Object
316 317 318 |
# File 'lib/usps_api/models/campaign2.rb', line 316 def to_custom_submitted_datetime DateTimeHelper.to_rfc3339(submitted_datetime) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
321 322 323 324 325 326 327 328 329 330 331 332 333 334 |
# File 'lib/usps_api/models/campaign2.rb', line 321 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}, 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 |