Giter Site home page Giter Site logo

Comments (6)

markwilliams970 avatar markwilliams970 commented on August 14, 2024

Just a heads up that there's a Rally tag forum on Stackoverflow - https://stackoverflow.com/questions/tagged/rally where Rally developers frequently answer toolkit usage questions similar to this one. It helps maintain focus on GitHub issues for identified bugs in the toolkit.

This Gist:

https://gist.github.com/markwilliams970/6a1380f4949c12a678a1

contains an example of saving attachment content that should help you, but the core of it is to Base64 decode the content string, and write the resulting bytes to a file:

require 'base64'

def save_attachment(this_attachment)
    file_name = this_attachment.Name
    this_attachment_content = this_attachment.Content

    if this_attachment_content == nil
        # Yes it is possible to have an attachment with no content
        extension = ".empty"
        file_data = File.new(file_name + extension, "wb")
    else
        this_attachment_content.read
        this_content = this_attachment_content.Content
        file_data = File.new(file_name, "wb")
        file_data.syswrite(Base64.decode64(this_content))
    end

    puts "    Saved filename=#{file_name} Size=#{this_attachment.Size}\n"
    file_data.close
end

from rallyresttoolkitforruby.

ssbarnea avatar ssbarnea commented on August 14, 2024

It seems that this can be decoded as a base64 but still, this is at least a bug in the documentation if not even in the API, that it does not provide the content in binary format.

from rallyresttoolkitforruby.

markwilliams970 avatar markwilliams970 commented on August 14, 2024

The API is working as expected. I'll check with the toolkit author to see about getting a similar example included in the examples directory in the Github repo.

from rallyresttoolkitforruby.

ssbarnea avatar ssbarnea commented on August 14, 2024

The AP is working, what I was trying to say is that is not documented. The simple fact that both of us had to google around (and use the debugger in my case) just to discover how to get the content of the attachment is clearly a "design bug".

Just to confirm this bug, I observed somebody else raising a ticket regarding making attachment API easier to use. See issue #26

from rallyresttoolkitforruby.

markwilliams970 avatar markwilliams970 commented on August 14, 2024

Thanks for the feedback. In general the API toolkit docs are meant to supplement, but not replace, the full webservices API docs, https://rally1.rallydev.com/slm/doc/webservice. The documentation for the AttachmentContent object: https://rally1.rallydev.com/slm/doc/webservice/objectModel.sp#AttachmentContent indicates how to traverse the object model to find the needed data, as well as its type (base64Binary).
2014-06-05_8-14-28

from rallyresttoolkitforruby.

markwilliams970 avatar markwilliams970 commented on August 14, 2024

Also for what it's worth - the ruby toolkit author would seem to agree with you that additional methods to help with getting attachments would be desirable enhancements. Issue #26 as you reference above was created by the toolkit author himself :)

from rallyresttoolkitforruby.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.