Class: LiferayContent::Article

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

Class Method Summary collapse

Class Method Details

.get(article_id) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/liferay_content/article.rb', line 9

def self.get(article_id)

  @params = {
    "serviceClassName"      => "com.liferay.portlet.journal.service.JournalArticleServiceUtil", 
    "serviceMethodName"     => "getArticle", 
    "serviceParameters"     => "[groupId,articleId]",
    "groupId"               => LiferayContent.group_id,
    "articleId"             => article_id
  }

  req = Net::HTTP::Post.new(LiferayContent.uri, initheader = {'Content-Type' =>'application/json'})
  req.basic_auth LiferayContent., LiferayContent.password
  req.set_form_data @params

  response = Net::HTTP.new(LiferayContent.host, LiferayContent.port).start {|http| http.request(req) }

  result = JSON.parse response.body

  doc = Hpricot.XML(result["content"])
  result = (doc/"static-content").first.inner_text

  return result
end

.get2(s) ⇒ Object



5
6
7
# File 'lib/liferay_content/article.rb', line 5

def self.get2(s)
  "titi"
end