Sha256: 04da9bfe7f694d070362f6b37bf7898a14b6c64ece2aada5ae3b5b2f6d0435b6
Contents?: true
Size: 1015 Bytes
Versions: 3
Compression:
Stored size: 1015 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
relinkly-1.0.1 | lib/relinkly/link.rb |
relinkly-1.0.0 | lib/relinkly/link.rb |
relinkly-0.1.0 | lib/relinkly/link.rb |