integration_wrapper 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -49,7 +49,7 @@ $:.unshift(File.dirname(__FILE__)) unless
49
49
  $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
50
50
 
51
51
  module IntegrationWrapper
52
- VERSION = '0.0.3'
52
+ VERSION = '0.0.4'
53
53
  end
54
54
 
55
55
  if defined?(Rails)
@@ -25,11 +25,7 @@ module IntegrationWrapper
25
25
  ################################################################################
26
26
 
27
27
  @@mode = Rails.env.eql?("production") ? MODE_ONLINE : MODE_OFFLINE
28
-
29
- def initialize(params = {})
30
- #@mode = Rails.env.eql?("production") ? MODE_ONLINE : MODE_OFFLINE
31
- end
32
-
28
+
33
29
  def self.mode
34
30
  @@mode
35
31
  end
@@ -39,6 +35,22 @@ module IntegrationWrapper
39
35
  @@mode = thing
40
36
  end
41
37
 
38
+ def self.modes
39
+ [ MODE_ONLINE, MODE_OFFLINE ]
40
+ end
41
+
42
+ ################################################################################
43
+ # constructor
44
+ ################################################################################
45
+
46
+ def initialize(params = {})
47
+ #@mode = Rails.env.eql?("production") ? MODE_ONLINE : MODE_OFFLINE
48
+ end
49
+
50
+ ################################################################################
51
+ # instance methods
52
+ ################################################################################
53
+
42
54
  # If an action comes in, say :foo, then call the foo_online class method if mode is online, and foo_offline if mode is offline.
43
55
  # def self.perform_action action_name, options = {}
44
56
  # self.send("#{action_name}_#{@@mode}", options)
@@ -50,7 +62,7 @@ module IntegrationWrapper
50
62
  # Now send
51
63
  begin
52
64
  self.send name, *args, &block
53
- rescue NoMethodError => e
65
+ rescue NoMethodError => e
54
66
  puts "Error trying to call method #{name}. Maybe you forgot to add it? I need all methods to be suffixed with either #{IntegrationWrapper::Base::MODE_ONLINE} or #{IntegrationWrapper::Base::MODE_OFFLINE}. Example: foo_online. Methods: #{methods.inspect}. Error was: #{e}."
55
67
  puts "Trace:"
56
68
  puts e.backtrace
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: integration_wrapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-28 00:00:00.000000000 Z
12
+ date: 2013-04-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rdoc