Class: Livedoor::API::FeedDiscover::Feed

Inherits:
Object
  • Object
show all
Defined in:
lib/livedoor/api/feed_discover/feed.rb

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ Feed

Returns a new instance of Feed.



6
7
8
9
# File 'lib/livedoor/api/feed_discover/feed.rb', line 6

def initialize(json)
  @json = json.dup
  @json.each_value{|e| e.freeze }
end

Instance Method Details

#avg_rateObject



39
40
41
# File 'lib/livedoor/api/feed_discover/feed.rb', line 39

def avg_rate
  @json["avg_rate"]
end

#descriptionObject



35
36
37
# File 'lib/livedoor/api/feed_discover/feed.rb', line 35

def description
  @json["description"]
end


19
20
21
# File 'lib/livedoor/api/feed_discover/feed.rb', line 19

def feedlink
  @json["feedlink"]
end

#iconObject



23
24
25
# File 'lib/livedoor/api/feed_discover/feed.rb', line 23

def icon
  @json["icon"]
end

#imageObject



27
28
29
# File 'lib/livedoor/api/feed_discover/feed.rb', line 27

def image
  @json["image"]
end


15
16
17
# File 'lib/livedoor/api/feed_discover/feed.rb', line 15

def link
  @json["link"]
end

#modified_onObject



47
48
49
50
# File 'lib/livedoor/api/feed_discover/feed.rb', line 47

def modified_on
  v = @json["modified_on"]
  Time.at(v) if v and Integer === v
end

#official?Boolean

Returns:

  • (Boolean)


52
53
54
55
56
57
58
59
# File 'lib/livedoor/api/feed_discover/feed.rb', line 52

def official?
  v = @json["official"]
  if v and Integer === v and v == 1
    true
  else
    false
  end
end

#sourceObject



11
12
13
# File 'lib/livedoor/api/feed_discover/feed.rb', line 11

def source
  @json["source"]
end

#subscribers_countObject



43
44
45
# File 'lib/livedoor/api/feed_discover/feed.rb', line 43

def subscribers_count
  @json["subscribers_count"]
end

#thirdparty?Boolean

Returns:

  • (Boolean)


61
62
63
# File 'lib/livedoor/api/feed_discover/feed.rb', line 61

def thirdparty?
  not official? and URI(link).host != URI(feedlink).host
end

#titleObject



31
32
33
# File 'lib/livedoor/api/feed_discover/feed.rb', line 31

def title
  @json["title"]
end