Class: WalmartApIs::BuyerInfo
- Defined in:
- lib/walmart_ap_is/models/buyer_info.rb
Overview
Buyer contact projection. buyerPhoneAnonymized is masked to the last 4
digits (e.g. ***-***-0100); the unmasked phone number is never returned by
the v4 API.
Instance Attribute Summary collapse
-
#buyer_email ⇒ String
TODO: Write general description for this method.
-
#buyer_name ⇒ String
TODO: Write general description for this method.
-
#buyer_phone_anonymized ⇒ String
Phone with everything but the last four digits masked.
-
#purchase_order_id ⇒ String
TODO: Write general description for this method.
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(purchase_order_id: SKIP, buyer_name: SKIP, buyer_email: SKIP, buyer_phone_anonymized: SKIP, additional_properties: nil) ⇒ BuyerInfo
constructor
A new instance of BuyerInfo.
-
#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(purchase_order_id: SKIP, buyer_name: SKIP, buyer_email: SKIP, buyer_phone_anonymized: SKIP, additional_properties: nil) ⇒ BuyerInfo
Returns a new instance of BuyerInfo.
55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/walmart_ap_is/models/buyer_info.rb', line 55 def initialize(purchase_order_id: SKIP, buyer_name: SKIP, buyer_email: SKIP, buyer_phone_anonymized: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @purchase_order_id = purchase_order_id unless purchase_order_id == SKIP @buyer_name = buyer_name unless buyer_name == SKIP @buyer_email = buyer_email unless buyer_email == SKIP @buyer_phone_anonymized = buyer_phone_anonymized unless buyer_phone_anonymized == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#buyer_email ⇒ String
TODO: Write general description for this method
24 25 26 |
# File 'lib/walmart_ap_is/models/buyer_info.rb', line 24 def buyer_email @buyer_email end |
#buyer_name ⇒ String
TODO: Write general description for this method
20 21 22 |
# File 'lib/walmart_ap_is/models/buyer_info.rb', line 20 def buyer_name @buyer_name end |
#buyer_phone_anonymized ⇒ String
Phone with everything but the last four digits masked.
28 29 30 |
# File 'lib/walmart_ap_is/models/buyer_info.rb', line 28 def buyer_phone_anonymized @buyer_phone_anonymized end |
#purchase_order_id ⇒ String
TODO: Write general description for this method
16 17 18 |
# File 'lib/walmart_ap_is/models/buyer_info.rb', line 16 def purchase_order_id @purchase_order_id end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/walmart_ap_is/models/buyer_info.rb', line 68 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. purchase_order_id = hash.key?('purchaseOrderId') ? hash['purchaseOrderId'] : SKIP buyer_name = hash.key?('buyerName') ? hash['buyerName'] : SKIP buyer_email = hash.key?('buyerEmail') ? hash['buyerEmail'] : SKIP buyer_phone_anonymized = hash.key?('buyerPhoneAnonymized') ? hash['buyerPhoneAnonymized'] : 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. BuyerInfo.new(purchase_order_id: purchase_order_id, buyer_name: buyer_name, buyer_email: buyer_email, buyer_phone_anonymized: buyer_phone_anonymized, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
31 32 33 34 35 36 37 38 |
# File 'lib/walmart_ap_is/models/buyer_info.rb', line 31 def self.names @_hash = {} if @_hash.nil? @_hash['purchase_order_id'] = 'purchaseOrderId' @_hash['buyer_name'] = 'buyerName' @_hash['buyer_email'] = 'buyerEmail' @_hash['buyer_phone_anonymized'] = 'buyerPhoneAnonymized' @_hash end |
.nullables ⇒ Object
An array for nullable fields
51 52 53 |
# File 'lib/walmart_ap_is/models/buyer_info.rb', line 51 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
41 42 43 44 45 46 47 48 |
# File 'lib/walmart_ap_is/models/buyer_info.rb', line 41 def self.optionals %w[ purchase_order_id buyer_name buyer_email buyer_phone_anonymized ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
103 104 105 106 107 108 |
# File 'lib/walmart_ap_is/models/buyer_info.rb', line 103 def inspect class_name = self.class.name.split('::').last "<#{class_name} purchase_order_id: #{@purchase_order_id.inspect}, buyer_name:"\ " #{@buyer_name.inspect}, buyer_email: #{@buyer_email.inspect}, buyer_phone_anonymized:"\ " #{@buyer_phone_anonymized.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
95 96 97 98 99 100 |
# File 'lib/walmart_ap_is/models/buyer_info.rb', line 95 def to_s class_name = self.class.name.split('::').last "<#{class_name} purchase_order_id: #{@purchase_order_id}, buyer_name: #{@buyer_name},"\ " buyer_email: #{@buyer_email}, buyer_phone_anonymized: #{@buyer_phone_anonymized},"\ " additional_properties: #{@additional_properties}>" end |