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

Add api versions for url prefix control #548

Merged
merged 5 commits into from
Apr 1, 2019

Conversation

alexaitken
Copy link
Contributor

Add api version to control the url prefix of both the graphql schema and rest resources.

Coercion support from strings and symbols of all the defined api versions.

The version has been added to the ShopifyAPI::Base as a thread safe attribute when that is available.
It is also added to the session and defaulted to no_version to match current behaviour.

Session usage looks like:
ShopifyAPI::Session.new("https://this-is-my-test-shop.myshopify.com", "test_token", :no_version)
ShopifyAPI::Session.new("https://this-is-my-test-shop.myshopify.com", "test_token", 'unstable')

@alexaitken alexaitken requested a review from a team as a code owner March 29, 2019 15:07
Copy link
Contributor

@chrisbutcher chrisbutcher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking great. A few comments so far.

@@ -65,8 +66,9 @@ def encoded_params_for_signature(params)
end
end

def initialize(url, token = nil, extra = {})
def initialize(url, token = nil, api_version = :no_version, extra = {})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could api_version be a kwarg? Same q for temp.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

compatibility is my biggest concern with that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But couldn't a kwarg just have a default, too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you provide the full signature you are picturing?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(See Slack)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Converged on "maybe it is better to just go to keyword args", i.e. def initialize(url:, token:, api_version:, ...)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method signature will change in the next PR, in which api_version becomes required.

lib/shopify_api/api_version.rb Outdated Show resolved Hide resolved
lib/shopify_api/resources/base.rb Show resolved Hide resolved
@alexaitken alexaitken force-pushed the add-api-versions-for-url-prefix-control branch 3 times, most recently from eeddd7a to 730eae1 Compare March 29, 2019 16:25
@alexaitken alexaitken force-pushed the add-api-versions-for-url-prefix-control branch from 730eae1 to 98cd7ba Compare April 1, 2019 18:33
@alexaitken alexaitken force-pushed the add-api-versions-for-url-prefix-control branch from 98cd7ba to 333787d Compare April 1, 2019 18:44
@alexaitken alexaitken force-pushed the add-api-versions-for-url-prefix-control branch from 333787d to 1887de8 Compare April 1, 2019 19:03
@alexaitken alexaitken merged commit 04764c4 into master Apr 1, 2019
@alexaitken alexaitken deleted the add-api-versions-for-url-prefix-control branch April 1, 2019 20:24
@alexaitken alexaitken temporarily deployed to rubygems April 9, 2019 15:29 Inactive
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

Successfully merging this pull request may close these issues.

3 participants