class Taleo::Resource

Attributes

client[R]
data[R]

Public Class Methods

has_many(name, type, through: name, singular: name, plural: name) click to toggle source

Define a has-many relationship with another resource

# File lib/taleo/resource.rb, line 24
def self.has_many(name, type, through: name, singular: name, plural: name)
  define_method(:"has_#{name}?") do
    relationship_urls.key?(through.to_s)
  end

  define_method(name) do
    related_resources(name.to_s, type, through, singular, plural)
  end
end
has_one(name, type, through: name, identifier: name) click to toggle source

Define a has-one relationship with another resource

# File lib/taleo/resource.rb, line 13
def self.has_one(name, type, through: name, identifier: name)
  define_method(:"has_#{name}?") do
    relationship_urls.key?(through.to_s)
  end

  define_method(name) do
    related_resource(name.to_s, through, identifier, type)
  end
end
new(data, client) click to toggle source
# File lib/taleo/resource.rb, line 7
def initialize(data, client)
  @data = data
  @client = client
end

Public Instance Methods

relationship_urls() click to toggle source

Get URLs for related resources

# File lib/taleo/resource.rb, line 65
def relationship_urls
  data.fetch('relationshipUrls')
end