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, = {'Content-Type' =>'application/json'})
req.basic_auth LiferayContent.login, 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
|