class Scim::Kit::V2::Meta

Represents a meta section

Attributes

created[RW]
last_modified[RW]
location[R]
resource_type[R]
version[RW]

Public Class Methods

from(hash) click to toggle source
# File lib/scim/kit/v2/meta.rb, line 25
def self.from(hash)
  meta = Meta.new(hash[:resourceType], hash[:location])
  meta.created = parse_date(hash[:created])
  meta.last_modified = parse_date(hash[:lastModified])
  meta.version = hash[:version]
  meta
end
new(resource_type, location) click to toggle source
# File lib/scim/kit/v2/meta.rb, line 14
def initialize(resource_type, location)
  @resource_type = resource_type || 'Unknown'
  @location = location
  @created = @last_modified = Time.now
  @version = @created.to_i
end
parse_date(date) click to toggle source
# File lib/scim/kit/v2/meta.rb, line 33
def self.parse_date(date)
  DateTime.parse(date).to_time
rescue StandardError
  nil
end

Public Instance Methods

disable_timestamps() click to toggle source
# File lib/scim/kit/v2/meta.rb, line 21
def disable_timestamps
  @version = @created = @last_modified = nil
end