restafari 0.4 → 0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -11,8 +11,8 @@ module Restafari
11
11
  base_url: "",
12
12
  http_method: :post,
13
13
  scheme: :http,
14
- before_request: nil,
15
- after_response: nil
14
+ before_request: [],
15
+ after_response: []
16
16
  }
17
17
 
18
18
  define_singleton_method :defaults do
@@ -36,19 +36,23 @@ module Restafari
36
36
  end
37
37
 
38
38
  def before_request(&block)
39
- @before_request = block if block_given?
39
+ @defaults[:before_request] << block if block_given?
40
40
  end
41
41
 
42
42
  def after_response(&block)
43
- @after_response = block if block_given?
43
+ @defaults[:after_response] << block if block_given?
44
44
  end
45
45
 
46
46
  def run_before_request_hook(*params)
47
- @before_request.call(*params) unless @after_response.nil?
47
+ @defaults[:before_request].each do |hook|
48
+ hook.call(*params)
49
+ end
48
50
  end
49
51
 
50
52
  def run_after_response_hook(*params)
51
- @after_response.call(*params) unless @after_response.nil?
53
+ @defaults[:after_response].each do |hook|
54
+ hook.call(*params)
55
+ end
52
56
  end
53
57
 
54
58
  end
@@ -1,3 +1,3 @@
1
1
  module Restafari
2
- VERSION = 0.4
2
+ VERSION = 0.5
3
3
  end
metadata CHANGED
@@ -1,115 +1,89 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: restafari
3
- version: !ruby/object:Gem::Version
4
- hash: 3
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.5'
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 4
9
- version: "0.4"
10
6
  platform: ruby
11
- authors:
7
+ authors:
12
8
  - Danni Friedland
13
9
  autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
-
17
- date: 2012-05-29 00:00:00 Z
18
- dependencies:
19
- - !ruby/object:Gem::Dependency
12
+ date: 2012-05-29 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
20
15
  name: faraday
21
- prerelease: false
22
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &70155096119940 !ruby/object:Gem::Requirement
23
17
  none: false
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- hash: 3
28
- segments:
29
- - 0
30
- version: "0"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
31
22
  type: :runtime
32
- version_requirements: *id001
33
- - !ruby/object:Gem::Dependency
34
- name: webmock
35
23
  prerelease: false
36
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *70155096119940
25
+ - !ruby/object:Gem::Dependency
26
+ name: webmock
27
+ requirement: &70155096119380 !ruby/object:Gem::Requirement
37
28
  none: false
38
- requirements:
39
- - - ">="
40
- - !ruby/object:Gem::Version
41
- hash: 3
42
- segments:
43
- - 0
44
- version: "0"
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
45
33
  type: :development
46
- version_requirements: *id002
47
- - !ruby/object:Gem::Dependency
48
- name: spork
49
34
  prerelease: false
50
- requirement: &id003 !ruby/object:Gem::Requirement
35
+ version_requirements: *70155096119380
36
+ - !ruby/object:Gem::Dependency
37
+ name: spork
38
+ requirement: &70155096118760 !ruby/object:Gem::Requirement
51
39
  none: false
52
- requirements:
53
- - - ">="
54
- - !ruby/object:Gem::Version
55
- hash: 3
56
- segments:
57
- - 0
58
- version: "0"
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
59
44
  type: :development
60
- version_requirements: *id003
61
- - !ruby/object:Gem::Dependency
62
- name: rack-test
63
45
  prerelease: false
64
- requirement: &id004 !ruby/object:Gem::Requirement
46
+ version_requirements: *70155096118760
47
+ - !ruby/object:Gem::Dependency
48
+ name: rack-test
49
+ requirement: &70155096118020 !ruby/object:Gem::Requirement
65
50
  none: false
66
- requirements:
67
- - - ">="
68
- - !ruby/object:Gem::Version
69
- hash: 3
70
- segments:
71
- - 0
72
- version: "0"
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
73
55
  type: :development
74
- version_requirements: *id004
75
- - !ruby/object:Gem::Dependency
76
- name: rspec
77
56
  prerelease: false
78
- requirement: &id005 !ruby/object:Gem::Requirement
57
+ version_requirements: *70155096118020
58
+ - !ruby/object:Gem::Dependency
59
+ name: rspec
60
+ requirement: &70155096117260 !ruby/object:Gem::Requirement
79
61
  none: false
80
- requirements:
81
- - - ">="
82
- - !ruby/object:Gem::Version
83
- hash: 3
84
- segments:
85
- - 0
86
- version: "0"
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
87
66
  type: :development
88
- version_requirements: *id005
89
- - !ruby/object:Gem::Dependency
90
- name: rake
91
67
  prerelease: false
92
- requirement: &id006 !ruby/object:Gem::Requirement
68
+ version_requirements: *70155096117260
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: &70155096116560 !ruby/object:Gem::Requirement
93
72
  none: false
94
- requirements:
95
- - - ">="
96
- - !ruby/object:Gem::Version
97
- hash: 3
98
- segments:
99
- - 0
100
- version: "0"
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
101
77
  type: :development
102
- version_requirements: *id006
78
+ prerelease: false
79
+ version_requirements: *70155096116560
103
80
  description: Helper class to work with the restful apis
104
- email:
81
+ email:
105
82
  - - dannifriedland@gmail.com
106
83
  executables: []
107
-
108
84
  extensions: []
109
-
110
85
  extra_rdoc_files: []
111
-
112
- files:
86
+ files:
113
87
  - .gemspec
114
88
  - .gitignore
115
89
  - Gemfile
@@ -126,36 +100,26 @@ files:
126
100
  - spec/spec_helper.rb
127
101
  homepage: https://github.com/TheGiftsProject/restafari
128
102
  licenses: []
129
-
130
103
  post_install_message:
131
104
  rdoc_options: []
132
-
133
- require_paths:
105
+ require_paths:
134
106
  - lib
135
- required_ruby_version: !ruby/object:Gem::Requirement
107
+ required_ruby_version: !ruby/object:Gem::Requirement
136
108
  none: false
137
- requirements:
138
- - - ">="
139
- - !ruby/object:Gem::Version
140
- hash: 3
141
- segments:
142
- - 0
143
- version: "0"
144
- required_rubygems_version: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - ! '>='
111
+ - !ruby/object:Gem::Version
112
+ version: '0'
113
+ required_rubygems_version: !ruby/object:Gem::Requirement
145
114
  none: false
146
- requirements:
147
- - - ">="
148
- - !ruby/object:Gem::Version
149
- hash: 3
150
- segments:
151
- - 0
152
- version: "0"
115
+ requirements:
116
+ - - ! '>='
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
153
119
  requirements: []
154
-
155
120
  rubyforge_project:
156
- rubygems_version: 1.8.13
121
+ rubygems_version: 1.8.10
157
122
  signing_key:
158
123
  specification_version: 3
159
124
  summary: A DSL for consuming RESTful apis
160
125
  test_files: []
161
-