class ProcessOut::DunningAction
Attributes
action[R]
delay_in_days[R]
Public Class Methods
new(client, data = {})
click to toggle source
Initializes the DunningAction
object Params:
client
-
ProcessOut
client instance data
-
data that can be used to fill the object
# File lib/processout/dunning_action.rb, line 28 def initialize(client, data = {}) @client = client self.action = data.fetch(:action, nil) self.delay_in_days = data.fetch(:delay_in_days, nil) end
Public Instance Methods
action=(val)
click to toggle source
# File lib/processout/dunning_action.rb, line 15 def action=(val) @action = val end
delay_in_days=(val)
click to toggle source
# File lib/processout/dunning_action.rb, line 19 def delay_in_days=(val) @delay_in_days = val end
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/dunning_action.rb, line 52 def fill_with_data(data) if data.nil? return self end if data.include? "action" self.action = data["action"] end if data.include? "delay_in_days" self.delay_in_days = data["delay_in_days"] end self end
new(data = {})
click to toggle source
Create a new DunningAction
using the current client
# File lib/processout/dunning_action.rb, line 37 def new(data = {}) DunningAction.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/dunning_action.rb, line 69 def prefill(data) if data.nil? return self end self.action = data.fetch(:action, self.action) self.delay_in_days = data.fetch(:delay_in_days, self.delay_in_days) self end
to_json(options)
click to toggle source
Overrides the JSON marshaller to only send the fields we want
# File lib/processout/dunning_action.rb, line 42 def to_json(options) { "action": self.action, "delay_in_days": self.delay_in_days, }.to_json end