stagehand 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore CHANGED
@@ -2,3 +2,15 @@
2
2
  .bundle
3
3
  Gemfile.lock
4
4
  pkg/*
5
+
6
+ # Emacs
7
+ *~
8
+ .\#*
9
+ \#*\#
10
+ /.emacs.desktop
11
+ /.emacs.desktop.lock
12
+ .elc
13
+ auto-save-list
14
+ tramp
15
+ .*swp
16
+ TAGS
data/README.md ADDED
@@ -0,0 +1,33 @@
1
+ Stagehand
2
+ =========
3
+
4
+ Stagehand is a client-side library for manipulating RESTful resources provided by Personas, a Rails + Backbone user managment service.
5
+
6
+ Usage
7
+ =====
8
+
9
+ class ApplicationController < ActionController::Base
10
+ stagehand = Stagehand::Client.new({
11
+ client_id: 'YOUR_APP_CLIENT_ID',
12
+ client_secret: 'YOUR_APP_CLIENT_SECRET',
13
+ resource_host: 'YOUR_APP_RESOURCE_HOST',
14
+ client_host: 'YOUR_APP_HOST_WITH_PORT'
15
+ })
16
+ end
17
+
18
+ class SessionsController < ApplicationController
19
+ # stagehand.authorize_url is an OAuth 2.0 url created by the
20
+ # configuration variables above. After the user is authenticated
21
+ # and grants the client app access, the resource host performs
22
+ # a callback setting the session[:access_token] and redirects
23
+ # to the client app's root_url.
24
+ def new
25
+ redirect_to stagehand.authorize_url
26
+ end
27
+
28
+ # Destroy the access_token (but leave the OAuth host cookie intact)
29
+ def destroy
30
+ session[:access_token] = nil
31
+ redirect_to root_url, :notice => "Logged out!"
32
+ end
33
+ end
data/Rakefile CHANGED
@@ -1 +1,10 @@
1
- require "bundler/gem_tasks"
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ desc "Run RSpec"
5
+ RSpec::Core::RakeTask.new do |t|
6
+ t.verbose = false
7
+ end
8
+
9
+ task :default => :spec
10
+
@@ -1,3 +1,3 @@
1
1
  module Stagehand
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/lib/stagehand.rb CHANGED
@@ -1,7 +1,16 @@
1
- require "stagehand/version"
1
+ require 'yajl'
2
+ require 'stagehand/version'
2
3
 
3
- module Stagehand
4
- def self.hello
5
- "Hello world"
4
+ class Stagehand::Client
5
+ def initialize(attributes)
6
+ @attributes = attributes
7
+ @client_id = @attributes[:client_id]
8
+ @client_secret = @attributes[:client_secret]
9
+ @resource_host = @attributes[:resource_host]
10
+ @client_host = @attributes[:client_host]
11
+ end
12
+
13
+ def authorize_url
14
+ @resource_host + "/oauth/authorize?client_id=#{@client_id}&client_secret=#{@client_secret}&redirect_uri=#{@client_host}/callback"
6
15
  end
7
16
  end
@@ -0,0 +1,7 @@
1
+ require 'rspec'
2
+ require 'stagehand'
3
+
4
+ RSpec.configure do |config|
5
+ config.color_enabled = true
6
+ config.formatter = 'documentation'
7
+ end
@@ -0,0 +1,14 @@
1
+ require 'spec_helper'
2
+
3
+ describe Stagehand do
4
+ describe "initialization" do
5
+ it "creates an OAuth 2.0 authorize url" do
6
+ Stagehand::Client.new(
7
+ { client_id: 'test_app',
8
+ client_secret: 'abcdef123456',
9
+ resource_host: 'http://0.0.0.0:3000',
10
+ client_host: 'http://0.0.0.0:4000' }
11
+ ).authorize_url.should == "http://0.0.0.0:3000/oauth/authorize?client_id=test_app&client_secret=abcdef123456&redirect_uri=http://0.0.0.0:4000/callback"
12
+ end
13
+ end
14
+ end
data/stagehand.gemspec CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
7
7
  s.version = Stagehand::VERSION
8
8
  s.authors = ["Reed Law"]
9
9
  s.email = ["reed@smashingboxes.com.com"]
10
- s.homepage = ""
10
+ s.homepage = "https://github.com/smashingboxes/stagehand"
11
11
  s.summary = %q{client library for Personas (user management) service}
12
12
  s.description = %q{Client-side library for manipulating RESTful resources provided by Personas, a Rails + Backbone user managment service}
13
13
 
@@ -19,7 +19,6 @@ Gem::Specification.new do |s|
19
19
  s.require_paths = ["lib"]
20
20
 
21
21
  # specify any dependencies here; for example:
22
- # s.add_development_dependency "rspec"
23
- # s.add_runtime_dependency "rest-client"
24
- s.add_runtime_dependency "yajl-ruby"
22
+ s.add_development_dependency 'rspec', '~> 2.7.0'
23
+ s.add_runtime_dependency 'yajl-ruby', '~> 1.0.0'
25
24
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stagehand
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,17 +11,28 @@ bindir: bin
11
11
  cert_chain: []
12
12
  date: 2011-10-24 00:00:00.000000000Z
13
13
  dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rspec
16
+ requirement: &84086500 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 2.7.0
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: *84086500
14
25
  - !ruby/object:Gem::Dependency
15
26
  name: yajl-ruby
16
- requirement: &73537760 !ruby/object:Gem::Requirement
27
+ requirement: &84086000 !ruby/object:Gem::Requirement
17
28
  none: false
18
29
  requirements:
19
- - - ! '>='
30
+ - - ~>
20
31
  - !ruby/object:Gem::Version
21
- version: '0'
32
+ version: 1.0.0
22
33
  type: :runtime
23
34
  prerelease: false
24
- version_requirements: *73537760
35
+ version_requirements: *84086000
25
36
  description: Client-side library for manipulating RESTful resources provided by Personas,
26
37
  a Rails + Backbone user managment service
27
38
  email:
@@ -32,11 +43,14 @@ extra_rdoc_files: []
32
43
  files:
33
44
  - .gitignore
34
45
  - Gemfile
46
+ - README.md
35
47
  - Rakefile
36
48
  - lib/stagehand.rb
37
49
  - lib/stagehand/version.rb
50
+ - spec/spec_helper.rb
51
+ - spec/stagehand_spec.rb
38
52
  - stagehand.gemspec
39
- homepage: ''
53
+ homepage: https://github.com/smashingboxes/stagehand
40
54
  licenses: []
41
55
  post_install_message:
42
56
  rdoc_options: []