Class: GRuby::Reader

Inherits:
Object
  • Object
show all
Defined in:
lib/g_ruby/reader.rb

Class Method Summary collapse

Class Method Details

.subscriptions(at) ⇒ Object

GRuby::Reader.subscriptions(at)



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/g_ruby/reader.rb', line 6

def self.subscriptions(at)
  url = "https://www.google.com/reader/api/0/subscription/list?output=json&access_token=#{at}"
  a = GRuby::Util.get_json(Nestful.get(url))
  response_obj = []
  if !a.blank?
    if !a["subscriptions"].blank?
      if !a["subscriptions"].first.blank?
        a["subscriptions"].each do |s|
          tags = []
          if !s["categories"].blank?
            if !s["categories"].first.blank?
              s["categories"].each do |t|
                tags << t["label"]
              end
            end
          end
          response_obj << [s["id"], s["title"], s["htmlUrl"], s["categories"], s["sortid"], tags]
        end
      end
    end
  end
  return response_obj
end

.tags(at) ⇒ Object

GRuby::Reader.tags(at)



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/g_ruby/reader.rb', line 31

def self.tags(at)
  url = "https://www.google.com/reader/api/0/tag/list?output=json&access_token=#{at}"
  a = GRuby::Util.get_json(Nestful.get(url))
  response_obj = []
  if !a.blank?
    if !a["tags"].blank?
      if !a["tags"].first.blank?
        a["tags"].each do |t|
          g = t["id"].split("/")
          g = g[g.count-1]        
          response_obj << [g, t["sortid"]]
        end
      end
    end
  end
  return response_obj
end