Shopify/shopify_api — pull request #125 by travishaynes (2014-04-23 08:52:25+00:00)
Title: Refactored session code

The session code was getting rather unwieldy so I refactored it into smaller chunks of more manageable code.

I fixed a small concern with Session#setup. It was using `send` instead of `public_send`. Using `send` in a public method could potentially allow private methods to be called without raising an exception.

Session#validate_signature now checks the timestamp. Previously it was ignoring it. #request_token was raising a ValidationException even when #validate_signature returned true.

The Session#temp method I originally introduced has since become rather large and confusing, so I broke it up into smaller, easier to understand methods and moved it into its own file, `session/temp.rb`.

I also moved all the OAuth specific code into `session/oauth.rb` for easier management.

Instead of using strings to build URIs, URI::HTTP or URI::HTTPS are now used whenever possible.

I removed Session#parameterize in favor of ActiveSupport's #to_query extension. No reason to duplicate a helper method that already exists in one of the library's dependencies.

I moved some Hashes and Arrays into their own private methods to simplify some confusing methods.