Class: ThePlaidApi::ClientProvidedTransactionLocation
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ThePlaidApi::ClientProvidedTransactionLocation
- Defined in:
- lib/the_plaid_api/models/client_provided_transaction_location.rb
Overview
A representation of where a transaction took place. Use this field to pass in structured location information you may have about your transactions. Providing location data is optional but can increase result quality. If you have unstructured location information, it may be appended to the ‘description` field.
Instance Attribute Summary collapse
-
#address ⇒ String
The street address where the transaction occurred.
-
#city ⇒ String
The city where the transaction occurred.
-
#country ⇒ String
The country where the transaction occurred, formatted as an ISO 3166-1 alpha-2 country code (“US” or “CA”).
-
#postal_code ⇒ String
The postal code where the transaction occurred.
-
#region ⇒ String
The region or state where the transaction occurred, formatted as the official two-letter US state or Canadian province postal code, e.g.
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(country: SKIP, region: SKIP, city: SKIP, address: SKIP, postal_code: SKIP, additional_properties: nil) ⇒ ClientProvidedTransactionLocation
constructor
A new instance of ClientProvidedTransactionLocation.
-
#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(country: SKIP, region: SKIP, city: SKIP, address: SKIP, postal_code: SKIP, additional_properties: nil) ⇒ ClientProvidedTransactionLocation
Returns a new instance of ClientProvidedTransactionLocation.
66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/the_plaid_api/models/client_provided_transaction_location.rb', line 66 def initialize(country: SKIP, region: SKIP, city: SKIP, address: SKIP, postal_code: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @country = country unless country == SKIP @region = region unless region == SKIP @city = city unless city == SKIP @address = address unless address == SKIP @postal_code = postal_code unless postal_code == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#address ⇒ String
The street address where the transaction occurred.
33 34 35 |
# File 'lib/the_plaid_api/models/client_provided_transaction_location.rb', line 33 def address @address end |
#city ⇒ String
The city where the transaction occurred.
29 30 31 |
# File 'lib/the_plaid_api/models/client_provided_transaction_location.rb', line 29 def city @city end |
#country ⇒ String
The country where the transaction occurred, formatted as an ISO 3166-1 alpha-2 country code (“US” or “CA”).
19 20 21 |
# File 'lib/the_plaid_api/models/client_provided_transaction_location.rb', line 19 def country @country end |
#postal_code ⇒ String
The postal code where the transaction occurred.
37 38 39 |
# File 'lib/the_plaid_api/models/client_provided_transaction_location.rb', line 37 def postal_code @postal_code end |
#region ⇒ String
The region or state where the transaction occurred, formatted as the official two-letter US state or Canadian province postal code, e.g. “CT” or “QC”.
25 26 27 |
# File 'lib/the_plaid_api/models/client_provided_transaction_location.rb', line 25 def region @region end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/the_plaid_api/models/client_provided_transaction_location.rb', line 80 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. country = hash.key?('country') ? hash['country'] : SKIP region = hash.key?('region') ? hash['region'] : SKIP city = hash.key?('city') ? hash['city'] : SKIP address = hash.key?('address') ? hash['address'] : SKIP postal_code = hash.key?('postal_code') ? hash['postal_code'] : 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. ClientProvidedTransactionLocation.new(country: country, region: region, city: city, address: address, postal_code: postal_code, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
40 41 42 43 44 45 46 47 48 |
# File 'lib/the_plaid_api/models/client_provided_transaction_location.rb', line 40 def self.names @_hash = {} if @_hash.nil? @_hash['country'] = 'country' @_hash['region'] = 'region' @_hash['city'] = 'city' @_hash['address'] = 'address' @_hash['postal_code'] = 'postal_code' @_hash end |
.nullables ⇒ Object
An array for nullable fields
62 63 64 |
# File 'lib/the_plaid_api/models/client_provided_transaction_location.rb', line 62 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
51 52 53 54 55 56 57 58 59 |
# File 'lib/the_plaid_api/models/client_provided_transaction_location.rb', line 51 def self.optionals %w[ country region city address postal_code ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
115 116 117 118 119 120 |
# File 'lib/the_plaid_api/models/client_provided_transaction_location.rb', line 115 def inspect class_name = self.class.name.split('::').last "<#{class_name} country: #{@country.inspect}, region: #{@region.inspect}, city:"\ " #{@city.inspect}, address: #{@address.inspect}, postal_code: #{@postal_code.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
107 108 109 110 111 112 |
# File 'lib/the_plaid_api/models/client_provided_transaction_location.rb', line 107 def to_s class_name = self.class.name.split('::').last "<#{class_name} country: #{@country}, region: #{@region}, city: #{@city}, address:"\ " #{@address}, postal_code: #{@postal_code}, additional_properties:"\ " #{@additional_properties}>" end |