Class: ProcessOut::InvoiceExternalFraudTools

Inherits:
Object
  • Object
show all
Defined in:
lib/processout/invoice_external_fraud_tools.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, data = {}) ⇒ InvoiceExternalFraudTools

Initializes the InvoiceExternalFraudTools object Params:

client

ProcessOut client instance

data

data that can be used to fill the object



36
37
38
39
40
41
42
43
# File 'lib/processout/invoice_external_fraud_tools.rb', line 36

def initialize(client, data = {})
  @client = client

  self.forter = data.fetch(:forter, nil)
  self.ravelin = data.fetch(:ravelin, nil)
  self.signifyd = data.fetch(:signifyd, nil)
  
end

Instance Attribute Details

#forterObject

Returns the value of attribute forter.



11
12
13
# File 'lib/processout/invoice_external_fraud_tools.rb', line 11

def forter
  @forter
end

#ravelinObject

Returns the value of attribute ravelin.



12
13
14
# File 'lib/processout/invoice_external_fraud_tools.rb', line 12

def ravelin
  @ravelin
end

#signifydObject

Returns the value of attribute signifyd.



13
14
15
# File 'lib/processout/invoice_external_fraud_tools.rb', line 13

def signifyd
  @signifyd
end

Instance Method Details

#fill_with_data(data) ⇒ Object

Fills the object with data coming from the API Params:

data

Hash of data coming from the API



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/processout/invoice_external_fraud_tools.rb', line 62

def fill_with_data(data)
  if data.nil?
    return self
  end
  if data.include? "forter"
    self.forter = data["forter"]
  end
  if data.include? "ravelin"
    self.ravelin = data["ravelin"]
  end
  if data.include? "signifyd"
    self.signifyd = data["signifyd"]
  end
  
  self
end

#new(data = {}) ⇒ Object

Create a new InvoiceExternalFraudTools using the current client



46
47
48
# File 'lib/processout/invoice_external_fraud_tools.rb', line 46

def new(data = {})
  InvoiceExternalFraudTools.new(@client, data)
end

#prefill(data) ⇒ Object

Prefills the object with the data passed as parameters Params:

data

Hash of data



82
83
84
85
86
87
88
89
90
91
# File 'lib/processout/invoice_external_fraud_tools.rb', line 82

def prefill(data)
  if data.nil?
    return self
  end
  self.forter = data.fetch(:forter, self.forter)
  self.ravelin = data.fetch(:ravelin, self.ravelin)
  self.signifyd = data.fetch(:signifyd, self.signifyd)
  
  self
end

#to_json(options) ⇒ Object

Overrides the JSON marshaller to only send the fields we want



51
52
53
54
55
56
57
# File 'lib/processout/invoice_external_fraud_tools.rb', line 51

def to_json(options)
  {
      "forter": self.forter,
      "ravelin": self.ravelin,
      "signifyd": self.signifyd,
  }.to_json
end