Class: UltracartClient::OrderFraudScore

Inherits:
Object
  • Object
show all
Defined in:
lib/ultracart_api/models/order_fraud_score.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ OrderFraudScore

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
# File 'lib/ultracart_api/models/order_fraud_score.rb', line 165

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::OrderFraudScore` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!self.class.attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::OrderFraudScore`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'anonymous_proxy')
    self.anonymous_proxy = attributes[:'anonymous_proxy']
  end

  if attributes.key?(:'bin_match')
    self.bin_match = attributes[:'bin_match']
  end

  if attributes.key?(:'carder_email')
    self.carder_email = attributes[:'carder_email']
  end

  if attributes.key?(:'country_code')
    self.country_code = attributes[:'country_code']
  end

  if attributes.key?(:'country_match')
    self.country_match = attributes[:'country_match']
  end

  if attributes.key?(:'customer_phone_in_billing_location')
    self.customer_phone_in_billing_location = attributes[:'customer_phone_in_billing_location']
  end

  if attributes.key?(:'distance_km')
    self.distance_km = attributes[:'distance_km']
  end

  if attributes.key?(:'free_email')
    self.free_email = attributes[:'free_email']
  end

  if attributes.key?(:'high_risk_country')
    self.high_risk_country = attributes[:'high_risk_country']
  end

  if attributes.key?(:'ip_city')
    self.ip_city = attributes[:'ip_city']
  end

  if attributes.key?(:'ip_isp')
    self.ip_isp = attributes[:'ip_isp']
  end

  if attributes.key?(:'ip_latitude')
    self.ip_latitude = attributes[:'ip_latitude']
  end

  if attributes.key?(:'ip_longitude')
    self.ip_longitude = attributes[:'ip_longitude']
  end

  if attributes.key?(:'ip_org')
    self.ip_org = attributes[:'ip_org']
  end

  if attributes.key?(:'ip_region')
    self.ip_region = attributes[:'ip_region']
  end

  if attributes.key?(:'proxy_score')
    self.proxy_score = attributes[:'proxy_score']
  end

  if attributes.key?(:'score')
    self.score = attributes[:'score']
  end

  if attributes.key?(:'ship_forwarder')
    self.ship_forwarder = attributes[:'ship_forwarder']
  end

  if attributes.key?(:'spam_score')
    self.spam_score = attributes[:'spam_score']
  end

  if attributes.key?(:'transparent_proxy')
    self.transparent_proxy = attributes[:'transparent_proxy']
  end
end

Instance Attribute Details

#anonymous_proxyObject

True if the IP address is a known anonymous proxy server



19
20
21
# File 'lib/ultracart_api/models/order_fraud_score.rb', line 19

def anonymous_proxy
  @anonymous_proxy
end

#bin_matchObject

Whether the BIN (first six digits) matched the country



22
23
24
# File 'lib/ultracart_api/models/order_fraud_score.rb', line 22

def bin_match
  @bin_match
end

#carder_emailObject

True if the email address belongs to a known credit card fraudster



25
26
27
# File 'lib/ultracart_api/models/order_fraud_score.rb', line 25

def carder_email
  @carder_email
end

#country_codeObject

Country code



28
29
30
# File 'lib/ultracart_api/models/order_fraud_score.rb', line 28

def country_code
  @country_code
end

#country_matchObject

Country code matches BIN country



31
32
33
# File 'lib/ultracart_api/models/order_fraud_score.rb', line 31

def country_match
  @country_match
end

#customer_phone_in_billing_locationObject

Whether the customer’s phone number is located in the area of the billing address



34
35
36
# File 'lib/ultracart_api/models/order_fraud_score.rb', line 34

def customer_phone_in_billing_location
  @customer_phone_in_billing_location
end

#distance_kmObject

Distance in kilometers between the IP address and the BIN



37
38
39
# File 'lib/ultracart_api/models/order_fraud_score.rb', line 37

def distance_km
  @distance_km
