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



153
154
155
156
157
158
159
160
161
162
163
164
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
# File 'lib/ultracart_api/models/order_fraud_score.rb', line 153

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  if attributes.has_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



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

def anonymous_proxy
  @anonymous_proxy
end

#bin_matchObject

Whether the BIN (first six digits) matched the country



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

def bin_match
  @bin_match
end

#carder_emailObject

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



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

def carder_email
  @carder_email
end

#country_codeObject

Country code



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

def country_code
  @country_code
end

#country_matchObject

Country code matches BIN country



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

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



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

def customer_phone_in_billing_location
  @customer_phone_in_billing_location
end

#distance_kmObject

Distance in kilometers between the IP address and the BIN



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

def distance_km
  @distance_km
end

#free_emailObject

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



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

def free_email
  @free_email
end

#high_risk_countryObject

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



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

def high_risk_country
  @high_risk_country
end

#ip_cityObject

City associated with the IP address



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

def ip_city
  @ip_city
end

#ip_ispObject

ISP that owns the IP address



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

def ip_isp
  @ip_isp
end

#ip_latitudeObject

Approximate latitude associated with the IP address



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

def ip_latitude
  @ip_latitude
end

#ip_longitudeObject

Approximate longitude associated with the IP address



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

def ip_longitude
  @ip_longitude
end

#ip_orgObject

Organization that owns the IP address



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

def ip_org
  @ip_org
end

#ip_regionObject

State/region associated with the IP address



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

def ip_region
  @ip_region
end

#proxy_scoreObject

Likelihood of the IP address being a proxy server



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

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.



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

def score
  @score
end

#ship_forwarderObject

True if the address is a known ship forwarding company



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

def ship_forwarder
  @ship_forwarder
end

#spam_scoreObject

Likelihood of the email address being associated with a spammer



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

def spam_score
  @spam_score
end

#transparent_proxyObject

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



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

def transparent_proxy
  @transparent_proxy
end

Class Method Details

.attribute_mapObject

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



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

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

.swagger_typesObject

Attribute type mapping.



126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# File 'lib/ultracart_api/models/order_fraud_score.rb', line 126

def self.swagger_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



267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
# File 'lib/ultracart_api/models/order_fraud_score.rb', line 267

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



328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
# File 'lib/ultracart_api/models/order_fraud_score.rb', line 328

def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    DateTime.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
    temp_model = UltracartClient.const_get(type).new
    temp_model.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



394
395
396
397
398
399
400
401
402
403
404
405
406
# File 'lib/ultracart_api/models/order_fraud_score.rb', line 394

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



307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
# File 'lib/ultracart_api/models/order_fraud_score.rb', line 307

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.swagger_types.each_pair do |key, type|
    if 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 # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


294
295
296
# File 'lib/ultracart_api/models/order_fraud_score.rb', line 294

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



300
301
302
# File 'lib/ultracart_api/models/order_fraud_score.rb', line 300

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



242
243
244
245
# File 'lib/ultracart_api/models/order_fraud_score.rb', line 242

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



374
375
376
# File 'lib/ultracart_api/models/order_fraud_score.rb', line 374

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



380
381
382
383
384
385
386
387
388
# File 'lib/ultracart_api/models/order_fraud_score.rb', line 380

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    next if value.nil?
    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



368
369
370
# File 'lib/ultracart_api/models/order_fraud_score.rb', line 368

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



249
250
251
252
253
# File 'lib/ultracart_api/models/order_fraud_score.rb', line 249

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