savon_model 0.4.2 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,10 +1,11 @@
1
- Savon::Model
1
+ Savon::Model [![Build Status](http://travis-ci.org/rubiii/savon_model.png)](http://travis-ci.org/rubiii/savon_model)
2
2
  ============
3
3
 
4
4
  Model for SOAP service oriented applications.
5
5
 
6
6
  [Bugs](http://github.com/rubiii/savon_model/issues) | [Docs](http://rubydoc.info/gems/savon_model/frames)
7
7
 
8
+
8
9
  Installation
9
10
  ------------
10
11
 
@@ -12,6 +13,7 @@ The gem is available through [Rubygems](http://rubygems.org/gems/savon_model) an
12
13
 
13
14
  $ gem install savon_model
14
15
 
16
+
15
17
  Getting started
16
18
  ---------------
17
19
 
@@ -22,21 +24,25 @@ Getting started
22
24
  http.headers["Pragma"] = "no-cache"
23
25
  end
24
26
 
25
- endpoint "http://example.com/users" [2]
26
- namespace "http://v1.example.com/users" [3]
27
+ document "http://example.com/users?wsdl" [2]
28
+
29
+ endpoint "http://example.com/users" [3]
30
+ namespace "http://v1.example.com/users" [4]
27
31
 
28
- actions :get_user, :get_all_users [4]
32
+ basic_auth "login", "password" [5]
33
+
34
+ actions :get_user, :get_all_users [6]
29
35
 
30
36
  def self.all
31
- get_all_users.to_array [5]
37
+ get_all_users.to_array [7]
32
38
  end
33
39
 
34
40
  def self.find(id)
35
- get_user(:id => id).to_hash [6]
41
+ get_user(:id => id).to_hash [8]
36
42
  end
37
43
 
38
44
  def self.delete(id)
39
- client.request(:delete_user) do [7]
45
+ client.request(:delete_user) do [9]
40
46
  soap.body = { :id => 1 }
41
47
  end.to_hash
42
48
  end
@@ -46,17 +52,20 @@ Getting started
46
52
  The `client` method memoizes a `Savon::Client` instance, so you need to call this method before
47
53
  it gets called by any other method.
48
54
 
49
- 2. Sets the SOAP endpoint.
55
+ 2. Sets the WSDL document.
56
+
57
+ 3. Sets the SOAP endpoint.
58
+ 4. Sets the target namespace.
50
59
 
51
- 3. Sets the SOAP namespace.
60
+ 5. Sets basic auth credentials.
52
61
 
53
- 4. Specifies the SOAP actions provided by the service. This method dynamically creates both class
62
+ 6. Specifies the SOAP actions provided by the service. This method dynamically creates both class
54
63
  and instance methods named after the arguments. These methods accept an optional SOAP body Hash
55
64
  or XML String to be passed to the `Savon::Client` instance.
56
65
 
57
- 5. `User.all` calls the `get_all_users` SOAP action and returns a `Savon::Response`.
66
+ 7. `User.all` calls the `get_all_users` SOAP action and returns a `Savon::Response`.
58
67
 
59
- 6. `User.find` calls the `get_user` SOAP action with a SOAP body Hash and returns a `Savon::Response`.
68
+ 8. `User.find` calls the `get_user` SOAP action with a SOAP body Hash and returns a `Savon::Response`.
60
69
 
61
- 7. This is an example of what happens "behind the scenes" on [6]. You can always use the `client`
70
+ 9. This is an example of what happens "behind the scenes" on [6]. You can always use the `client`
62
71
  method to directly access and use the `Savon::Client` instance.
@@ -66,6 +66,14 @@ module Savon
66
66
  def endpoint(uri)
67
67
  client.wsdl.endpoint = uri
68
68
  end
69
+
70
+ def document(uri)
71
+ client.wsdl.document = uri
72
+ end
73
+
74
+ def basic_auth(login, password)
75
+ client.http.auth.basic login, password
76
+ end
69
77
 
70
78
  def namespace(uri)
71
79
  client.wsdl.namespace = uri
@@ -84,6 +92,14 @@ module Savon
84
92
  def endpoint(uri)
85
93
  self.class.endpoint uri
86
94
  end
95
+
96
+ def document(uri)
97
+ self.class.document uri
98
+ end
99
+
100
+ def basic_auth(login, password)
101
+ self.class.basic_auth login, password
102
+ end
87
103
 
88
104
  def namespace(uri)
89
105
  self.class.namespace uri
@@ -1,7 +1,7 @@
1
1
  module Savon
2
2
  module Model
3
3
 
4
- VERSION = "0.4.2"
4
+ VERSION = "1.0.0"
5
5
 
6
6
  end
7
7
  end
@@ -4,21 +4,22 @@ $:.unshift lib unless $:.include?(lib)
4
4
  require "savon/model_version"
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = "savon_model"
8
- s.version = Savon::Model::VERSION
9
- s.authors = "Daniel Harrington"
10
- s.email = "me@rubiii.com"
11
- s.homepage = "http://github.com/rubiii/#{s.name}"
12
- s.summary = "SOAP model"
7
+ s.name = "savon_model"
8
+ s.version = Savon::Model::VERSION
9
+ s.authors = "Daniel Harrington"
10
+ s.email = "me@rubiii.com"
11
+ s.homepage = "http://github.com/rubiii/#{s.name}"
12
+ s.summary = "SOAP model"
13
13
  s.description = "Model for SOAP service oriented applications."
14
14
 
15
15
  s.rubyforge_project = s.name
16
16
 
17
+ s.add_dependency "httpi", ">= 0.7.8"
17
18
  s.add_dependency "savon", ">= 0.8.2"
18
19
 
19
20
  s.add_development_dependency "rspec", "~> 2.4.0"
20
- s.add_development_dependency "autotest"
21
21
  s.add_development_dependency "mocha", "~> 0.9.8"
22
+ s.add_development_dependency "autotest"
22
23
 
23
24
  s.files = `git ls-files`.split("\n")
24
25
  s.require_path = "lib"
@@ -30,6 +30,20 @@ describe Savon::Model do
30
30
  end
31
31
  end
32
32
 
33
+ describe ".document" do
34
+ it "should set WSDL document" do
35
+ model.document "http://example.com/?wsdl"
36
+ model.client.wsdl.document.should == "http://example.com/?wsdl"
37
+ end
38
+ end
39
+
40
+ describe ".basic_auth" do
41
+ it "should set HTTP Basic auth credentials" do
42
+ model.basic_auth "login", "password"
43
+ puts model.client.http.auth.basic.should == ["login", "password"]
44
+ end
45
+ end
46
+
33
47
  describe ".namespace" do
34
48
  it "should set the target namespace" do
35
49
  model.namespace "http://v1.example.com"
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: savon_model
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
+ - 1
7
8
  - 0
8
- - 4
9
- - 2
10
- version: 0.4.2
9
+ - 0
10
+ version: 1.0.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Daniel Harrington
@@ -15,53 +15,54 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-05-17 00:00:00 +02:00
19
- default_executable:
18
+ date: 2011-07-24 00:00:00 Z
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
- name: savon
21
+ name: httpi
23
22
  prerelease: false
24
23
  requirement: &id001 !ruby/object:Gem::Requirement
25
24
  none: false
26
25
  requirements:
27
26
  - - ">="
28
27
  - !ruby/object:Gem::Version
29
- hash: 59
28
+ hash: 19
30
29
  segments:
31
30
  - 0
31
+ - 7
32
32
  - 8
33
- - 2
34
- version: 0.8.2
33
+ version: 0.7.8
35
34
  type: :runtime
36
35
  version_requirements: *id001
37
36
  - !ruby/object:Gem::Dependency
38
- name: rspec
37
+ name: savon
39
38
  prerelease: false
40
39
  requirement: &id002 !ruby/object:Gem::Requirement
41
40
  none: false
42
41
  requirements:
43
- - - ~>
42
+ - - ">="
44
43
  - !ruby/object:Gem::Version
45
- hash: 31
44
+ hash: 59
46
45
  segments:
47
- - 2
48
- - 4
49
46
  - 0
50
- version: 2.4.0
51
- type: :development
47
+ - 8
48
+ - 2
49
+ version: 0.8.2
50
+ type: :runtime
52
51
  version_requirements: *id002
53
52
  - !ruby/object:Gem::Dependency
54
- name: autotest
53
+ name: rspec
55
54
  prerelease: false
56
55
  requirement: &id003 !ruby/object:Gem::Requirement
57
56
  none: false
58
57
  requirements:
59
- - - ">="
58
+ - - ~>
60
59
  - !ruby/object:Gem::Version
61
- hash: 3
60
+ hash: 31
62
61
  segments:
62
+ - 2
63
+ - 4
63
64
  - 0
64
- version: "0"
65
+ version: 2.4.0
65
66
  type: :development
66
67
  version_requirements: *id003
67
68
  - !ruby/object:Gem::Dependency
@@ -80,6 +81,20 @@ dependencies:
80
81
  version: 0.9.8
81
82
  type: :development
82
83
  version_requirements: *id004
84
+ - !ruby/object:Gem::Dependency
85
+ name: autotest
86
+ prerelease: false
87
+ requirement: &id005 !ruby/object:Gem::Requirement
88
+ none: false
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ hash: 3
93
+ segments:
94
+ - 0
95
+ version: "0"
96
+ type: :development
97
+ version_requirements: *id005
83
98
  description: Model for SOAP service oriented applications.
84
99
  email: me@rubiii.com
85
100
  executables: []
@@ -101,7 +116,6 @@ files:
101
116
  - savon_model.gemspec
102
117
  - spec/savon/model_spec.rb
103
118
  - spec/spec_helper.rb
104
- has_rdoc: true
105
119
  homepage: http://github.com/rubiii/savon_model
106
120
  licenses: []
107
121
 
@@ -131,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
131
145
  requirements: []
132
146
 
133
147
  rubyforge_project: savon_model
134
- rubygems_version: 1.4.1
148
+ rubygems_version: 1.8.5
135
149
  signing_key:
136
150
  specification_version: 3
137
151
  summary: SOAP model