Class: ProcessOut::ThreeDS

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Initializes the ThreeDS object Params:

client

ProcessOut client instance

data

data that can be used to fill the object



38
39
40
41
42
43
44
45
46
# File 'lib/processout/three_ds.rb', line 38

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

  self.version = data.fetch(:version, nil)
  self.status = data.fetch(:status, nil)
  self.fingerprinted = data.fetch(:fingerprinted, nil)
  self.challenged = data.fetch(:challenged, nil)
  
end

Instance Attribute Details

#challenged ⇒ Object

Returns the value of attribute challenged.



14
15
16
# File 'lib/processout/three_ds.rb', line 14

def challenged
  @challenged
end

#fingerprinted ⇒ Object

Returns the value of attribute fingerprinted.



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

def fingerprinted
  @fingerprinted
end

#status ⇒ Object

Returns the value of attribute status.



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

def status
  @status
end

#version ⇒ Object

Returns the value of attribute version.



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

def version
  @version
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



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/processout/three_ds.rb', line 66

def fill_with_data(data)
  if data.nil?
    return self
  end
  if data.include? "Version"
    self.version = data["Version"]
  end
  if data.include? "Status"
    self.status = data["Status"]
  end
  if data.include? "fingerprinted"
    self.fingerprinted = data["fingerprinted"]
  end
  if data.include? "challenged"
    self.challenged = data["challenged"]
  end
  
  self
end

#new(data = {}) ⇒ Object

Create a new ThreeDS using the current client



49
50
51
# File 'lib/processout/three_ds.rb', line 49

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

#prefill(data) ⇒ Object

Prefills the object with the data passed as parameters Params:

data

Hash of data



89
90
91
92
93
94
95
96
97
98
99
# File 'lib/processout/three_ds.rb', line 89

def prefill(data)
  if data.nil?
    return self
  end
  self.version = data.fetch(:version, self.version)
  self.status = data.fetch(:status, self.status)
  self.fingerprinted = data.fetch(:fingerprinted, self.fingerprinted)
  self.challenged = data.fetch(:challenged, self.challenged)
  
  self
end

#to_json(options) ⇒ Object

Overrides the JSON marshaller to only send the fields we want



54
55
56
57
58
59
60
61
# File 'lib/processout/three_ds.rb', line 54

def to_json(options)
  {
      "Version": self.version,
      "Status": self.status,
      "fingerprinted": self.fingerprinted,
      "challenged": self.challenged,
  }.to_json
end