vindicia-api 0.0.4 → 0.0.5

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.
@@ -1,2 +1,3 @@
1
+ require 'active_support/core_ext/string/conversions'
1
2
  require 'vindicia/config'
2
3
  require 'vindicia/model'
@@ -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(Vindicia::Util.camelize(vindicia_klass.to_s),
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
@@ -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.snakecase}(body = {}, &block)
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.snakecase}, e)
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.lower_camelcase}"}
92
+ %{"#{vindicia_target_namespace}##{action.to_s.camelize(:lower)}"}
94
93
  end
95
94
 
96
95
  def rescue_exception(action, error)
@@ -1,3 +1,3 @@
1
1
  module Vindicia
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -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, Vindicia::Util.camelize(vindicia_klass.to_s).to_sym)
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(Vindicia::Util.camelize(vindicia_klass.to_s))
90
+ assert Vindicia.const_get(vindicia_klass.to_s.camelize)
92
91
  end
93
92
  end
94
93
 
@@ -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, Vindicia::Util.camelize(vindicia_klass.to_s).to_sym)
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(Vindicia::Util.camelize(vindicia_klass_name.to_s))
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)
@@ -19,6 +19,7 @@ Gem::Specification.new do |gem|
19
19
  gem.require_paths = ["lib"]
20
20
 
21
21
  gem.add_dependency('savon')
22
+ gem.add_dependency('active_support')
22
23
 
23
24
  gem.add_development_dependency('rake')
24
25
  gem.add_development_dependency('mocha')
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
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-11 00:00:00.000000000 Z
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
@@ -1,8 +0,0 @@
1
- module Vindicia
2
- module Util
3
- # Taken from Rails 3.0.4 ActiveSupport::Inflector
4
- def self.camelize(lower_case_and_underscored_word)
5
- lower_case_and_underscored_word.to_s.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase }
6
- end
7
- end
8
- end
@@ -1,8 +0,0 @@
1
- require 'helper'
2
- require 'vindicia/util'
3
-
4
- class Vindicia::UtilTest < Test::Unit::TestCase
5
- def test_camelize_should_produce_camalcase_name_from_lowercase_underscore_name
6
- assert_equal 'FooBarBaz', Vindicia::Util.camelize('foo_bar_baz')
7
- end
8
- end