class Minfraud::Components::Addressable

This is a parent class for the Billing and Shipping components.

Attributes

address[RW]

The first line of the user's billing / shipping address.

@return [String, nil]

address_2[RW]

The second line of the user's billing / shipping address.

@return [String, nil]

city[RW]

The city of the user's billing / shipping address.

@return [String, nil]

company[RW]

The company of the end user as provided in their billing / shipping information.

@return [String, nil]

country[RW]

The two character ISO 3166-1 alpha-2 country code of the user's billing / shipping address.

@see en.wikipedia.org/wiki/ISO_3166-1_alpha-2

@return [String, nil]

first_name[RW]

The first name of the end user as provided in their billing / shipping information.

@return [String, nil]

last_name[RW]

The last name of the end user as provided in their billing / shipping information.

@return [String, nil]

phone_country_code[RW]

The country code for the phone number associated with the user's billing / shipping address. If you provide this information then you must provide at least one digit.

@return [String, nil]

phone_number[RW]

The phone number without the country code for the user's billing / shipping address. Punctuation characters will be stripped. After stripping punctuation characters, the number must contain only digits.

@return [String, nil]

postal[RW]

The postal code of the user's billing / shipping address.

@return [String, nil]

region[RW]

The ISO 3166-2 subdivision code for the user's billing / shipping address.

@see en.wikipedia.org/wiki/ISO_3166-2

@return [String, nil]

Public Class Methods

new(params = {}) click to toggle source

@param params [Hash] Hash of parameters. Each key/value should

correspond to one of the available attributes.
# File lib/minfraud/components/addressable.rb, line 79
def initialize(params = {})
  @first_name         = params[:first_name]
  @last_name          = params[:last_name]
  @company            = params[:company]
  @address            = params[:address]
  @address_2          = params[:address_2]
  @city               = params[:city]
  @region             = params[:region]
  @country            = params[:country]
  @postal             = params[:postal]
  @phone_number       = params[:phone_number]
  @phone_country_code = params[:phone_country_code]

  validate
end

Private Instance Methods

validate() click to toggle source
# File lib/minfraud/components/addressable.rb, line 97
def validate
  return if !Minfraud.enable_validation

  validate_string('first_name', 255, @first_name)
  validate_string('last_name', 255, @last_name)
  validate_string('company', 255, @company)
  validate_string('address', 255, @address)
  validate_string('address_2', 255, @address_2)
  validate_string('city', 255, @city)
  validate_subdivision_code('region', @region)
  validate_country_code('country', @country)
  validate_string('postal', 255, @postal)
  validate_string('phone_number', 255, @phone_number)
  validate_telephone_country_code('phone_country_code', @phone_country_code)
end