module TwitterAds::DSL::ClassMethods
Public Instance Methods
properties()
click to toggle source
Helper for managing properties for the current class.
@return [Hash] A Hash of properties declared in the current class.
@api private @since 0.1.0
# File lib/twitter-ads/resources/dsl.rb, line 108 def properties @properties ||= {} end
property(name, opts = {})
click to toggle source
Resource
property declaration helper.
@example
class Foo include TwitterAds::DSL property :foo property :bar, type: :bool property :created_at, type: time, read_only: true end
@param name [Symbol] The name of the property. @param opts [Hash] A Hash of extended options to be applied to the property (Optional).
@return [Symbol] The property name.
@since 0.1.0
# File lib/twitter-ads/resources/dsl.rb, line 96 def property(name, opts = {}) properties[name] = opts.fetch(:type, nil) opts[:read_only] ? attr_reader(name) : attr_accessor(name) name end