Sha256: 962a16595bd28af34657132060d78ba11ac1113e28d5662005da5153fc54eae3
Contents?: true
Size: 803 Bytes
Versions: 6
Compression:
Stored size: 803 Bytes
Contents
# frozen_string_literal: true module WCC::Blogs class Property extend WCC::Blogs::Utils require 'time' def self.find(property = nil) new(WCC::Blogs.client.property_show(property).raw, client: WCC::Blogs.client) end attr_reader :raw def initialize(raw, client: WCC::Blogs.client) @raw = raw @client = client end def to_param key end define_camelcase_alias( 'key', 'digest' ) do |camelcase| raw[camelcase] end def _links OpenStruct.new(raw['_links'] || {}) end define_camelcase_alias( 'accepted_tags', 'categories' ) do |camelcase| targets = raw[camelcase] || [] targets.map { |val| OpenStruct.new(val) if val } end alias cache_key digest end end
Version data entries
6 entries across 6 versions & 1 rubygems