end

#free_emailObject

True if the email address is for a free service like gmail.com



40
41
42
# File 'lib/ultracart_api/models/order_fraud_score.rb', line 40

def free_email
  @free_email
end

#high_risk_countryObject

True if the customer is in a high risk country known for internet fraud



43
44
45
# File 'lib/ultracart_api/models/order_fraud_score.rb', line 43

def high_risk_country
  @high_risk_country
end

#ip_cityObject

City associated with the IP address



46
47
48
# File 'lib/ultracart_api/models/order_fraud_score.rb', line 46

def ip_city
  @ip_city
end

#ip_ispObject

ISP that owns the IP address



49
50
51
# File 'lib/ultracart_api/models/order_fraud_score.rb', line 49

def ip_isp
  @ip_isp
end

#ip_latitudeObject

Approximate latitude associated with the IP address



52
53
54
# File 'lib/ultracart_api/models/order_fraud_score.rb', line 52

def ip_latitude
  @ip_latitude
end

#ip_longitudeObject

Approximate longitude associated with the IP address



55
56
57
# File 'lib/ultracart_api/models/order_fraud_score.rb', line 55

def ip_longitude
  @ip_longitude
end

#ip_orgObject

Organization that owns the IP address



58
59
60
# File 'lib/ultracart_api/models/order_fraud_score.rb', line 58

def ip_org
  @ip_org
end

#ip_regionObject

State/region associated with the IP address



61
62
63
# File 'lib/ultracart_api/models/order_fraud_score.rb', line 61

def ip_region
  @ip_region
end

#proxy_scoreObject

Likelihood of the IP address being a proxy server



64
65
66
# File 'lib/ultracart_api/models/order_fraud_score.rb', line 64

def proxy_score
  @proxy_score
end

#scoreObject

Overall score. This is the score that is compared to see if the order is rejected or held for review by the fraud filter rules.



67
68
69
# File 'lib/ultracart_api/models/order_fraud_score.rb', line 67

def score
  @score
end

#ship_forwarderObject

True if the address is a known ship forwarding company



70
71
72
# File 'lib/ultracart_api/models/order_fraud_score.rb', line 70

def ship_forwarder
  @ship_forwarder
end

#spam_scoreObject

Likelihood of the email address being associated with a spammer



73
74
75
# File 'lib/ultracart_api/models/order_fraud_score.rb', line 73

def spam_score
  @spam_score
end

#transparent_proxyObject

True if the IP address that placed the order is a transparent proxy server



76
77
78
# File 'lib/ultracart_api/models/order_fraud_score.rb', line 76

def transparent_proxy
  @transparent_proxy
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



127
128
129
# File 'lib/ultracart_api/models/order_fraud_score.rb', line 127

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/ultracart_api/models/order_fraud_score.rb', line 101

