class ProcessOut::WebhookEndpoint

Attributes

created_at[R]
events_whitelist[R]
id[R]
project[R]
project_id[R]
sandbox[R]
url[R]

Public Class Methods

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

Initializes the WebhookEndpoint object Params:

client

ProcessOut client instance

data

data that can be used to fill the object

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

  self.id = data.fetch(:id, nil)
  self.project = data.fetch(:project, nil)
  self.project_id = data.fetch(:project_id, nil)
  self.url = data.fetch(:url, nil)
  self.events_whitelist = data.fetch(:events_whitelist, nil)
  self.sandbox = data.fetch(:sandbox, nil)
  self.created_at = data.fetch(:created_at, nil)
  
end

Public Instance Methods

created_at=(val) click to toggle source
# File lib/processout/webhook_endpoint.rb, line 57
def created_at=(val)
  @created_at = val
end
events_whitelist=(val) click to toggle source
# File lib/processout/webhook_endpoint.rb, line 48
def events_whitelist=(val)
  @events_whitelist = 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/webhook_endpoint.rb, line 100
def fill_with_data(data)
  if data.nil?
    return self
  end
  if data.include? "id"
    self.id = data["id"]
  end
  if data.include? "project"
    self.project = data["project"]
  end
  if data.include? "project_id"
    self.project_id = data["project_id"]
  end
  if data.include? "url"
    self.url = data["url"]
  end
  if data.include? "events_whitelist"
    self.events_whitelist = data["events_whitelist"]
  end
  if data.include? "sandbox"
    self.sandbox = data["sandbox"]
  end
  if data.include? "created_at"
    self.created_at = data["created_at"]
  end
  
  self
end
id=(val) click to toggle source
# File lib/processout/webhook_endpoint.rb, line 20
def id=(val)
  @id = val
end
new(data = {}) click to toggle source

Create a new WebhookEndpoint using the current client

# File lib/processout/webhook_endpoint.rb, line 80
def new(data = {})
  WebhookEndpoint.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/webhook_endpoint.rb, line 132
def prefill(data)
  if data.nil?
    return self
  end
  self.id = data.fetch(:id, self.id)
  self.project = data.fetch(:project, self.project)
  self.project_id = data.fetch(:project_id, self.project_id)
  self.url = data.fetch(:url, self.url)
  self.events_whitelist = data.fetch(:events_whitelist, self.events_whitelist)
  self.sandbox = data.fetch(:sandbox, self.sandbox)
  self.created_at = data.fetch(:created_at, self.created_at)
  
  self
end
project=(val) click to toggle source
# File lib/processout/webhook_endpoint.rb, line 24
def project=(val)
  if val.nil?
    @project = val
    return
  end

  if val.instance_of? Project
    @project = val
  else
    obj = Project.new(@client)
    obj.fill_with_data(val)
    @project = obj
  end
  
end
project_id=(val) click to toggle source
# File lib/processout/webhook_endpoint.rb, line 40
def project_id=(val)
  @project_id = val
end
sandbox=(val) click to toggle source
# File lib/processout/webhook_endpoint.rb, line 53
def sandbox=(val)
  @sandbox = val
end
to_json(options) click to toggle source

Overrides the JSON marshaller to only send the fields we want

# File lib/processout/webhook_endpoint.rb, line 85
def to_json(options)
  {
      "id": self.id,
      "project": self.project,
      "project_id": self.project_id,
      "url": self.url,
      "events_whitelist": self.events_whitelist,
      "sandbox": self.sandbox,
      "created_at": self.created_at,
  }.to_json
end
url=(val) click to toggle source
# File lib/processout/webhook_endpoint.rb, line 44
def url=(val)
  @url = val
end