Giter Club home page Giter Club logo

vend-ruby's Introduction

This gem provides access to Vend’s REST API.

Vend API Documentation

At the time of writing, this is located at developers.vendhq.com/documentation

Using Vend API via Oauth 2.0

You will need to implement the following steps to connect your application to a Vend Retailer account.

1 Requesting authorisation url. User must be redirected to this url in order to receive authorisation code.
auth_code = Vend::Oauth2::AuthCode.new(STORE, CLIENT_ID, SECRET, REDIRECT_URI)
url = auth_code.authorize_url

Url will look like:

https://secure.vendhq.com/connect?response_type=code&client_id={client_id}&redirect_uri={redirect_uri}&state={state}

After successful authorisation, you will be redirected to:

{redirect_uri}?code={code}&domain_prefix={domain_prefix}&state={state}
2 Requesting access token.
auth_code = Vend::Oauth2::AuthCode.new(STORE, CLIENT_ID, SECRET, REDIRECT_URI)
token = auth_code.token_from_code(params[:code])

Where token is an instance of OAuth2::AccessToken www.rubydoc.info/gems/oauth2/1.0.0/OAuth2/AccessToken

3 Using the token to access the Vend API.
client = Vend::Oauth2::Client.new(STORE, AUTH_TOKEN)
client.Product.all.each do |product|
  puts product.name
end
4 Refreshing the access token
auth_code = Vend::Oauth2::AuthCode.new(STORE, CLIENT_ID, SECRET, REDIRECT_URI)
token = auth_code.refresh_token(auth_token, refresh_token)

The response payload may include a refresh token, if so, you need to update your currently stored refresh token.

vend-ruby's People

Contributors

gingermusketeer avatar glsignal avatar jsbizon avatar kaleworsley avatar lcpriest avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

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

vend-ruby's Issues

Help

Hello,

I'm new to ruby, having a hard time using this gem.

I'm trying to get a list of sales in a certain status, how do i do that with client.RegisterSale?

Thanks

Additional functionality

Hi, I am going to some additional functionality (authentication by auth_token, etc). will you be able merge it to the master and update gem?

Thanks

Is this gem Oauth only?

Hi!

Can the gem be used with the personal access token generated on vend dashboard?

Cheers!

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.