
Security News
New Website “Is It Really FOSS?” Tracks Transparency in Open Source Distribution Models
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
This gem is an API wrapper for the Shapeways API
It supports the Shapeways API which uses OAuth 1.0a.
This gem does not contain any methods for authentication. Everyone tends to use something a little bit different, so the goal was to abstract out the OAuth authentication and allow you to bring your own, if you desire. You only need to supply the tokens. However, I also created an OmniAuth strategy to support the Shapeways API. So, if you're already using OmniAuth in your project, you can easily add the strategy with my omniauth-shapewats gem according to the instructions found here: Shapeways OmniAuth Strategy
Add the gem to your Gemfile
:
gem 'reshape'
Then instantiate the client using the oAuth tokens (this example implies using Foreman and an .env file that contain these values):
Reshape::Client.new({
consumer_token: ENV['SHAPEWAYS_CONSUMER_TOKEN'],
consumer_secret: ENV['SHAPEWAYS_CONSUMER_SECRET'],
oauth_token: ENV['SHAPEWAYS_OAUTH_TOKEN'],
oauth_secret: ENV['SHAPEWAYS_OAUTH_SECRET']
})
The consumer_token and consumer_secret are supplied by Shapeways once you create a developer account and an app. Additional information can be found on the Shapeways Developer Site.
The oauth_token and oauth_secret are the access tokens that are received from the OAuth transaction. In this Sinatra method that uses the OmniAuth callback method, you can see how to parse the access tokens out of the response and use it to instantiate the Reshape client along with your pre-defined consumer tokens:
get '/auth/:provider/callback' do
auth = request.env['omniauth.auth']
client = Reshape::Client.new({
consumer_token: ENV['SHAPEWAYS_CONSUMER_KEY'],
consumer_secret: ENV['SHAPEWAYS_CONSUMER_SECRET'],
oauth_token: auth.credentials.token,
oauth_secret: auth.credentials.secret
})
materials = client.materials
erb "<h1>#{params[:provider]}</h1>
<pre>#{JSON.pretty_generate(auth)}</pre>
<pre>#{JSON.pretty_generate(materials)}</pre>"
end
Check the examples directory for a full example using Sinatra.
Note that rspec is using vcr for fixtures. If you delete files from spec/fixtures/cassettes, the tests will fail. They use dummy tokens, and will attempt to communicate with the live API with missing OAuth parameters. In order to test against the live API and generate your own cassettes, create a .env file with the following parameters:
SHAPEWAYS_CONSUMER_TOKEN='your consumer token from Shapeways'
SHAPEWAYS_CONSUMER_SECRET='your consumer secret from Shapeways'
SHAPEWAYS_OAUTH_TOKEN='OAuth token that are returned from a successful authentication'
SHAPEWAYS_OAUTH_SECRET='OAuth secret that are returned from a successful authentication'
From there, you can run foreman run bundle exec rake to regenerate the cassettes using live data in conjunction with your credentials. Just a word of warning: don't commit those cassettes to a public repo, as they will contain valid tokens that could potentially be used to hijack a live application that uses those credentials.
Add rspec tests for adding models and photos.
Copyright (c) 2013 John Barton. See LICENSE for details.
FAQs
Unknown package
We found that reshape demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
Security News
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.