vindicia-api 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/vindicia-api.rb +1 -0
- data/lib/vindicia/config.rb +2 -3
- data/lib/vindicia/model.rb +3 -4
- data/lib/vindicia/version.rb +1 -1
- data/test/vindicia/config_test.rb +2 -3
- data/test/vindicia/model_test.rb +2 -3
- data/vindicia-api.gemspec +1 -0
- metadata +18 -5
- data/lib/vindicia/util.rb +0 -8
- data/test/vindicia/util_test.rb +0 -8
data/lib/vindicia-api.rb
CHANGED
data/lib/vindicia/config.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'singleton'
|
2
|
-
require 'vindicia/util'
|
3
2
|
|
4
3
|
module Vindicia
|
5
4
|
|
@@ -193,7 +192,7 @@ module Vindicia
|
|
193
192
|
return false unless API_CLASSES[config.api_version]
|
194
193
|
|
195
194
|
API_CLASSES[config.api_version].each_key do |vindicia_klass|
|
196
|
-
const_set(
|
195
|
+
const_set(vindicia_klass.to_s.camelize,
|
197
196
|
Class.new do
|
198
197
|
include Vindicia::Model
|
199
198
|
|
@@ -214,4 +213,4 @@ module Vindicia
|
|
214
213
|
)
|
215
214
|
end
|
216
215
|
end
|
217
|
-
end
|
216
|
+
end
|
data/lib/vindicia/model.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require "savon"
|
2
|
-
require "savon/core_ext/string"
|
3
2
|
|
4
3
|
module Vindicia
|
5
4
|
|
@@ -46,7 +45,7 @@ module Vindicia
|
|
46
45
|
|
47
46
|
def define_class_action(action)
|
48
47
|
class_action_module.module_eval <<-CODE
|
49
|
-
def #{action.to_s.
|
48
|
+
def #{action.to_s.underscore}(body = {}, &block)
|
50
49
|
client.request :tns, #{action.inspect} do
|
51
50
|
soap.namespaces["xmlns:tns"] = vindicia_target_namespace
|
52
51
|
http.headers["SOAPAction"] = vindicia_soap_action('#{action}')
|
@@ -56,7 +55,7 @@ module Vindicia
|
|
56
55
|
block.call(soap, wsdl, http, wsse) if block
|
57
56
|
end
|
58
57
|
rescue Exception => e
|
59
|
-
rescue_exception(:#{action.to_s.
|
58
|
+
rescue_exception(:#{action.to_s.underscore}, e)
|
60
59
|
end
|
61
60
|
CODE
|
62
61
|
end
|
@@ -90,7 +89,7 @@ module Vindicia
|
|
90
89
|
end
|
91
90
|
|
92
91
|
def vindicia_soap_action(action)
|
93
|
-
%{"#{vindicia_target_namespace}##{action.to_s.
|
92
|
+
%{"#{vindicia_target_namespace}##{action.to_s.camelize(:lower)}"}
|
94
93
|
end
|
95
94
|
|
96
95
|
def rescue_exception(action, error)
|
data/lib/vindicia/version.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'helper'
|
2
|
-
require 'vindicia/util'
|
3
2
|
|
4
3
|
class Vindicia::ConfigTest < Test::Unit::TestCase
|
5
4
|
|
@@ -8,7 +7,7 @@ class Vindicia::ConfigTest < Test::Unit::TestCase
|
|
8
7
|
def self.clear_config
|
9
8
|
if Vindicia.config.is_configured?
|
10
9
|
Vindicia::API_CLASSES[Vindicia.config.api_version].each_key do |vindicia_klass|
|
11
|
-
Vindicia.send(:remove_const,
|
10
|
+
Vindicia.send(:remove_const, vindicia_klass.to_s.camelize.to_sym)
|
12
11
|
end
|
13
12
|
end
|
14
13
|
end
|
@@ -88,7 +87,7 @@ class Vindicia::ConfigTest < Test::Unit::TestCase
|
|
88
87
|
assert Vindicia.config.is_configured?
|
89
88
|
|
90
89
|
Vindicia::API_CLASSES[good_api_version].each_key do |vindicia_klass|
|
91
|
-
assert Vindicia.const_get(
|
90
|
+
assert Vindicia.const_get(vindicia_klass.to_s.camelize)
|
92
91
|
end
|
93
92
|
end
|
94
93
|
|
data/test/vindicia/model_test.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'helper'
|
2
|
-
require 'vindicia/util'
|
3
2
|
require 'net/http'
|
4
3
|
|
5
4
|
class Vindicia::ModelTest < Test::Unit::TestCase
|
@@ -9,7 +8,7 @@ class Vindicia::ModelTest < Test::Unit::TestCase
|
|
9
8
|
def self.clear_config
|
10
9
|
if Vindicia.config.is_configured?
|
11
10
|
Vindicia::API_CLASSES[Vindicia.config.api_version].each_key do |vindicia_klass|
|
12
|
-
Vindicia.send(:remove_const,
|
11
|
+
Vindicia.send(:remove_const, vindicia_klass.to_s.camelize.to_sym)
|
13
12
|
end
|
14
13
|
end
|
15
14
|
end
|
@@ -39,7 +38,7 @@ class Vindicia::ModelTest < Test::Unit::TestCase
|
|
39
38
|
def test_should_define_api_methods_of_respective_vindicia_class_for_respective_api_version
|
40
39
|
Vindicia::API_CLASSES[@good_api_version].each_key do |vindicia_klass_name|
|
41
40
|
|
42
|
-
vindicia_klass = Vindicia.const_get(
|
41
|
+
vindicia_klass = Vindicia.const_get(vindicia_klass_name.to_s.camelize)
|
43
42
|
|
44
43
|
Vindicia::API_CLASSES[@good_api_version][vindicia_klass_name].each do |api_method|
|
45
44
|
assert vindicia_klass.respond_to?(api_method)
|
data/vindicia-api.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vindicia-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
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: 2012-09-
|
12
|
+
date: 2012-09-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: savon
|
@@ -27,6 +27,22 @@ dependencies:
|
|
27
27
|
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: active_support
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
30
46
|
- !ruby/object:Gem::Dependency
|
31
47
|
name: rake
|
32
48
|
requirement: !ruby/object:Gem::Requirement
|
@@ -77,14 +93,12 @@ files:
|
|
77
93
|
- lib/vindicia-api.rb
|
78
94
|
- lib/vindicia/config.rb
|
79
95
|
- lib/vindicia/model.rb
|
80
|
-
- lib/vindicia/util.rb
|
81
96
|
- lib/vindicia/version.rb
|
82
97
|
- test/helper.rb
|
83
98
|
- test/singleton_reset.rb
|
84
99
|
- test/test_vindicia-api.rb
|
85
100
|
- test/vindicia/config_test.rb
|
86
101
|
- test/vindicia/model_test.rb
|
87
|
-
- test/vindicia/util_test.rb
|
88
102
|
- vindicia-api.gemspec
|
89
103
|
homepage: https://github.com/agoragames/vindicia-api
|
90
104
|
licenses: []
|
@@ -116,4 +130,3 @@ test_files:
|
|
116
130
|
- test/test_vindicia-api.rb
|
117
131
|
- test/vindicia/config_test.rb
|
118
132
|
- test/vindicia/model_test.rb
|
119
|
-
- test/vindicia/util_test.rb
|
data/lib/vindicia/util.rb
DELETED
data/test/vindicia/util_test.rb
DELETED