def self.attribute_map
  {
    :'anonymous_proxy' => :'anonymous_proxy',
    :'bin_match' => :'bin_match',
    :'carder_email' => :'carder_email',
    :'country_code' => :'country_code',
    :'country_match' => :'country_match',
    :'customer_phone_in_billing_location' => :'customer_phone_in_billing_location',
    :'distance_km' => :'distance_km',
    :'free_email' => :'free_email',
    :'high_risk_country' => :'high_risk_country',
    :'ip_city' => :'ip_city',
    :'ip_isp' => :'ip_isp',
    :'ip_latitude' => :'ip_latitude',
    :'ip_longitude' => :'ip_longitude',
    :'ip_org' => :'ip_org',
    :'ip_region' => :'ip_region',
    :'proxy_score' => :'proxy_score',
    :'score' => :'score',
    :'ship_forwarder' => :'ship_forwarder',
    :'spam_score' => :'spam_score',
    :'transparent_proxy' => :'transparent_proxy'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



326
327
328
# File 'lib/ultracart_api/models/order_fraud_score.rb', line 326

def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end

.openapi_nullableObject

List of attributes with nullable: true



158
159
160
161
# File 'lib/ultracart_api/models/order_fraud_score.rb', line 158

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'lib/ultracart_api/models/order_fraud_score.rb', line 132

def self.openapi_types
  {
    :'anonymous_proxy' => :'Boolean',
    :'bin_match' => :'String',
    :'carder_email' => :'Boolean',
    :'country_code' => :'String',
    :'country_match' => :'Boolean',
    :'customer_phone_in_billing_location' => :'String',
    :'distance_km' => :'Integer',
    :'free_email' => :'Boolean',
    :'high_risk_country' => :'Boolean',
    :'ip_city' => :'String',
    :'ip_isp' => :'String',
    :'ip_latitude' => :'String',
    :'ip_longitude' => :'String',
    :'ip_org' => :'String',
    :'ip_region' => :'String',
    :'proxy_score' => :'Float',
    :'score' => :'Float',
    :'ship_forwarder' => :'Boolean',
    :'spam_score' => :'Float',
    :'transparent_proxy' => :'Boolean'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
# File 'lib/ultracart_api/models/order_fraud_score.rb', line 286

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      anonymous_proxy == o.anonymous_proxy &&
      bin_match == o.bin_match &&
      carder_email == o.carder_email &&
      country_code == o.country_code &&
      country_match == o.country_match &&
      customer_phone_in_billing_location == o.customer_phone_in_billing_location &&
      distance_km == o.distance_km &&
      free_email == o.free_email &&
      high_risk_country == o.high_risk_country &&
      ip_city == o.ip_city &&
      ip_isp == o.ip_isp &&
      ip_latitude == o.ip_latitude &&
      ip_longitude == o.ip_longitude &&
      ip_org == o.ip_org &&
      ip_region == o.ip_region &&
      proxy_score == o.proxy_score &&
      score == o.score &&
      ship_forwarder == o.ship_forwarder &&
      spam_score == o.spam_score &&
      transparent_proxy == o.transparent_proxy
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
# File 'lib/ultracart_api/models/order_fraud_score.rb', line 357

def _deserialize(type, value)
  case type.to_sym
  when :Time
    Time.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :Boolean
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    # models (e.g. Pet) or oneOf
    klass = UltracartClient.const_get(type)
    klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



428
429
430
431
432
433
434
435
436
437
438
439
440
# File 'lib/ultracart_api/models/order_fraud_score.rb', line 428

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
# File 'lib/ultracart_api/models/order_fraud_score.rb', line 333

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  self.class.openapi_types.each_pair do |key, type|
    if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
      self.send("#{key}=", nil)
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


313
314
315
# File 'lib/ultracart_api/models/order_fraud_score.rb', line 313

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



319
320
321
# File 'lib/ultracart_api/models/order_fraud_score.rb', line 319

def hash
  [anonymous_proxy, bin_match, carder_email, country_code, country_match, customer_phone_in_billing_location, distance_km, free_email, high_risk_country, ip_city, ip_isp, ip_latitude, ip_longitude, ip_org, ip_region, proxy_score, score, ship_forwarder, spam_score, transparent_proxy].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



261
262
263
264
# File 'lib/ultracart_api/models/order_fraud_score.rb', line 261

def list_invalid_properties
  invalid_properties = Array.new
  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



404
405
406
# File 'lib/ultracart_api/models/order_fraud_score.rb', line 404

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



410
411
412
413
414
415
416
417
418
419
420
421
422
# File 'lib/ultracart_api/models/order_fraud_score.rb', line 410

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



398
399
400
# File 'lib/ultracart_api/models/order_fraud_score.rb', line 398

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



268
269
270
271
272
# File 'lib/ultracart_api/models/order_fraud_score.rb', line 268

def valid?
  bin_match_validator = EnumAttributeValidator.new('String', ["NA", "No", "NotFound", "Yes"])
  return false unless bin_match_validator.valid?(@bin_match)
  true
end