class Mingle::API
Public Class Methods
new(http_client)
click to toggle source
# File lib/mingle/api.rb, line 11 def initialize(http_client) @http_client = http_client end
Public Instance Methods
execute_mql(mql)
click to toggle source
# File lib/mingle/api.rb, line 27 def execute_mql(mql) response = @http_client.get('/cards/execute_mql.xml', mql: mql) logger.debug(response.body) Nokogiri::XML.parse(response.body).search('result').inject([]) do |results, result| result_hash = result.children.inject({}) do |hash, child| unless Nokogiri::XML::Text === child hash[child.name] = child.text end hash end results << result_hash end end
get_attachments_on(card_number)
click to toggle source
# File lib/mingle/api.rb, line 19 def get_attachments_on(card_number) @http_client.get("/cards/#{card_number}/attachments.xml").body end
get_card(number)
click to toggle source
# File lib/mingle/api.rb, line 15 def get_card(number) @http_client.get("/cards/#{number}.xml").body end
save_card(card)
click to toggle source
# File lib/mingle/api.rb, line 23 def save_card(card) @http_client.put("/cards/#{card.number}.xml", body: card.to_xml, 'Content-Type' => 'text/xml') end