Class: Houcho::CI::UkigumoClient
- Inherits:
-
Object
- Object
- Houcho::CI::UkigumoClient
- Defined in:
- lib/houcho/ci.rb
Instance Method Summary collapse
-
#initialize(server, port = 80, url = "http://#{server}:#{port}") ⇒ UkigumoClient
constructor
A new instance of UkigumoClient.
- #post(elements) ⇒ Object
- #search(elements, limit = 1) ⇒ Object
Constructor Details
#initialize(server, port = 80, url = "http://#{server}:#{port}") ⇒ UkigumoClient
Returns a new instance of UkigumoClient.
12 13 14 15 16 |
# File 'lib/houcho/ci.rb', line 12 def initialize(server, port = 80, url = "http://#{server}:#{port}") @ukigumo_server = server @ukigumo_listen_port = port @ukigumo_base_url = url end |
Instance Method Details
#post(elements) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/houcho/ci.rb', line 32 def post(elements) response = Net::HTTP.post_form( URI.parse("#{@ukigumo_base_url}/api/v1/report/add"), { :status => elements[:status], :project => elements[:project], :branch => elements[:branch], :repo => elements[:repo], :revision => elements[:revision], :vc_log => elements[:vc_log], :body => elements[:body], } ) response.body end |
#search(elements, limit = 1) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/houcho/ci.rb', line 18 def search(elements, limit = 1) query_string = URI.encode_www_form({ :project => elements[:project].to_s, :branch => elements[:branch].to_s, :revision => elements[:revision].to_s, :limit => limit.to_s, }) Net::HTTP.start(@ukigumo_server, @ukigumo_listen_port) do |http| responce = http.get("/api/v1/report/search?#{query_string}") responce.body end end |