reshape 0.1.1 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +24 -8
- data/examples/config.ru +1 -6
- data/lib/reshape/version.rb +1 -1
- data/reshape.gemspec +4 -4
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 15a884c39895f2599223ec4eeabac416b97ff568
|
4
|
+
data.tar.gz: 4d6c37cda43b9faf4729e3565b058352afac5812
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17ce5fe38fc93d9e5ee19fd3203447261fc8ed99a8719b985a282d2cebe1c705afe4fe22fbeeaa31e00f191b2206492c225fe8ecab4c13117d59bf541795b9cc
|
7
|
+
data.tar.gz: 3b0fdcb7561b2c1fda7b5ba5ba4390172d4be8e1b81bcb09b05ef05dfb14eeecd1c0d2e2d22887fca2122ef9c1dde311510a9a6c1c2732f89988539bbff4f6f3
|
data/README.md
CHANGED
@@ -34,19 +34,35 @@ get '/auth/:provider/callback' do
|
|
34
34
|
auth = request.env['omniauth.auth']
|
35
35
|
|
36
36
|
client = Reshape::Client.new({
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
37
|
+
consumer_token: ENV['SHAPEWAYS_CONSUMER_KEY'],
|
38
|
+
consumer_secret: ENV['SHAPEWAYS_CONSUMER_SECRET'],
|
39
|
+
oauth_token: auth.credentials.token,
|
40
|
+
oauth_secret: auth.credentials.secret
|
41
|
+
})
|
42
|
+
|
43
|
+
materials = client.materials
|
44
|
+
|
45
|
+
erb "<h1>#{params[:provider]}</h1>
|
46
|
+
<pre>#{JSON.pretty_generate(auth)}</pre>
|
47
|
+
<pre>#{JSON.pretty_generate(materials)}</pre>"
|
45
48
|
end
|
46
49
|
```
|
47
50
|
|
48
51
|
Check the examples directory for a full example using Sinatra.
|
49
52
|
|
53
|
+
## Tests
|
54
|
+
|
55
|
+
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:
|
56
|
+
|
57
|
+
```ruby
|
58
|
+
SHAPEWAYS_CONSUMER_TOKEN='your consumer token from Shapeways'
|
59
|
+
SHAPEWAYS_CONSUMER_SECRET='your consumer secret from Shapeways'
|
60
|
+
SHAPEWAYS_OAUTH_TOKEN='OAuth token that are returned from a successful authentication'
|
61
|
+
SHAPEWAYS_OAUTH_SECRET='OAuth secret that are returned from a successful authentication'
|
62
|
+
```
|
63
|
+
|
64
|
+
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.
|
65
|
+
|
50
66
|
## Todo
|
51
67
|
|
52
68
|
Add rspec tests for adding models and photos.
|
data/examples/config.ru
CHANGED
@@ -19,16 +19,11 @@ class App < Sinatra::Base
|
|
19
19
|
get '/auth/:provider/callback' do
|
20
20
|
auth = request.env['omniauth.auth']
|
21
21
|
|
22
|
-
puts '::::'
|
23
|
-
puts auth.credentials.token
|
24
|
-
puts auth.credentials.secret
|
25
|
-
|
26
22
|
client = Reshape::Client.new({
|
27
23
|
consumer_token: ENV['SHAPEWAYS_CONSUMER_KEY'],
|
28
24
|
consumer_secret: ENV['SHAPEWAYS_CONSUMER_SECRET'],
|
29
25
|
oauth_token: auth.credentials.token,
|
30
|
-
oauth_secret: auth.credentials.secret
|
31
|
-
proxy: 'http://localhost:8888'
|
26
|
+
oauth_secret: auth.credentials.secret
|
32
27
|
})
|
33
28
|
|
34
29
|
materials = client.materials
|
data/lib/reshape/version.rb
CHANGED
data/reshape.gemspec
CHANGED
@@ -17,10 +17,10 @@ Gem::Specification.new do |gem|
|
|
17
17
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
18
|
gem.require_paths = ["lib"]
|
19
19
|
|
20
|
-
gem.add_dependency 'faraday', '
|
21
|
-
gem.add_dependency 'faraday_middleware', '
|
22
|
-
gem.add_dependency 'hashie', '
|
23
|
-
gem.add_dependency 'multi_json', '
|
20
|
+
gem.add_dependency 'faraday', '>= 0.8.4'
|
21
|
+
gem.add_dependency 'faraday_middleware', '>= 0.8.4'
|
22
|
+
gem.add_dependency 'hashie', '>= 1.2'
|
23
|
+
gem.add_dependency 'multi_json', '>= 1.3'
|
24
24
|
gem.add_dependency 'simple_oauth'
|
25
25
|
|
26
26
|
gem.add_development_dependency 'json'
|
metadata
CHANGED
@@ -1,69 +1,69 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: reshape
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: '0.2'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Barton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-05-
|
11
|
+
date: 2013-05-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 0.8.4
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.8.4
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: faraday_middleware
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 0.8.4
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 0.8.4
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: hashie
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - '>='
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '1.2'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1.2'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: multi_json
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '1.3'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '1.3'
|
69
69
|
- !ruby/object:Gem::Dependency
|