Class: ACTV::Article

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

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

Instance Method Summary collapse

Methods inherited from Asset

#activenet?, #attribute_paths, #attributes, #awcamps30?, #awcamps?, #awendurance?, #awsports?, #channels, #components, #description, #description_by_type, #descriptions, #endurance_id, #evergreen?, #first_topic, #first_topic_name, #first_topic_path, #has_location?, #image_by_name, #image_path, #image_with_placeholder, #images, #is_article?, #is_event?, #kids?, #legacy_data, #location_path, #media_url, #meta_interest_paths, #meta_interests, #org_timezone, #place, #place_timezone, #prices, #recurrences, #regcenter2?, #regcenter?, #registration_status, #seo_url, #seo_urls, #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, #thriva?, #topics, #version, #visible?

Methods inherited from Identity

#==, #id, #initialize

Methods inherited from Base

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

Constructor Details

This class inherits a constructor from ACTV::Identity

Dynamic Method Handling

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

Instance Method Details

#author_bioObject



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

def author_bio
  @author_bio ||= begin
    bio_node = get_from_author_footer('div.author-text')
    bio_node.inner_html unless bio_node.nil?
  end
end


7
8
9
# File 'lib/actv/article.rb', line 7

def author_footer
  @author_footer ||= description_by_type 'authorFooter'
end


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

def author_name_from_footer
  @author_name_from_footer ||= begin
    name_node = get_from_author_footer('span.author-name')
    name_node.text unless name_node.nil?
  end
end

#author_photoObject



22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/actv/article.rb', line 22

def author_photo
  @author_photo ||= begin
    image = nil

    image_node = get_from_author_footer('div.signature-block-photo img')
    if !image_node.nil?
      image = ACTV::AssetImage.new({imageUrlAdr: image_node.attribute('src').text}) if image_node.attribute 'src'
    end

    image
  end
end

#by_lineObject



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

def 
  @author ||= description_by_type 'articleByLine'
end


62
63
64
# File 'lib/actv/article.rb', line 62

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

#imageObject



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

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

#inline_adObject Also known as: inline_ad?



66
67
68
69
70
71
72
73
74
75
# File 'lib/actv/article.rb', line 66

def inline_ad
  @inline_ad ||= begin
    val = tag_by_description 'inlinead'
    if val
      val.downcase == 'true'
    else
      true
    end
  end
end

#media_gallery?Boolean

Returns:

  • (Boolean)


50
51
52
# File 'lib/actv/article.rb', line 50

def media_gallery?
  self.type and self.type.downcase == "mediagallery"
end

#sourceObject



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

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

#subtitleObject



58
59
60
# File 'lib/actv/article.rb', line 58

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

#typeObject



46
47
48
# File 'lib/actv/article.rb', line 46

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