proximus 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/Gemfile +0 -2
- data/config/proximus.yml +18 -0
- data/lib/proximus/proxy.rb +31 -0
- data/lib/proximus/version.rb +1 -1
- data/lib/proximus.rb +2 -3
- data/proximus.gemspec +2 -0
- metadata +15 -2
data/Gemfile
CHANGED
data/config/proximus.yml
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
development:
|
2
|
+
base_url: http://http://ellingsonmineral.com/api/
|
3
|
+
auth_url: session/
|
4
|
+
username: margo
|
5
|
+
password: god
|
6
|
+
|
7
|
+
# ThePlague: Our recent unknown intruder penetrated using the superuser
|
8
|
+
# account, giving him access to our whole system.
|
9
|
+
#
|
10
|
+
# Margo: Precisely what you're paid to prevent.
|
11
|
+
#
|
12
|
+
# ThePlague: Someone didn't bother reading my carefully prepared memo on
|
13
|
+
# commonly-used passwords. Now, then, as I so meticulously pointed
|
14
|
+
# out, the four most-used passwords are: love, sex, secret, and...
|
15
|
+
#
|
16
|
+
# Margo: [glares at The Plague]
|
17
|
+
#
|
18
|
+
# ThePlague: god. So, would your holiness care to change her password?
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Proximus
|
2
|
+
class Proxy
|
3
|
+
def initialize(config_file = 'config/proximus.yml', env='development')
|
4
|
+
@config = load_config(config_file, env)
|
5
|
+
|
6
|
+
@base_url = @config[:base_url]
|
7
|
+
@username = @config[:username]
|
8
|
+
@password = @config[:password]
|
9
|
+
@auth_url = @config[:auth_url]
|
10
|
+
|
11
|
+
@api = RestClient::Resource.new(@base_url)
|
12
|
+
end
|
13
|
+
|
14
|
+
def authenticate
|
15
|
+
resp = @api[@auth_url].post(:username => @username, :password => @password)
|
16
|
+
@sessionid = resp.cookies["sessionid"] # AB: this needs to be genericized
|
17
|
+
end
|
18
|
+
|
19
|
+
def execute(method, path)
|
20
|
+
@api[path].send method.downcase.to_sym, :cookies => {:sessionid => @sessionid}
|
21
|
+
end
|
22
|
+
|
23
|
+
def load_config(file, env)
|
24
|
+
YAML.load_file(file)[env].symbolize_keys
|
25
|
+
end
|
26
|
+
|
27
|
+
# AB: For history. And fun.
|
28
|
+
# Proximus::Proxy started out as proximus_maximus_configuratus
|
29
|
+
def proximus_maximus_configuratus; end
|
30
|
+
end
|
31
|
+
end
|
data/lib/proximus/version.rb
CHANGED
data/lib/proximus.rb
CHANGED
data/proximus.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: proximus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,18 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
date: 2011-10-25 00:00:00.000000000Z
|
13
|
-
dependencies:
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rest-client
|
16
|
+
requirement: &70199993419680 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70199993419680
|
14
25
|
description: Someday I'll grow up and proxy API calls
|
15
26
|
email:
|
16
27
|
- adambair@gmail.com
|
@@ -22,7 +33,9 @@ files:
|
|
22
33
|
- Gemfile
|
23
34
|
- README.rdoc
|
24
35
|
- Rakefile
|
36
|
+
- config/proximus.yml
|
25
37
|
- lib/proximus.rb
|
38
|
+
- lib/proximus/proxy.rb
|
26
39
|
- lib/proximus/version.rb
|
27
40
|
- proximus.gemspec
|
28
41
|
homepage: http://github.com/adambair/proximus
|