Class: WalmartApIs::SellerAccount

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/walmart_ap_is/models/seller_account.rb

Overview

SellerAccount 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(seller_id: SKIP, business_name: SKIP, email: SKIP, account_status: SKIP, seller_type: SKIP, created_at: SKIP, additional_properties: nil) ⇒ SellerAccount

Returns a new instance of SellerAccount.



66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/walmart_ap_is/models/seller_account.rb', line 66

def initialize(seller_id: SKIP, business_name: SKIP, email: SKIP,
               account_status: SKIP, seller_type: SKIP, created_at: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @seller_id = seller_id unless seller_id == SKIP
  @business_name = business_name unless business_name == SKIP
  @email = email unless email == SKIP
  @account_status =  unless  == SKIP
  @seller_type = seller_type unless seller_type == SKIP
  @created_at = created_at unless created_at == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#account_statusAccountStatus

TODO: Write general description for this method

Returns:



27
28
29
# File 'lib/walmart_ap_is/models/seller_account.rb', line 27

def 
  @account_status
end

#business_nameString

TODO: Write general description for this method

Returns:

  • (String)


19
20
21
# File 'lib/walmart_ap_is/models/seller_account.rb', line 19

def business_name
  @business_name
end

#created_atDateTime

TODO: Write general description for this method

Returns:

  • (DateTime)


35
36
37
# File 'lib/walmart_ap_is/models/seller_account.rb', line 35

def created_at
  @created_at
end

#emailString

TODO: Write general description for this method

Returns:

  • (String)


23
24
25
# File 'lib/walmart_ap_is/models/seller_account.rb', line 23

def email
  @email
end

#seller_idString

TODO: Write general description for this method

Returns:

  • (String)


15
16
17
# File 'lib/walmart_ap_is/models/seller_account.rb', line 15

def seller_id
  @seller_id
end

#seller_typeSellerType

TODO: Write general description for this method

Returns:



31
32
33
# File 'lib/walmart_ap_is/models/seller_account.rb', line 31

def seller_type
  @seller_type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/walmart_ap_is/models/seller_account.rb', line 82

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  seller_id = hash.key?('sellerId') ? hash['sellerId'] : SKIP
  business_name = hash.key?('businessName') ? hash['businessName'] : SKIP
  email = hash.key?('email') ? hash['email'] : SKIP
   = hash.key?('accountStatus') ? hash['accountStatus'] : SKIP
  seller_type = hash.key?('sellerType') ? hash['sellerType'] : SKIP
  created_at = if hash.key?('createdAt')
                 (DateTimeHelper.from_rfc3339(hash['createdAt']) if hash['createdAt'])
               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.
  SellerAccount.new(seller_id: seller_id,
                    business_name: business_name,
                    email: email,
                    account_status: ,
                    seller_type: seller_type,
                    created_at: created_at,
                    additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



38
39
40
41
42
43
44
45
46
47
# File 'lib/walmart_ap_is/models/seller_account.rb', line 38

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['seller_id'] = 'sellerId'
  @_hash['business_name'] = 'businessName'
  @_hash['email'] = 'email'
  @_hash['account_status'] = 'accountStatus'
  @_hash['seller_type'] = 'sellerType'
  @_hash['created_at'] = 'createdAt'
  @_hash
end

.nullablesObject

An array for nullable fields



62
63
64
# File 'lib/walmart_ap_is/models/seller_account.rb', line 62

def self.nullables
  []
end

.optionalsObject

An array for optional fields



50
51
52
53
54
55
56
57
58
59
# File 'lib/walmart_ap_is/models/seller_account.rb', line 50

def self.optionals
  %w[
    seller_id
    business_name
    email
    account_status
    seller_type
    created_at
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



127
128
129
130
131
132
133
# File 'lib/walmart_ap_is/models/seller_account.rb', line 127

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} seller_id: #{@seller_id.inspect}, business_name: #{@business_name.inspect},"\
  " email: #{@email.inspect}, account_status: #{@account_status.inspect}, seller_type:"\
  " #{@seller_type.inspect}, created_at: #{@created_at.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_custom_created_atObject



114
115
116
# File 'lib/walmart_ap_is/models/seller_account.rb', line 114

def to_custom_created_at
  DateTimeHelper.to_rfc3339(created_at)
end

#to_sObject

Provides a human-readable string representation of the object.



119
120
121
122
123
124
# File 'lib/walmart_ap_is/models/seller_account.rb', line 119

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} seller_id: #{@seller_id}, business_name: #{@business_name}, email:"\
  " #{@email}, account_status: #{@account_status}, seller_type: #{@seller_type}, created_at:"\
  " #{@created_at}, additional_properties: #{@additional_properties}>"
end