webmock_method 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/CHANGES +3 -0
- data/README.md +28 -0
- data/lib/webmock_method/render_helper.rb +2 -0
- data/lib/webmock_method/version.rb +1 -1
- data/lib/webmock_method/webmock_method.rb +0 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NDMzZjE3NDEyMTJmZWIyN2NkNTA4ZjgwOTdhNTlmMzJiZmQ1NTI3NA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MGY0M2M1YTc4M2JhMGFkNjNiZmQ5ZDYyYzRjNWUyYTFiYzI1ZTA2NA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZTJjZjkyMGRkMGQ1NzhhYzEyNWM2MTQwYTNjODYwNzc0ZGM2ZGVlMDViMGE1
|
10
|
+
OTZlOTdhODNlNzEyMTVmY2E2ZTljOGE2OGNlNWZjZjZhYjMwMTFhM2ViNjVm
|
11
|
+
OWU4YWVmMTdmY2FmZjZiNjc0MGVjMzcyMWE3MDc0OGIwMTk1MmE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NmUxYWJmZjc0OTI4YWUxNWE1NGVjMjUwYTYzNjJlZGRjNTNhMDI1ZmM4NjY1
|
14
|
+
NDcxMjExNzNhODc1MzdjNjgyMDc4NzA2YWNkZGQ1MTQ0MjNkYjRkNTU4NTVh
|
15
|
+
YjY4MzYxZDAwZTkzNGExNTlkZmQzYTdlYjI4YTc2MmU4ZTY3YTY=
|
data/CHANGES
CHANGED
data/README.md
CHANGED
@@ -102,6 +102,34 @@ gem. Currently it supports 2 formats only: **json** and **xml**. Here is example
|
|
102
102
|
}
|
103
103
|
```
|
104
104
|
|
105
|
+
You can tweak you response on the fly:
|
106
|
+
|
107
|
+
```ruby
|
108
|
+
webmock_method :purchase, [:amount, :credit_card], lambda { |binding|
|
109
|
+
RenderHelper.render :xml, "#{File.dirname(__FILE__)}/templates/purchase_response.xml.erb", binding
|
110
|
+
} do |parent, _, credit_card|
|
111
|
+
if credit_card.card_type == "VISA"
|
112
|
+
define_attribute(parent, :success, true)
|
113
|
+
else
|
114
|
+
define_attribute(parent, :success, false)
|
115
|
+
define_attribute(parent, :error_message, "Unsupported Credit Card Type")
|
116
|
+
end
|
117
|
+
end
|
118
|
+
```
|
119
|
+
|
120
|
+
and then, use new defined attributes, such as **success** and **error_message** inside your template:
|
121
|
+
|
122
|
+
```xml
|
123
|
+
<!-- stubs/templates/purchase_response.xml.erb -->
|
124
|
+
<PurchaseResponse>
|
125
|
+
<Success><%= success %></Success>
|
126
|
+
|
127
|
+
<% unless success %>
|
128
|
+
<ErrorMessage><%= error_message %></ErrorMessage>
|
129
|
+
<% end %>
|
130
|
+
</PurchaseResponse>
|
131
|
+
```
|
132
|
+
|
105
133
|
**url** parameter is optional. If you don't specify it, it will try to use **url** attribute defined
|
106
134
|
on your service or you can define **url** parameter for WebmockMethod:
|
107
135
|
|