Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't upload messages with attachment. #26

Closed
harshjari opened this issue Nov 14, 2013 · 4 comments
Closed

Can't upload messages with attachment. #26

harshjari opened this issue Nov 14, 2013 · 4 comments

Comments

@harshjari
Copy link

I've been attempting to upload a message with a pending attachment but it doesnt work. I've followed the documentation exactly. I've also attached some sample code that i use, in case theres an error that i've missed.
Everything seems to be created successfully but attachments are mysteriously absent. Advice/help would be appreciated.

require 'yammer'

Yammer.configure do |c|
c.access_token = 'sometoken'
end

file = File.open('test.txt', 'r')
returnedobj = Yammer.create_pending_attachment(file).body

idobj = returnedobj[:id]
idobjarr = []
idobjarr << idobj

file = File.open('test2.txt', 'r')
returnedobj = Yammer.create_pending_attachment(file).body
idobj = returnedobj[:id]
idobjarr << idobj

optobj = {:group_id => xxxxxxx , :pending_attachment_ids => idobjarr}

tmpobj = Yammer.create_message('building a yammer client', optobj)

@mde
Copy link

mde commented Nov 15, 2013

You probably will have better luck if you post this question in the Yammer Developer's Network.

@harshjari
Copy link
Author

I will do so. Thanks for the suggestion.

@tiabas
Copy link
Contributor

tiabas commented Dec 5, 2013

Here's what will work:

require 'yammer'

Yammer.configure do |c|
c.access_token = 'sometoken'
end

file1 = File.open('test.txt', 'r')
pending_file1 = Yammer.create_pending_attachment(file).body[:id]

file2 = File.open('test2.txt', 'r')
pending_file2 = Yammer.create_pending_attachment(file).body[:id]

optobj = {:group_id => xxxxxxx , :pending_attachment1 => file1, :pending_attachment2 => file2 }

tmp_obj = Yammer.create_message('building a yammer client', optobj)

@tiabas tiabas closed this as completed Dec 5, 2013
@mrclmrvn
Copy link

Doesn't work.

Yammer.create_pending_attachment(file) succeeded, I parsed response.body, it received an ID, but Yammer.create_message('building a yammer client', optobj) got closed stream.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants