Sha256: 92ed4f56b1416f2964e73e8e392cb28da4e5d85206dc8ef44f99c80c1cb06b48
Contents?: true
Size: 997 Bytes
Versions: 1
Compression:
Stored size: 997 Bytes
Contents
# frozen_string_literal: true module Relinkly class Link < Element attr_accessor :id, :link_id, :title, :slashtag, :destination, :created_at, :updated_at, :status, :tags, :scripts, :forward_parameters, :clicks, :last_click_date, :last_click_at, :is_public, :short_url, :domain_id, :domain_name, :https, :favourite # Associations %i[domain creator integration].each do |association| # Creates the getter methods, such as "@instance.domain" attr_reader association # Creates the setter methods, such as "@instance.domain = ..." define_method("#{association}=") do |attrs| attrs ||= {} # Retrieve the class klass = Relinkly.const_get(association.to_s.relinkly_camelize) # Ex: # @domain = Domain.new(attrs) instance_variable_set("@#{association}", klass.new(attrs)) end end alias favorite favourite alias favorite= favourite= end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
relinkly-1.0.2 | lib/relinkly/link.rb |