Class: UspsApi::MailOwner

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

Overview

MailOwner 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(crid: SKIP, mids: SKIP) ⇒ MailOwner

Returns a new instance of MailOwner.



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

def initialize(crid: SKIP, mids: SKIP)
  @crid = crid unless crid == SKIP
  @mids = mids unless mids == SKIP
end

Instance Attribute Details

#cridString

A specific business location identified in a mailing.

Returns:

  • (String)


14
15
16
# File 'lib/usps_api/models/mail_owner.rb', line 14

def crid
  @crid
end

#midsString

A list of comma and space separated mailer Identifiers.

Returns:

  • (String)


18
19
20
# File 'lib/usps_api/models/mail_owner.rb', line 18

def mids
  @mids
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



47
48
49
50
51
52
53
54
55
56
57
# File 'lib/usps_api/models/mail_owner.rb', line 47

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  crid = hash.key?('crid') ? hash['crid'] : SKIP
  mids = hash.key?('mids') ? hash['mids'] : SKIP

  # Create object from extracted values.
  MailOwner.new(crid: crid,
                mids: mids)
end

.namesObject

A mapping from model property names to API property names.



21
22
23
24
25
26
# File 'lib/usps_api/models/mail_owner.rb', line 21

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['crid'] = 'crid'
  @_hash['mids'] = 'mids'
  @_hash
end

.nullablesObject

An array for nullable fields



37
38
39
# File 'lib/usps_api/models/mail_owner.rb', line 37

def self.nullables
  []
end

.optionalsObject

An array for optional fields



29
30
31
32
33
34
# File 'lib/usps_api/models/mail_owner.rb', line 29

def self.optionals
  %w[
    crid
    mids
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



66
67
68
69
# File 'lib/usps_api/models/mail_owner.rb', line 66

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} crid: #{@crid.inspect}, mids: #{@mids.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



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

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} crid: #{@crid}, mids: #{@mids}>"
end