Class: ThePlaidApi::BusinessWhoisRecord

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/the_plaid_api/models/business_whois_record.rb

Overview

WHOIS metadata for the business website domain.

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(domain_created_at:, domain_updated_at:, domain_expires_at:, registrar:, additional_properties: nil) ⇒ BusinessWhoisRecord

Returns a new instance of BusinessWhoisRecord.



54
55
56
57
58
59
60
61
62
63
64
# File 'lib/the_plaid_api/models/business_whois_record.rb', line 54

def initialize(domain_created_at:, domain_updated_at:, domain_expires_at:,
               registrar:, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @domain_created_at = domain_created_at
  @domain_updated_at = domain_updated_at
  @domain_expires_at = domain_expires_at
  @registrar = registrar
  @additional_properties = additional_properties
end

Instance Attribute Details

#domain_created_atDateTime

An ISO8601 formatted timestamp.

Returns:

  • (DateTime)


15
16
17
# File 'lib/the_plaid_api/models/business_whois_record.rb', line 15

def domain_created_at
  @domain_created_at
end

#domain_expires_atDateTime

An ISO8601 formatted timestamp.

Returns:

  • (DateTime)


23
24
25
# File 'lib/the_plaid_api/models/business_whois_record.rb', line 23

def domain_expires_at
  @domain_expires_at
end

#domain_updated_atDateTime

An ISO8601 formatted timestamp.

Returns:

  • (DateTime)


19
20
21
# File 'lib/the_plaid_api/models/business_whois_record.rb', line 19

def domain_updated_at
  @domain_updated_at
end

#registrarString

Domain registrar.

Returns:

  • (String)


27
28
29
# File 'lib/the_plaid_api/models/business_whois_record.rb', line 27

def registrar
  @registrar
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



67
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
93
94
95
# File 'lib/the_plaid_api/models/business_whois_record.rb', line 67

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  domain_created_at = if hash.key?('domain_created_at')
                        (DateTimeHelper.from_rfc3339(hash['domain_created_at']) if hash['domain_created_at'])
                      end
  domain_updated_at = if hash.key?('domain_updated_at')
                        (DateTimeHelper.from_rfc3339(hash['domain_updated_at']) if hash['domain_updated_at'])
                      end
  domain_expires_at = if hash.key?('domain_expires_at')
                        (DateTimeHelper.from_rfc3339(hash['domain_expires_at']) if hash['domain_expires_at'])
                      end
  registrar = hash.key?('registrar') ? hash['registrar'] : nil

  # 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.
  BusinessWhoisRecord.new(domain_created_at: domain_created_at,
                          domain_updated_at: domain_updated_at,
                          domain_expires_at: domain_expires_at,
                          registrar: registrar,
                          additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



30
31
32
33
34
35
36
37
# File 'lib/the_plaid_api/models/business_whois_record.rb', line 30

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['domain_created_at'] = 'domain_created_at'
  @_hash['domain_updated_at'] = 'domain_updated_at'
  @_hash['domain_expires_at'] = 'domain_expires_at'
  @_hash['registrar'] = 'registrar'
  @_hash
end

.nullablesObject

An array for nullable fields



45
46
47
48
49
50
51
52
# File 'lib/the_plaid_api/models/business_whois_record.rb', line 45

def self.nullables
  %w[
    domain_created_at
    domain_updated_at
    domain_expires_at
    registrar
  ]
end

.optionalsObject

An array for optional fields



40
41
42
# File 'lib/the_plaid_api/models/business_whois_record.rb', line 40

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



118
119
120
121
122
123
# File 'lib/the_plaid_api/models/business_whois_record.rb', line 118

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} domain_created_at: #{@domain_created_at.inspect}, domain_updated_at:"\
  " #{@domain_updated_at.inspect}, domain_expires_at: #{@domain_expires_at.inspect},"\
  " registrar: #{@registrar.inspect}, additional_properties: #{@additional_properties}>"
end

#to_custom_domain_created_atObject



97
98
99
# File 'lib/the_plaid_api/models/business_whois_record.rb', line 97

def to_custom_domain_created_at
  DateTimeHelper.to_rfc3339(domain_created_at)
end

#to_custom_domain_expires_atObject



105
106
107
# File 'lib/the_plaid_api/models/business_whois_record.rb', line 105

def to_custom_domain_expires_at
  DateTimeHelper.to_rfc3339(domain_expires_at)
end

#to_custom_domain_updated_atObject



101
102
103
# File 'lib/the_plaid_api/models/business_whois_record.rb', line 101

def to_custom_domain_updated_at
  DateTimeHelper.to_rfc3339(domain_updated_at)
end

#to_sObject

Provides a human-readable string representation of the object.



110
111
112
113
114
115
# File 'lib/the_plaid_api/models/business_whois_record.rb', line 110

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} domain_created_at: #{@domain_created_at}, domain_updated_at:"\
  " #{@domain_updated_at}, domain_expires_at: #{@domain_expires_at}, registrar: #{@registrar},"\
  " additional_properties: #{@additional_properties}>"
end