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 CHANGED
@@ -1,4 +1,2 @@
1
1
  source "http://rubygems.org"
2
-
3
- # Specify your gem's dependencies in proximus.gemspec
4
2
  gemspec
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Proximus
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/lib/proximus.rb CHANGED
@@ -1,5 +1,4 @@
1
+ require "rest-client"
1
2
  require "proximus/version"
3
+ require "proximus/proxy"
2
4
 
3
- module Proximus
4
- # Your code goes here...
5
- end
data/proximus.gemspec CHANGED
@@ -17,4 +17,6 @@ Gem::Specification.new do |s|
17
17
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
18
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
19
  s.require_paths = ["lib"]
20
+
21
+ s.add_runtime_dependency "rest-client"
20
22
  end
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.1
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