Class: RedHatSupportLib::Brokers::Article

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

Instance Attribute Summary

Attributes inherited from Broker

#connection

Instance Method Summary collapse

Methods inherited from Broker

#get_id

Constructor Details

#initialize(connection) ⇒ Article

Returns a new instance of Article.



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

def initialize(connection)
  super
end

Instance Method Details

#get_article(id) ⇒ Object



16
17
18
19
20
# File 'lib/brokers/article.rb', line 16

def get_article(id)
  #TODO encode input and error handling
  result = @connection.get("/rs/articles/#{id}", {:accept => :json})
  #result.parsed_response
end

#search(text, limit = 10) ⇒ Object



9
10
11
12
13
14
# File 'lib/brokers/article.rb', line 9

def search(text, limit=10)
  #TODO encode input and error handling
  text = URI::encode(text)
  result = @connection.get("/rs/articles?keyword=#{text}&limit=#{limit}", {:accept => :json})
  result['article']
end