birarda / logan

ruby gem to communicate with new Basecamp API
MIT License
16 stars 19 forks source link

Ruby 1.9.3 dependency #3

Closed tybenz closed 10 years ago

tybenz commented 10 years ago

I was trying to use logan from within an Alfred workflow and ran into a problem. Turns out, httparty requires Ruby 1.9.3. Alfred workflows use system Ruby (which is 1.8.7 for Macs running Mountain Lion or earlier).

Wondering if there's another network gem you'd recommend if I wanted to fork and create a 1.8.7-compatible version of logan.

birarda commented 10 years ago

Hmm - not off the top of my head although I'm sure there's one out there.

Are you opposed to upgrading your system ruby?

tybenz commented 10 years ago

It's not me per-se. I'm trying to write an Alfred workflow that I could share with others. Since not every Alfred user to ruby-savvy, I'd hate to require them to install rvm or rbenv just to use the workflow.

birarda commented 10 years ago

Ahh, gotcha. Is there an older version of httpparty that might only require 1.8.7? I believe I'm only using its base functionality.

On Fri, Jan 31, 2014 at 12:50 PM, Tyler Benziger notifications@github.com wrote:

It's not me per-se. I'm trying to write an Alfred workflow that I could share with others. Since not every Alfred user to ruby-savvy, I'd hate to require them to install rvm or rbenv just to use the workflow.

Reply to this email directly or view it on GitHub: https://github.com/birarda/logan/issues/3#issuecomment-33841109

tybenz commented 10 years ago

You're right. httparty's previous version 0.11.0 is compatible with ruby 1.8.7.

One major difference between 1.8.7 and 1.9.3 is the ability to have json-style key/value pairs.

Example

h = { :foo => "bar" }
# versus
h = { foo: "bar" }

As long as logan doesn't use this new style of hashing, it's pretty close to being ruby 1.8.7 compatible.

Only snag I've hit so far on my fork is you use each_with_object (not defined in ruby 1.8.7)

If you switch the symbolize keys step to look more like:

new_auth_hash = {}
auth_hash.each do |k, v|
  new_auth_hash[k.to_sym] = v
end
auth_hash = new_auth_hash

You may be able to get logan to be 1.8.7 compatible. Would you accept a PR with these changes if I submitted one?

birarda commented 10 years ago

Yeah - that'd be great!