billingsystem-remote 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/Manifest.txt +13 -0
- data/PostInstall.txt +7 -0
- data/README.rdoc +69 -0
- data/Rakefile +25 -0
- data/app/controllers/frontend/users_controller.rb +38 -0
- data/lib/billingsystem-remote.rb +6 -0
- data/rails/init.rb +0 -0
- data/script/console +10 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/test/test_billingsystem-remote.rb +11 -0
- data/test/test_helper.rb +3 -0
- metadata +115 -0
data/History.txt
ADDED
data/Manifest.txt
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
History.txt
|
2
|
+
Manifest.txt
|
3
|
+
PostInstall.txt
|
4
|
+
README.rdoc
|
5
|
+
Rakefile
|
6
|
+
lib/billingsystem-remote.rb
|
7
|
+
script/console
|
8
|
+
script/destroy
|
9
|
+
script/generate
|
10
|
+
test/test_billingsystem-remote.rb
|
11
|
+
test/test_helper.rb
|
12
|
+
app/controllers/frontend/users_controller.rb
|
13
|
+
rails/init.rb
|
data/PostInstall.txt
ADDED
data/README.rdoc
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
= billingsystem-remote
|
2
|
+
|
3
|
+
* http://github.com/cmdjohnson/billingsystem-remote
|
4
|
+
|
5
|
+
== DESCRIPTION:
|
6
|
+
|
7
|
+
Hands a specific amount of control to Billingsystem so that it can operate upon the data of the apps that rely on Billingsystem for recurring billing.
|
8
|
+
|
9
|
+
== FEATURES/PROBLEMS:
|
10
|
+
|
11
|
+
- Creates a new user whenever a Customer creates a new Subscription for speedy delivery.
|
12
|
+
|
13
|
+
== SYNOPSIS:
|
14
|
+
|
15
|
+
This gem adds a controller called Frontend::UsersController to your app. The remote app (in this case, Billingsystem) must send an API request using a predefined key and the preferred username and password.
|
16
|
+
|
17
|
+
Step 1. Create your predefined key
|
18
|
+
|
19
|
+
$ script/console # open up a Rails console
|
20
|
+
>> ActiveSupport::SecureRandom.hex
|
21
|
+
=> "1abc927b5b4f35f517983599ccc86c64" # the hash will be different on your machine, obviously.
|
22
|
+
|
23
|
+
Step 2. Create a new file called config/initializers/billingsystem-remote.rb:
|
24
|
+
|
25
|
+
module BillingSystem
|
26
|
+
module Remote
|
27
|
+
class Config
|
28
|
+
SECRET = "1abc927b5b4f35f517983599ccc86c64" # put the generated secret here.
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
== REQUIREMENTS:
|
34
|
+
|
35
|
+
- Rails, this gem is tested on 2.3.14.
|
36
|
+
- Authlogic, this gem works with an 'email' as login.
|
37
|
+
|
38
|
+
== INSTALL:
|
39
|
+
|
40
|
+
$ sudo gem install billingsystem-remote
|
41
|
+
|
42
|
+
== TESTING:
|
43
|
+
|
44
|
+
Check out the billingsystem-remote-project page for the full test suite.
|
45
|
+
|
46
|
+
== LICENSE:
|
47
|
+
|
48
|
+
(The MIT License)
|
49
|
+
|
50
|
+
Copyright (c) 2012 Commander Johnson <commanderjohnson@gmail.com>
|
51
|
+
|
52
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
53
|
+
a copy of this software and associated documentation files (the
|
54
|
+
'Software'), to deal in the Software without restriction, including
|
55
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
56
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
57
|
+
permit persons to whom the Software is furnished to do so, subject to
|
58
|
+
the following conditions:
|
59
|
+
|
60
|
+
The above copyright notice and this permission notice shall be
|
61
|
+
included in all copies or substantial portions of the Software.
|
62
|
+
|
63
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
64
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
65
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
66
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
67
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
68
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
69
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
gem 'hoe', '>= 2.1.0'
|
3
|
+
require 'hoe'
|
4
|
+
require 'fileutils'
|
5
|
+
require './lib/billingsystem-remote'
|
6
|
+
|
7
|
+
Hoe.plugin :newgem
|
8
|
+
# Hoe.plugin :website
|
9
|
+
# Hoe.plugin :cucumberfeatures
|
10
|
+
|
11
|
+
# Generate all the Rake tasks
|
12
|
+
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
13
|
+
$hoe = Hoe.spec 'billingsystem-remote' do
|
14
|
+
self.developer 'Commander Johnson', 'commanderjohnson@gmail.com'
|
15
|
+
self.rubyforge_name = self.name # TODO this is default value
|
16
|
+
self.extra_deps = [['activesupport','>= 2.3.14']]
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
require 'newgem/tasks'
|
21
|
+
Dir['tasks/**/*.rake'].each { |t| load t }
|
22
|
+
|
23
|
+
# TODO - want other tests/tasks run by default? Add them to the list
|
24
|
+
# remove_task :default
|
25
|
+
# task :default => [:spec, :features]
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
class Frontend::UsersController < ApplicationController
|
3
|
+
before_filter :authenticate
|
4
|
+
|
5
|
+
def create
|
6
|
+
# Be careful: Make sure it is ::User, not 'User'
|
7
|
+
# Might get confused with Frontend::User!
|
8
|
+
@user = ::User.new(params[:user])
|
9
|
+
# +_+ #
|
10
|
+
respond_to do |format|
|
11
|
+
if @user.save
|
12
|
+
format.xml do
|
13
|
+
render :xml => @user, :status => :created, :location => @user
|
14
|
+
end
|
15
|
+
else
|
16
|
+
format.xml do
|
17
|
+
render :xml => @user.errors, :status => :unprocessable_entity
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
protected
|
24
|
+
|
25
|
+
############################################################
|
26
|
+
# basic auth
|
27
|
+
############################################################
|
28
|
+
|
29
|
+
def authenticate
|
30
|
+
authenticate_or_request_with_http_basic do |username, password|
|
31
|
+
username == BillingSystem::Remote::Config::USERNAME && password == BillingSystem::Remote::Config::PASSWORD
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
############################################################
|
36
|
+
# end basic auth
|
37
|
+
############################################################
|
38
|
+
end
|
data/rails/init.rb
ADDED
File without changes
|
data/script/console
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# File: script/console
|
3
|
+
irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
|
4
|
+
|
5
|
+
libs = " -r irb/completion"
|
6
|
+
# Perhaps use a console_lib to store any extra methods I may want available in the cosole
|
7
|
+
# libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
|
8
|
+
libs << " -r #{File.dirname(__FILE__) + '/../lib/billingsystem-remote.rb'}"
|
9
|
+
puts "Loading billingsystem-remote gem"
|
10
|
+
exec "#{irb} #{libs} --simple-prompt"
|
data/script/destroy
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'rubigen'
|
6
|
+
rescue LoadError
|
7
|
+
require 'rubygems'
|
8
|
+
require 'rubigen'
|
9
|
+
end
|
10
|
+
require 'rubigen/scripts/destroy'
|
11
|
+
|
12
|
+
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
|
13
|
+
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
|
14
|
+
RubiGen::Scripts::Destroy.new.run(ARGV)
|
data/script/generate
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'rubigen'
|
6
|
+
rescue LoadError
|
7
|
+
require 'rubygems'
|
8
|
+
require 'rubigen'
|
9
|
+
end
|
10
|
+
require 'rubigen/scripts/generate'
|
11
|
+
|
12
|
+
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
|
13
|
+
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
|
14
|
+
RubiGen::Scripts::Generate.new.run(ARGV)
|
data/test/test_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,115 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: billingsystem-remote
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Commander Johnson
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2012-02-24 00:00:00 +01:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: activesupport
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 31
|
30
|
+
segments:
|
31
|
+
- 2
|
32
|
+
- 3
|
33
|
+
- 14
|
34
|
+
version: 2.3.14
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: hoe
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 47
|
46
|
+
segments:
|
47
|
+
- 2
|
48
|
+
- 8
|
49
|
+
- 0
|
50
|
+
version: 2.8.0
|
51
|
+
type: :development
|
52
|
+
version_requirements: *id002
|
53
|
+
description: Hands a specific amount of control to Billingsystem so that it can operate upon the data of the apps that rely on Billingsystem for recurring billing.
|
54
|
+
email:
|
55
|
+
- commanderjohnson@gmail.com
|
56
|
+
executables: []
|
57
|
+
|
58
|
+
extensions: []
|
59
|
+
|
60
|
+
extra_rdoc_files:
|
61
|
+
- History.txt
|
62
|
+
- Manifest.txt
|
63
|
+
- PostInstall.txt
|
64
|
+
files:
|
65
|
+
- History.txt
|
66
|
+
- Manifest.txt
|
67
|
+
- PostInstall.txt
|
68
|
+
- README.rdoc
|
69
|
+
- Rakefile
|
70
|
+
- lib/billingsystem-remote.rb
|
71
|
+
- script/console
|
72
|
+
- script/destroy
|
73
|
+
- script/generate
|
74
|
+
- test/test_billingsystem-remote.rb
|
75
|
+
- test/test_helper.rb
|
76
|
+
- app/controllers/frontend/users_controller.rb
|
77
|
+
- rails/init.rb
|
78
|
+
has_rdoc: true
|
79
|
+
homepage: http://github.com/cmdjohnson/billingsystem-remote
|
80
|
+
licenses: []
|
81
|
+
|
82
|
+
post_install_message:
|
83
|
+
rdoc_options:
|
84
|
+
- --main
|
85
|
+
- README.rdoc
|
86
|
+
require_paths:
|
87
|
+
- lib
|
88
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ">="
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
hash: 3
|
94
|
+
segments:
|
95
|
+
- 0
|
96
|
+
version: "0"
|
97
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
|
+
none: false
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
hash: 3
|
103
|
+
segments:
|
104
|
+
- 0
|
105
|
+
version: "0"
|
106
|
+
requirements: []
|
107
|
+
|
108
|
+
rubyforge_project: billingsystem-remote
|
109
|
+
rubygems_version: 1.3.7
|
110
|
+
signing_key:
|
111
|
+
specification_version: 3
|
112
|
+
summary: Hands a specific amount of control to Billingsystem so that it can operate upon the data of the apps that rely on Billingsystem for recurring billing.
|
113
|
+
test_files:
|
114
|
+
- test/test_billingsystem-remote.rb
|
115
|
+
- test/test_helper.rb
|