class ProcessOut::APIVersion

Attributes

created_at[R]
description[R]
name[R]

Public Class Methods

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

Initializes the APIVersion object Params:

client

ProcessOut client instance

data

data that can be used to fill the object

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

  self.name = data.fetch(:name, nil)
  self.description = data.fetch(:description, nil)
  self.created_at = data.fetch(:created_at, nil)
  
end

Public Instance Methods

created_at=(val) click to toggle source
# File lib/processout/api_version.rb, line 24
def created_at=(val)
  @created_at = val
end
description=(val) click to toggle source
# File lib/processout/api_version.rb, line 20
def description=(val)
  @description = 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/api_version.rb, line 59
def fill_with_data(data)
  if data.nil?
    return self
  end
  if data.include? "name"
    self.name = data["name"]
  end
  if data.include? "description"
    self.description = data["description"]
  end
  if data.include? "created_at"
    self.created_at = data["created_at"]
  end
  
  self
end
name=(val) click to toggle source
# File lib/processout/api_version.rb, line 16
def name=(val)
  @name = val
end
new(data = {}) click to toggle source

Create a new APIVersion using the current client

# File lib/processout/api_version.rb, line 43
def new(data = {})
  APIVersion.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/api_version.rb, line 79
def prefill(data)
  if data.nil?
    return self
  end
  self.name = data.fetch(:name, self.name)
  self.description = data.fetch(:description, self.description)
  self.created_at = data.fetch(:created_at, self.created_at)
  
  self
end
to_json(options) click to toggle source

Overrides the JSON marshaller to only send the fields we want

# File lib/processout/api_version.rb, line 48
def to_json(options)
  {
      "name": self.name,
      "description": self.description,
      "created_at": self.created_at,
  }.to_json
end