Sha256: 3a12d246f85fc401662de92ddd5038e0445837385fcf1d0b6689b337d23086cb
Contents?: true
Size: 796 Bytes
Versions: 1
Compression:
Stored size: 796 Bytes
Contents
# frozen_string_literal: true require 'time' module Kentaa module Api module Resources class Resource < Base attr_accessor :id def initialize(config, options = {}) super(config, options) if options.key?(:data) @data = options.delete(:data) || {} @id = @data.fetch(:id) if @data.key?(:id) elsif options.key?(:id) @id = options.delete(:id) end end def load super @id = data.fetch(:id) if data.key?(:id) self end def created_at Time.parse(data[:created_at]) if data[:created_at] end def updated_at Time.parse(data[:updated_at]) if data[:updated_at] end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
kentaa-api-0.3.2 | lib/kentaa/api/resources/resource.rb |