Code Monkey home page Code Monkey logo

yam's People

Contributors

hundredwatt avatar jessieay avatar nickcampbell18 avatar ricn avatar tiabas avatar yarki avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

yam's Issues

Yammer::ApiResponse does not report all successes as successful

Yammer::ApiResponse#success? is not consistent when reporting on the success of the request. Consider the following:

client = Yammer::Client.new(access_token: access_token) # => #<Yammer::Client:0x007f968faecd10 ...>
current_user = client.current_user # => #<Yammer::ApiResponse:0x007f968fc371e8 @body="...", @code=200, ...>
current_user.class # => Yammer::ApiResponse
current_user.code # => 200
current_user.success? # => true
activity_response = client.create_activity(activity) # => #<Yammer::ApiResponse:0x007f968ff41460 @body="...", @code=202, ...>
activity_response.class # => Yammer::ApiResponse
activity_response.code # => 202
activity_response.success? # => false

I would expect that any response in the 2xx range would report success? as true

Yammer no longer raise Unauthorized, instead returns string "Authenticated Failure"

Its our understanding the yam gem should raise an Unauthorized exception when a request is made that is, um, unauthorized.

However, we've noticed recently that unauthorized requests are just return the string "Authenticated Failure" which is wrong because a) its not valid json b) it should be raising an exception.

Looking through the codebase, it looks like the only reference to Unauthorized is in error.rb#from_status method which I don't see being called from anywhere.

What is the proper way to handle unauthorized requests?

Better handling for 404 responses needed

Currently if I do something like this for a thread that has been deleted from Yammer

deleted_thread_id = 12345
yamr = Yammer::Client.new(:access_token  => '123abc')
resp = yamr.get_thread(deleted_thread_id)

resp will be " " (String with a single space). I understand that you don't wan't to handle every kind of exception that can happen, but I think at least 404 should be handled better than that.

Jruby support

Jruby won't install via ruby gems because of the specified oj dependency in the gemspec.(oj no longer supports jruby)
since we're using multi_json, why the hard dependency?

v2.0.2 introduces incompatibility with omniauth-oauth2 strategy

In this revision: db251f5#diff-011a232c794000b1bbf23ed773c9d5c0 a dependency on oauth2-client is added.

This causes this line to fail due to use of the older OAuth2::Client api: https://github.com/intridea/omniauth-oauth2/blob/master/lib/omniauth/strategies/oauth2.rb#L49

The new code for OAuth2::Client should go from/to:

# old code
redirect client.auth_code.authorize_url({:redirect_uri => callback_url}.merge(authorize_params))
# new code
redirect client.authorization_code.authorization_url({:redirect_uri => callback_url}.merge(authorize_params))

The yam gem is dependent on too new of a version of the OAuth2::Client code.

As well, adding gem dependencies doesn't seem like a patch level change, so this breaks semantic versioning. When I lock the version directly to 2.0.1(not ~> 2.0), I avoid this issue.

Test Yam against ruby 2.0.0

We're using Ruby 2.0.0 in sched.do. We should test the Yam gem against Ruby 2.0.0 as well. (update .travis.yml)

Can't upload messages with attachment.

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)

The gem dependency versions are a little old.

The gem dependencies are conflicting with my own app, specifically multi_json and faraday.

Could you please push the gem dependency versions to as up to date as possible so they can merge with mine, :)?

Allow multiple Yammer accounts at same time

By the documentation, it appears only one Yammer account can be used at a time:

Yam.configure do |config|
  config.oauth_token = oauth_token
end

Is it possible, or would it be possible to add, the ability to use multiple Yammer accounts at a time? Something more like this:

yam1 = Yam.new oauth_token: oauth_token1
yam2 = Yam.new oauth_token: oauth_token2

Thanks! Matt

Unable to Fetch access token when tried using another account

I have generated an Yammer API key(client id and client secret) within a network and the API key is working across this network (same account). But when I try to use the same API key to access data from a different account it shows an error.

'Your network is not allowed to request an OAuth token for this Application'

Anyway to resolve this?

Add Gemspec

Currently post-install, the gem gives an invalid gemspec warning.

Should be replaced with a fun message.

configure() Results in NoMethodError

Running the following:

require 'yam'

Yam.configure do |config|
  config.oauth_token = your_oauth_token
end

Results in:
in <main>': undefined methodconfigure' for Yam:Module (NoMethodError)

And indeed I couldn't find a configure method?

OpenSSL issue

