class GetLeankitCards
Public Class Methods
api()
click to toggle source
# File lib/get_leankit_cards.rb, line 29 def api begin LeankitConnect.api end end
errors(response, status)
click to toggle source
# File lib/get_leankit_cards.rb, line 10 def errors(response, status) warn "Leankit connection failed response:#{response}, status:#{status}" # rescue LoadError => e # puts " this is EXPECTION #{e}" # raise response "failed response:#{response}, status:#{status}" end
get(id)
click to toggle source
# File lib/get_leankit_cards.rb, line 4 def get(id) response, status = get_json(id) status == 200 ? response : errors(response, status) [response, status] end
get_json(id)
click to toggle source
# File lib/get_leankit_cards.rb, line 18 def get_json(id) url = "#{Settings.cardurl}#{id}" uri = URI(url) response = api.get(uri) # [JSON.parse(response.body), response.status] # TODO convert to logs # puts "STATUS==#{response.status}" # puts "BODY==#{response.body}" [response.body, response.status] end