class ProcessOut::InvoiceRisk

Attributes

is_legit[R]
score[R]

Public Class Methods

new(client, data = {}) click to toggle source

Initializes the InvoiceRisk object Params:

client

ProcessOut client instance

data

data that can be used to fill the object

# File lib/processout/invoice_risk.rb, line 28
def initialize(client, data = {})
  @client = client

  self.score = data.fetch(:score, nil)
  self.is_legit = data.fetch(:is_legit, nil)
  
end

Public Instance Methods

fill_with_data(data) click to toggle source

Fills the object with data coming from the API Params:

data

Hash of data coming from the API

# File lib/processout/invoice_risk.rb, line 52
def fill_with_data(data)
  if data.nil?
    return self
  end
  if data.include? "score"
    self.score = data["score"]
  end
  if data.include? "is_legit"
    self.is_legit = data["is_legit"]
  end
  
  self
end
is_legit=(val) click to toggle source
# File lib/processout/invoice_risk.rb, line 19
def is_legit=(val)
  @is_legit = val
end
new(data = {}) click to toggle source

Create a new InvoiceRisk using the current client

# File lib/processout/invoice_risk.rb, line 37
def new(data = {})
  InvoiceRisk.new(@client, data)
end
prefill(data) click to toggle source

Prefills the object with the data passed as parameters Params:

data

Hash of data

# File lib/processout/invoice_risk.rb, line 69
def prefill(data)
  if data.nil?
    return self
  end
  self.score = data.fetch(:score, self.score)
  self.is_legit = data.fetch(:is_legit, self.is_legit)
  
  self
end
score=(val) click to toggle source
# File lib/processout/invoice_risk.rb, line 15
def score=(val)
  @score = val
end
to_json(options) click to toggle source

Overrides the JSON marshaller to only send the fields we want

# File lib/processout/invoice_risk.rb, line 42
def to_json(options)
  {
      "score": self.score,
      "is_legit": self.is_legit,
  }.to_json
end