Sending Yammer notification...
ERROR: An error occurred while sending the Yammer notification.
uninitialized constant OpenSSL::SSL
org/jruby/RubyModule.java:2677:in const_missing' /var/jenkins_home/plugins/yammer/WEB-INF/classes/vendor/gems/gems/faraday-0.8.7/lib/faraday/adapter/net_http.rb:26:in NetHttp'
/var/jenkins_home/plugins/yammer/WEB-INF/classes/vendor/gems/gems/faraday-0.8.7/lib/faraday/adapter/net_http.rb:11:in Adapter' /var/jenkins_home/plugins/yammer/WEB-INF/classes/vendor/gems/gems/faraday-0.8.7/lib/faraday/adapter/net_http.rb:10:in Faraday'
/var/jenkins_home/plugins/yammer/WEB-INF/classes/vendor/gems/gems/faraday-0.8.7/lib/faraday/adapter/net_http.rb:9:in (root)' org/jruby/RubyModule.java:2592:in const_get'
/var/jenkins_home/plugins/yammer/WEB-INF/classes/vendor/gems/gems/faraday-0.8.7/lib/faraday.rb:1:in (root)' /var/jenkins_home/plugins/yammer/WEB-INF/classes/vendor/gems/gems/faraday-0.8.7/lib/faraday.rb:67:in lookup_middleware'
/var/jenkins_home/plugins/yammer/WEB-INF/classes/vendor/gems/gems/faraday-0.8.7/lib/faraday/builder.rb:146:in use_symbol' org/jruby/RubyBasicObject.java:1683:in send'
/var/jenkins_home/plugins/yammer/WEB-INF/classes/vendor/gems/gems/faraday-0.8.7/lib/faraday/builder.rb:108:in adapter' /var/jenkins_home/plugins/yammer/WEB-INF/classes/vendor/gems/gems/yam-0.0.6/lib/yam/connection.rb:53:in connection'
/var/jenkins_home/plugins/yammer/WEB-INF/classes/vendor/gems/gems/faraday-0.8.7/lib/faraday/connection.rb:59:in initialize' /var/jenkins_home/plugins/yammer/WEB-INF/classes/vendor/gems/gems/faraday-0.8.7/lib/faraday.rb:11:in new'
/var/jenkins_home/plugins/yammer/WEB-INF/classes/vendor/gems/gems/yam-0.0.6/lib/yam/connection.rb:47:in connection' /var/jenkins_home/plugins/yammer/WEB-INF/classes/vendor/gems/gems/yam-0.0.6/lib/yam/request.rb:30:in request'
/var/jenkins_home/plugins/yammer/WEB-INF/classes/vendor/gems/gems/yam-0.0.6/lib/yam/request.rb:22:in get' /var/jenkins_home/plugins/yammer/WEB-INF/classes/vendor/gems/gems/yamwow-0.1.6/lib/yamwow/client.rb:38:in get'
/var/jenkins_home/plugins/yammer/WEB-INF/classes/vendor/gems/gems/yamwow-0.1.6/lib/yamwow/throttle.rb:13:in when_ready' /var/jenkins_home/plugins/yammer/WEB-INF/classes/vendor/gems/gems/yamwow-0.1.6/lib/yamwow/client.rb:36:in get'
/var/jenkins_home/plugins/yammer/WEB-INF/classes/vendor/gems/gems/yamwow-0.1.6/lib/yamwow/client.rb:17:in get_autocomplete' /var/jenkins_home/plugins/yammer/WEB-INF/classes/vendor/gems/gems/yamwow-0.1.6/lib/yamwow/requests/groups/group_with_name_request.rb:22:in groups_with_prefix'
/var/jenkins_home/plugins/yammer/WEB-INF/classes/vendor/gems/gems/yamwow-0.1.6/lib/yamwow/requests/groups/group_with_name_request.rb:18:in group_with_name' /var/jenkins_home/plugins/yammer/WEB-INF/classes/vendor/gems/gems/yamwow-0.1.6/lib/yamwow/requests/groups/group_with_name_request.rb:12:in send'
/var/jenkins_home/plugins/yammer/WEB-INF/classes/vendor/gems/gems/yamwow-0.1.6/lib/yamwow/facade.rb:32:in group_with_name' /var/jenkins_home/plugins/yammer/WEB-INF/classes/models/yammer_notification_sender.rb:35:in group_id'
/var/jenkins_home/plugins/yammer/WEB-INF/classes/models/yammer_notification_sender.rb:18:in send_notification' /var/jenkins_home/plugins/yammer/WEB-INF/classes/models/yammer_notification_performer.rb:20:in perform'
/var/jenkins_home/plugins/yammer/WEB-INF/classes/models/yammer_notification.rb:19:in perform' /var/jenkins_home/plugins/yammer/WEB-INF/classes/vendor/gems/gems/jenkins-plugin-runtime-0.2.3/lib/jenkins/tasks/build_step_proxy.rb:14:in perform'
/var/jenkins_home/plugins/yammer/WEB-INF/classes/vendor/gems/gems/jenkins-plugin-runtime-0.2.3/lib/jenkins/tasks/build_step_proxy.rb:22:in `boolean_result'

KeyError (key not found: :ciphers)

The gem was working fine initially but I had to clear a gemlock file. I ran bundle install and afterwards this error is popping for all methods.
My code :
image

server log:
image

Can't get access token

Hi. I've follows the steps in readme.md a number of times previously, and was able to get an access token. Today, I tried it for both an existing app, and a freshly created app, and upon executing step 1, the browser returns the following error:

The redirect uri provided is either invalid or does not match our records

Please change developer guide documentation link to reflect the new location.

Hi,

I am working on a Ruby SDK section for the yammer developer site that will link out to this repository. Had a recommendation and a question:

  1. Can we please change
    Set up Yammer OAuth 2.0
    See Yammer's Developer Guide for step-by-step instructions on setting up OAuth 2.0: http://developer.yammer.com/files/2012/10/PlatformDeveloperGuide.pdf

to
Setup Yammer Authentication
Setup Yammer OAuth authentication in your app as laid out in “Build your first Yammer App” https://developer.yammer.com/introduction/

  1. Is there a way to programmatically set the Oauth token ? Since most developer code will implement OAuth, grab the the token and want to set it in the yammer.rb, it will be useful to provide that along with sample documentation.

Thanks
Sidd
(Yammer, Inc)

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.