iceScrum | Using Icescrum with Dashing – iceScrum

iceScrum Forums Discutez d'iceScrum

4 sujets de 1 à 4 (sur un total de 4)

  • Auteur
    Messages
  • #17998

    FlashDash
    Participant

    hi i’m quite new to this so i need some help on figuring out how to go about this.

    I am trying to create a widget on Dashing that will extract data from Icescrum and update a specific widget.

    The thing is i found info on how to program jira so i’ve been trying to mess around with it to make it work with icescrum but with no luck.

    some help would be appreciated

    i tried this one

    require 'uri'
    
    SCHEDULER.every '2s', :first_in => 0 do |job|
     uri = URI.parse(mycompany.ca)
     http = Net::HTTP.new(uri.host, uri.port)
     req = Net::HTTP::GET.new ("http://mycompany:8080/icescrum/ws/p/EP/sprint/198")
     req.basic_auth username, password
     response = http.request(req)
     issuesinProgress = JSON.parse(response.body)["total"]  
     send_event('synergy', value: issuesinProgress)
    end

    and this is the error:

    scheduler caught exception:
    undefined local variable or method `
    mycompany’ for main:Object
    /home/administrator/dashboard/jobs/sample.rb:21:in `
    block in <top (required)>’
    /var/lib/gems/1.9.1/gems/rufus-scheduler-2.0.24/lib/rufus/sc/jobs.rb:230:in`call’
    /var/lib/gems/1.9.1/gems/rufus-scheduler-2.0.24/lib/rufus/sc/jobs.rb:230:in`trigger_block’
    /var/lib/gems/1.9.1/gems/rufus-scheduler-2.0.24/lib/rufus/sc/jobs.rb:204:in`block in trigger’
    /var/lib/gems/1.9.1/gems/rufus-scheduler-2.0.24/lib/rufus/sc/scheduler.rb:430:in`call’
    /var/lib/gems/1.9.1/gems/rufus-scheduler-2.0.24/lib/rufus/sc/scheduler.rb:430:in`block in trigger_job’
    ================================================================================

    #18044

    Nicolas Noullet
    Maître des clés

    Hi,

    I have edited your message to hide the URL of your server.

    The problem comes from
    uri = URI.parse(mycompany.ca)

    Here mycompany.ca is not surrounded by quotes so it is taken as an identifier and there is nothing named « mycompany » in the scope of your program.

    You should probably write something like (including the port, replace « mycompany » by the proper domain)
    uri = URI.parse("mycompany.ca:8080")

    Also, you should define the variable username and password with the credentials of a user who have access to the sprint.

    Finally, there is no « total » entry in the response body. I recommend that you first try to query the iceScrum API manually: https://www.icescrum.com/documentation/sprint-api/#sprint-api_3, e.g. with cURL, and inspect the response data to know what information you should look for in your ruby program.

    #18064

    FlashDash
    Participant

    thank you. Since then I have had no luck with modifying the above code to make it work so instead I decided to use cURL to get the data. It’s simpler and works like a charm.

    %x{curl -v -H « Content-Type: application/xml » -X POST –data « @filename.xml » -u username:password http://website.ca:8080/icescrum/}

    • Cette réponse a été modifiée le il y a 6 années et 4 mois par Vincent Barrier.
    #18073

    Nicolas Noullet
    Maître des clés

    Glad to know that you managed to find a solution 🙂

4 sujets de 1 à 4 (sur un total de 4)

Le forum ‘Questions and help’ est fermé à de nouveaux sujets et réponses.