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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NDYzOWUwYzU1MTQ2NmUwM2Y0MzE2ZDBjYTFkMDgwYjAyZTQzNzFhYQ==
4
+ NDMzZjE3NDEyMTJmZWIyN2NkNTA4ZjgwOTdhNTlmMzJiZmQ1NTI3NA==
5
5
  data.tar.gz: !binary |-
6
- NTA2MDY5Y2VlZGE3ZjVhNjI4NmZkOGMwNjk5M2MwNzVmODA3NjgyNQ==
6
+ MGY0M2M1YTc4M2JhMGFkNjNiZmQ5ZDYyYzRjNWUyYTFiYzI1ZTA2NA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- YWJiMjQwNGNkNWI5ZGFhNDY4N2MyYTNhYWI3N2Q1N2RiNjc1ZjY1NDBkMmJl
10
- NmE0Y2FhOTAxMjc2YTZhNDE0NGQyMGFiZWViYjJmMGE0OWI1ZWU3OGVjZTdj
11
- Mjc0NzVjYWUwNTkxZDI4ZTZkZjM4NzE4YTRmNGM1NmJiYmJjMTM=
9
+ ZTJjZjkyMGRkMGQ1NzhhYzEyNWM2MTQwYTNjODYwNzc0ZGM2ZGVlMDViMGE1
10
+ OTZlOTdhODNlNzEyMTVmY2E2ZTljOGE2OGNlNWZjZjZhYjMwMTFhM2ViNjVm
11
+ OWU4YWVmMTdmY2FmZjZiNjc0MGVjMzcyMWE3MDc0OGIwMTk1MmE=
12
12
  data.tar.gz: !binary |-
13
- NzFmMWY2YmU1YTVmNTA0ZmNlOTJhZGFkZmQ4ZmYzMzAzZGUyMzU0MDkzMzEy
14
- NDVlN2ZiYWU3YzI1MGZhY2MzMmU4MTJkYWFiY2MxNDA1MGNjMmQyNWU1MGRk
15
- MDNjYmU3M2ZmMDYyYzMyNDU2NzAzNjNiODhiNTc0MjI2OTk2MWE=
13
+ NmUxYWJmZjc0OTI4YWUxNWE1NGVjMjUwYTYzNjJlZGRjNTNhMDI1ZmM4NjY1
14
+ NDcxMjExNzNhODc1MzdjNjgyMDc4NzA2YWNkZGQ1MTQ0MjNkYjRkNTU4NTVh
15
+ YjY4MzYxZDAwZTkzNGExNTlkZmQzYTdlYjI4YTc2MmU4ZTY3YTY=
data/CHANGES CHANGED
@@ -5,3 +5,6 @@
5
5
 
6
6
  * Initial release.
7
7
 
8
+ == Version 1.0.1
9
+
10
+ * Small bug fixes.
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
 
@@ -1,3 +1,5 @@
1
+ require 'erb'
2
+
1
3
  module RenderHelper
2
4
  extend self
3
5
 
@@ -1,3 +1,3 @@
1
1
  module WebmockMethod
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
@@ -1,5 +1,4 @@
1
1
  require 'webmock'
2
- require 'erb'
3
2
  require 'meta_methods/meta_methods'
4
3
 
5
4
  module WebmockMethod
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webmock_method
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Shvets