Class: ACTV::Article

Inherits:
Asset show all
Includes:
Authorable
Defined in:
lib/actv/article.rb

Constant Summary

Constants included from AssetSourceSystem

ACTV::AssetSourceSystem::SOURCE_SYSTEM_HASH

Instance Attribute Summary

Attributes inherited from Asset

#activityEndDate, #activityEndTime, #activityStartDate, #activityStartTime, #assetDsc, #assetGuid, #assetName, #authorName, #contactEmailAdr, #contactName, #contactPhone, #contactTxt, #createdDate, #currencyCd, #homePageUrlAdr, #isRecurring, #is_article, #is_event, #modifiedDate, #publishDate, #regReqGenderCd, #regReqMaxAge, #regReqMinAge, #showContact

Attributes inherited from Base

#attrs

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Authorable

#author, #author_name_from_by_line, #by_line

Methods inherited from Asset

#attribute_paths, #attributes, #category_is?, #channels, #components, #description, #description_by_type, #descriptions, #endurance_id, #evergreen?, #first_topic, #first_topic_name, #first_topic_path, from_response, #has_location?, #has_volume_based_price?, #image_by_name, #image_path, #image_with_placeholder, #images, inherited, #initialize, #is_event?, #is_video?, #kids?, #legacy_data, #location_path, #media_url, #meta_interest_paths, #meta_interests, #org_timezone, #organization, #place, #place_timezone, #prices, #recurrences, #references, #registration_status, #seo_url, #seo_urls, #sponsored?, #status, #sub_2_topic, #sub_2_topic_path, #sub_3_topic, #sub_3_topic_path, #sub_4_topic, #sub_4_topic_path, #sub_topic, #sub_topic_path, #summary, #tag_by_description, #tags, #topics, types, #version, #visible?

Methods included from AssetSourceSystem

#kids_friendly_source_system?

Methods inherited from Identity

#==, #id, #initialize

Methods inherited from Base

#[], attr_reader, define_attribute_method, define_predicate_method, define_uri_method, #delete, from_response, #initialize, #memoize, #method_missing, object_attr_reader, #respond_to?, #to_hash, #update, uri_attr_reader

Constructor Details

This class inherits a constructor from ACTV::Asset

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ACTV::Base

Class Method Details

.valid?(response) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/actv/article.rb', line 11

def self.valid? response
  ACTV::ArticleValidator.new(response).valid?
end

Instance Method Details



39
40
41
# File 'lib/actv/article.rb', line 39

def footer
  @footer ||= description_by_type 'footer'
end

#imageObject



27
28
29
# File 'lib/actv/article.rb', line 27

def image
  @image ||= image_by_name 'image2'
end

#inline_adObject Also known as: inline_ad?



43
44
45
# File 'lib/actv/article.rb', line 43

def inline_ad
  @inline_ad ||= resolve_inline_ad_tag
end

#is_article?Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/actv/article.rb', line 48

def is_article?
  true
end

#media_gallery?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/actv/article.rb', line 23

def media_gallery?
  type && type.downcase == "mediagallery"
end

#reference_articlesObject



52
53
54
55
56
57
# File 'lib/actv/article.rb', line 52

def reference_articles
  article_references = references.select { |ref| ref.type.downcase == 'reference-article' }
  if article_references.present?
    @reference_articles ||= ACTV.asset(article_references.map(&:id))
  end
end

#sourceObject



15
16
17
# File 'lib/actv/article.rb', line 15

def source
  @source ||= description_by_type 'articleSource'
end

#subtitleObject



35
36
37
# File 'lib/actv/article.rb', line 35

def subtitle
  @subtitle ||= description_by_type 'subtitle'
end

#thumbnailObject



31
32
33
# File 'lib/actv/article.rb', line 31

def thumbnail
  @thumbnail ||= image_by_name 'small'
end

#typeObject



19
20
21
# File 'lib/actv/article.rb', line 19

def type
  @type ||= tag_by_description 'articleType'
end