Class: UtopianRuby::UtopianRubyHelper

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

Class Method Summary collapse

Class Method Details

.get_post_repository(author, permlink) ⇒ Object

get post github repository



38
39
40
41
# File 'lib/utopian_ruby_helper.rb', line 38

def self.get_post_repository(author,permlink)
  p = UtopianRuby::UtopianRubyAPI.get_post(author,permlink)
  p["json_metadata"]["repository"]["html_url"]
end

.get_posts_by_type(type, params) ⇒ Object

get posts by type



6
7
8
9
10
11
12
# File 'lib/utopian_ruby_helper.rb', line 6

def self.get_posts_by_type(type,params)
  if params.nil?
     params = {"limit":1}
  end
  params["type"]=type
  UtopianRuby::UtopianRubyAPI.get_posts(params)
end

.get_posts_obj_by_moderator(moderator, params) ⇒ Object

get posts by moderator



24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/utopian_ruby_helper.rb', line 24

def self.get_posts_obj_by_moderator(moderator,params)
  if params.nil?
     params = {"limit":1}
  end
  posts = Set.new
  UtopianRuby::UtopianRubyAPI.get_posts(params)["results"].each do |p|
    if p["moderator"]==moderator
      posts << UtopianRuby::UtopianRubyAPI.j_to_p(p)
    end
  end
  posts
end

.get_posts_obj_by_type(type, params) ⇒ Object

get posts object by type



15
16
17
18
19
20
21
# File 'lib/utopian_ruby_helper.rb', line 15

def self.get_posts_obj_by_type(type,params)
  if params.nil?
     params = {"limit":1}
  end
  params["type"]=type
  UtopianRuby::UtopianRubyAPI.get_posts_obj(params)
end