在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):Shopify/shopify-api-ruby开源软件地址(OpenSource Url):https://github.com/Shopify/shopify-api-ruby开源编程语言(OpenSource Language):Ruby 100.0%开源软件介绍(OpenSource Introduction):Shopify API Library for RubyThis library provides support for Ruby Shopify apps to access the Shopify Admin API, by making it easier to perform the following actions:
In addition to the Admin API, this library also allows querying the Storefront API. You can use this library in any application that has a Ruby backend, since it doesn't rely on any specific framework — you can include it alongside your preferred stack and use the features that you need to build your app. Note: These instructions apply to v10 or later of this package. If you're running v9 in your app, you can find the documentation in this branch. RequirementsTo follow these usage guides, you will need to:
InstallationAdd the following to your Gemfile: gem "shopify_api" or use bundler: bundle add shopify_api Steps to use the GemSetup Shopify ContextStart by initializing the ShopifyAPI::Context.setup(
api_key: "<api-key>",
api_secret_key: "<api-secret-key>",
host_name: "<application-host-name>",
scope: "read_orders,read_products,etc",
session_storage: ShopifyAPI::Auth::FileSessionStorage.new, # See more details below
is_embedded: true, # Set to true if you are building an embedded app
is_private: false, # Set to true if you are building a private app
api_version: "2022-01" # The version of the API you would like to use
) Setup a Session StoreIn order for the Shopify API gem to properly store sessions it needs an implementation of Session information would is typically stored in cookies on the browser. However, due to restrictions with modern browsers we highly discourage using cookies for embedded apps. For this reason, an app needs to define a storage implementation that the library can use to store and retrieve a session given its ID. In a non-embedded app this ID will come from a cookie, whereas in an embedded app this ID will come from App Bridge. Performing OAuthNext, unless you are making a private app, you need to go through OAuth as described here to create sessions for shops using your app. The Shopify API gem tries to make this easy by providing functions to begin and complete the OAuth process. See the Oauth doc for instructions on how to use these. Register Webhooks and a Webhook HandlerIf you intend to use webhooks in your application follow the steps in the Webhooks doc for instructions on registering and handling webhooks. Start Making Authenticated Shopify RequestsOnce your app can perform OAuth, it can now make authenticated Shopify API calls using the Admin REST or GraphQL Clients, or the Storefront API GraphQL Client. Breaking Change NoticesBreaking change notice for version 10.0.0We've rewritten this library for v10, so that it provides all essential features for a Shopify app without requiring any other packages. Here are the main features it provides:
Please refer to the documentation in this repository for instructions on how to use each of these components. With this, a lot changed in how apps access the library. Here are the updates you should make when migrating to v10:
Breaking changes for older versionsSee BREAKING_CHANGES_FOR_OLDER_VERSIONS Developing this gemAfter cloning the repository, you can install the dependencies with bundler: bundle install To run the automated tests: bundle exec rake test We use rubocop to lint/format the code. You can run it with the following command: bundle exec rubocop |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论