serviceproxy 0.2.0 → 0.2.1

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.
@@ -30,7 +30,7 @@ proxy.service_methods.each do |service_method|
30
30
  end
31
31
 
32
32
  def parse_#{underscore(service_method)}(response)
33
- Hpricot.XML(response.body)
33
+ Nokogiri.XML(response.body)
34
34
  end
35
35
  EOS
36
36
  end
@@ -14,7 +14,7 @@ require File.dirname(__FILE__) + '/parser'
14
14
 
15
15
  module ServiceProxy
16
16
  class Base
17
- VERSION = '0.2.0'
17
+ VERSION = '0.2.1'
18
18
 
19
19
  attr_accessor :endpoint, :service_methods, :soap_actions, :http,
20
20
  :uri, :debug, :wsdl, :target_namespace
@@ -123,4 +123,4 @@ module ServiceProxy
123
123
  downcase
124
124
  end
125
125
  end
126
- end
126
+ end
@@ -1,29 +1,35 @@
1
1
  module ServiceProxy
2
2
  class Parser < Nokogiri::XML::SAX::Document
3
- attr_accessor :wsdl_namespace, :soap_namespace, :target_namespace, :service_methods, :soap_actions
3
+ attr_accessor :wsdl_namespace, :soap_namespace, :target_namespace, :service_methods, :soap_actions, :binding
4
4
 
5
5
  def initialize(*args)
6
6
  self.service_methods = []
7
7
  self.soap_actions = Hash.new('')
8
+ self.binding = false
8
9
  super
9
10
  end
10
11
 
11
- def start_element_namespace(name, attributes, prefix, uri, namespace)
12
+ def start_element_namespace(name, attributes, prefix, uri, namespace)
12
13
  case name
14
+ when 'binding'
15
+ self.binding = true
13
16
  when 'definitions'
14
17
  self.wsdl_namespace = prefix if uri == 'http://schemas.xmlsoap.org/wsdl/'
15
18
  self.soap_namespace = prefix if uri == 'http://schemas.xmlsoap.org/wsdl/soap/'
16
19
  attribute = attributes.find { |attribute| attribute.localname == 'targetNamespace' }
17
20
  self.target_namespace = attribute.value if attribute
18
21
  when "operation"
19
- service_method = attributes.first.value if prefix == self.wsdl_namespace
20
- soap_action = attributes.find { |attribute| attribute.localname == 'soapAction' }
21
- self.soap_actions[self.service_methods.last] = soap_action.value if soap_action
22
- (self.service_methods << service_method unless self.service_methods.include?(service_method)) if service_method
22
+ if self.binding
23
+ service_method = attributes.first.value if prefix == self.wsdl_namespace
24
+ soap_action = attributes.find { |attribute| attribute.localname == 'soapAction' }
25
+ self.soap_actions[self.service_methods.last] = soap_action.value if soap_action
26
+ (self.service_methods << service_method unless self.service_methods.include?(service_method)) if service_method
27
+ end
23
28
  end
24
29
  end
25
30
 
26
31
  def end_element_namespace(name, prefix, uri)
32
+ self.binding = false if name == 'binding' && prefix == self.wsdl_namespace
27
33
  end
28
34
  end
29
35
  end
@@ -1,5 +1,3 @@
1
- require 'hpricot'
2
-
3
1
  # Service Endpoints
4
2
  class ISBNService < ServiceProxy::Base
5
3
 
@@ -10,8 +8,9 @@ class ISBNService < ServiceProxy::Base
10
8
  end
11
9
 
12
10
  def parse_is_valid_isbn13(response)
13
- xml = Hpricot.XML(response.body)
14
- xml.at("m:IsValidISBN13Result").inner_text == 'true' ? true : false
11
+ xml = Nokogiri.XML(response.body)
12
+ namespace = { 'm' => 'http://webservices.daehosting.com/ISBN' }
13
+ xml.at('//m:IsValidISBN13Result', namespace).inner_text == 'true' ? true : false
15
14
  end
16
15
  end
17
16
 
@@ -25,7 +24,7 @@ class SHAGeneratorService < ServiceProxy::Base
25
24
  end
26
25
 
27
26
  def parse_gen_ssha(response)
28
- xml = Hpricot.XML(response.body)
27
+ xml = Nokogiri.XML(response.body)
29
28
  xml.at("return").inner_text
30
29
  end
31
30
  end
@@ -52,7 +51,7 @@ class ZipcodeService < ServiceProxy::Base
52
51
  end
53
52
 
54
53
  def parse_zip_code_world_us(response)
55
- Hpricot.XML(response.body)
54
+ xml = Nokogiri.XML(response.body)
56
55
  end
57
56
 
58
57
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: serviceproxy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Durham
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-10-25 00:00:00 -04:00
12
+ date: 2009-12-04 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -32,16 +32,6 @@ dependencies:
32
32
  - !ruby/object:Gem::Version
33
33
  version: "0"
34
34
  version:
35
- - !ruby/object:Gem::Dependency
36
- name: builder
37
- type: :runtime
38
- version_requirement:
39
- version_requirements: !ruby/object:Gem::Requirement
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- version: "0"
44
- version:
45
35
  description: Lightweight SOAP library for Ruby
46
36
  email: jeremydurham@gmail.com
47
37
  executables:
@@ -86,7 +76,7 @@ requirements: []
86
76
  rubyforge_project:
87
77
  rubygems_version: 1.3.5
88
78
  signing_key:
89
- specification_version: 2
79
+ specification_version: 3
90
80
  summary: Lightweight SOAP library for Ruby
91
81
  test_files: []
92
82