Sha256: 293c9ddec425f0d851c05d10da3867561e0a5ebf2ef02810dd7c23df155c58a1
Contents?: true
Size: 979 Bytes
Versions: 4
Compression:
Stored size: 979 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
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
relinkly-1.1.3 | lib/relinkly/link.rb |
relinkly-1.1.2 | lib/relinkly/link.rb |
relinkly-1.1.1 | lib/relinkly/link.rb |
relinkly-1.1.0 | lib/relinkly/link.rb |