Class: UspsApi::EnrollmentStatus
- Defined in:
- lib/usps_api/models/enrollment_status.rb
Overview
USPS Ship enrollment information for a single MID.
Instance Attribute Summary collapse
-
#mid ⇒ String
The MID to which the information in this object applies.
-
#program ⇒ Program
The program (Outbound or Returns) in which the MID is enrolled.
-
#start_date ⇒ Date
The date on which the MID’s enrollment began.
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(mid: SKIP, program: SKIP, start_date: SKIP) ⇒ EnrollmentStatus
constructor
A new instance of EnrollmentStatus.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#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(mid: SKIP, program: SKIP, start_date: SKIP) ⇒ EnrollmentStatus
Returns a new instance of EnrollmentStatus.
49 50 51 52 53 |
# File 'lib/usps_api/models/enrollment_status.rb', line 49 def initialize(mid: SKIP, program: SKIP, start_date: SKIP) @mid = mid unless mid == SKIP @program = program unless program == SKIP @start_date = start_date unless start_date == SKIP end |
Instance Attribute Details
#mid ⇒ String
The MID to which the information in this object applies.
14 15 16 |
# File 'lib/usps_api/models/enrollment_status.rb', line 14 def mid @mid end |
#program ⇒ Program
The program (Outbound or Returns) in which the MID is enrolled. If the MID is enrolled in both programs, two objects will be returned, one for each program.
20 21 22 |
# File 'lib/usps_api/models/enrollment_status.rb', line 20 def program @program end |
#start_date ⇒ Date
The date on which the MID’s enrollment began.
24 25 26 |
# File 'lib/usps_api/models/enrollment_status.rb', line 24 def start_date @start_date end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/usps_api/models/enrollment_status.rb', line 56 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. mid = hash.key?('MID') ? hash['MID'] : SKIP program = hash.key?('program') ? hash['program'] : SKIP start_date = hash.key?('startDate') ? hash['startDate'] : SKIP # Create object from extracted values. EnrollmentStatus.new(mid: mid, program: program, start_date: start_date) end |
.names ⇒ Object
A mapping from model property names to API property names.
27 28 29 30 31 32 33 |
# File 'lib/usps_api/models/enrollment_status.rb', line 27 def self.names @_hash = {} if @_hash.nil? @_hash['mid'] = 'MID' @_hash['program'] = 'program' @_hash['start_date'] = 'startDate' @_hash end |
.nullables ⇒ Object
An array for nullable fields
45 46 47 |
# File 'lib/usps_api/models/enrollment_status.rb', line 45 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
36 37 38 39 40 41 42 |
# File 'lib/usps_api/models/enrollment_status.rb', line 36 def self.optionals %w[ mid program start_date ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
77 78 79 80 81 |
# File 'lib/usps_api/models/enrollment_status.rb', line 77 def inspect class_name = self.class.name.split('::').last "<#{class_name} mid: #{@mid.inspect}, program: #{@program.inspect}, start_date:"\ " #{@start_date.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
71 72 73 74 |
# File 'lib/usps_api/models/enrollment_status.rb', line 71 def to_s class_name = self.class.name.split('::').last "<#{class_name} mid: #{@mid}, program: #{@program}, start_date: #{@start_date}>" end |