api_smith 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: df3babc28fceaa4b6bd725e787ca5411d1228aea
4
+ data.tar.gz: f860066f9884626fc3ae76005bcb62b47d10ff40
5
+ SHA512:
6
+ metadata.gz: 1789b731e5ccd56734d3849276717524adcf76a0429234004440dc9bcafece26a97591b897d6b90ad6ec0423fb016ccc99959cab447cfcef704a2fc7aaaa163b
7
+ data.tar.gz: 041ea42be2bed26c955feb162a3c667b3b07413bb2ec6fc5ae01299ba0af25fe4ef4edc91de35f2987690ef87275fdbcd47054b64928d141833ffa8c37d2b0f9
@@ -1,5 +1,4 @@
1
1
  require 'httparty'
2
- require 'net/http/persistent'
3
2
 
4
3
  module APISmith
5
4
 
@@ -112,9 +111,8 @@ module APISmith
112
111
  request_options[type] = merged_options_for(type, options)
113
112
  end
114
113
  # Finally, use HTTParty to get the response
115
- response = nil
116
- instrument_request method, full_path, options do
117
- response = self.class.send method, full_path, request_options
114
+ response = instrument_request method, full_path, options do
115
+ self.class.send method, full_path, request_options
118
116
  end
119
117
  # Pre-process the response to check for errors.
120
118
  check_response_errors response
@@ -326,26 +324,7 @@ module APISmith
326
324
  def endpoint(value = nil)
327
325
  define_method(:endpoint) { value }
328
326
  end
329
-
330
- # Allows you to set a given endpoint as persistnet, using Net::HTTP::Persistent.
331
- # @param [true,false] value when true, will be persisted. Otherwise, non-persistent.
332
- # @param [String] name the name for the client in Net::HTTP::Persistent
333
- # @example Making it persistent:
334
- # persistent
335
- # @example Persistent with a custom client name
336
- # persistent true, 'my-client'
337
- # @example Making it non-persistent
338
- # persistent false
339
- def persistent(value = true, name = 'api_smith')
340
- if value
341
- require 'api_smith/httparty_extensions'
342
- default_options[:persistent] ||= Net::HTTP::Persistent.new(name)
343
- else
344
- default_options[:persistent] = nil
345
- end
346
- end
347
-
348
327
  end
349
328
 
350
329
  end
351
- end
330
+ end
@@ -1,4 +1,4 @@
1
1
  module APISmith
2
2
  # The current version of API Smith
3
- VERSION = "1.2.0".freeze
4
- end
3
+ VERSION = "1.3.0".freeze
4
+ end
metadata CHANGED
@@ -1,160 +1,113 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: api_smith
3
- version: !ruby/object:Gem::Version
4
- hash: 31
5
- prerelease:
6
- segments:
7
- - 1
8
- - 2
9
- - 0
10
- version: 1.2.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.3.0
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - Darcy Laycock
14
8
  - Steve Webb
15
9
  autorequire:
16
10
  bindir: bin
17
11
  cert_chain: []
18
-
19
- date: 2012-02-16 00:00:00 Z
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
12
+ date: 2013-07-01 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
22
15
  name: httparty
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 0
32
- version: "0"
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - '>='
19
+ - !ruby/object:Gem::Version
20
+ version: '0'
33
21
  type: :runtime
34
- version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
36
- name: hashie
37
22
  prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
39
- none: false
40
- requirements:
41
- - - ~>
42
- - !ruby/object:Gem::Version
43
- hash: 15
44
- segments:
45
- - 1
46
- - 0
47
- version: "1.0"
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - '>='
26
+ - !ruby/object:Gem::Version
27
+ version: '0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: hashie
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - '>='
33
+ - !ruby/object:Gem::Version
34
+ version: '1.0'
35
+ - - <
36
+ - !ruby/object:Gem::Version
37
+ version: '3.0'
48
38
  type: :runtime
49
- version_requirements: *id002
50
- - !ruby/object:Gem::Dependency
51
- name: net-http-persistent
52
39
  prerelease: false
53
- requirement: &id003 !ruby/object:Gem::Requirement
54
- none: false
55
- requirements:
56
- - - ">="
57
- - !ruby/object:Gem::Version
58
- hash: 3
59
- segments:
60
- - 0
61
- version: "0"
62
- type: :runtime
63
- version_requirements: *id003
64
- - !ruby/object:Gem::Dependency
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - '>='
43
+ - !ruby/object:Gem::Version
44
+ version: '1.0'
45
+ - - <
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ - !ruby/object:Gem::Dependency
65
49
  name: rr
66
- prerelease: false
67
- requirement: &id004 !ruby/object:Gem::Requirement
68
- none: false
69
- requirements:
70
- - - ">="
71
- - !ruby/object:Gem::Version
72
- hash: 3
73
- segments:
74
- - 0
75
- version: "0"
50
+ requirement: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
76
55
  type: :development
77
- version_requirements: *id004
78
- - !ruby/object:Gem::Dependency
79
- name: rspec
80
56
  prerelease: false
81
- requirement: &id005 !ruby/object:Gem::Requirement
82
- none: false
83
- requirements:
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: rspec
64
+ requirement: !ruby/object:Gem::Requirement
65
+ requirements:
84
66
  - - ~>
85
- - !ruby/object:Gem::Version
86
- hash: 3
87
- segments:
88
- - 2
89
- - 0
90
- version: "2.0"
67
+ - !ruby/object:Gem::Version
68
+ version: '2.0'
91
69
  type: :development
92
- version_requirements: *id005
93
- - !ruby/object:Gem::Dependency
94
- name: fuubar
95
70
  prerelease: false
96
- requirement: &id006 !ruby/object:Gem::Requirement
97
- none: false
98
- requirements:
99
- - - ">="
100
- - !ruby/object:Gem::Version
101
- hash: 3
102
- segments:
103
- - 0
104
- version: "0"
105
- type: :development
106
- version_requirements: *id006
107
- description: APISmith provides tools to make working with structured HTTP-based apis even easier.
108
- email:
71
+ version_requirements: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: '2.0'
76
+ description: APISmith provides tools to make working with structured HTTP-based apis
77
+ even easier.
78
+ email:
109
79
  - sutto@thefrontiergroup.com.au
110
80
  executables: []
111
-
112
81
  extensions: []
113
-
114
82
  extra_rdoc_files: []
115
-
116
- files:
83
+ files:
117
84
  - lib/api_smith/base.rb
118
85
  - lib/api_smith/client.rb
119
- - lib/api_smith/httparty_extensions.rb
120
86
  - lib/api_smith/smash.rb
121
87
  - lib/api_smith/version.rb
122
88
  - lib/api_smith/web_mock_extensions.rb
123
89
  - lib/api_smith.rb
124
90
  homepage: http://github.com/thefrontiergroup
125
91
  licenses: []
126
-
92
+ metadata: {}
127
93
  post_install_message:
128
94
  rdoc_options: []
129
-
130
- require_paths:
95
+ require_paths:
131
96
  - lib
132
- required_ruby_version: !ruby/object:Gem::Requirement
133
- none: false
134
- requirements:
135
- - - ">="
136
- - !ruby/object:Gem::Version
137
- hash: 3
138
- segments:
139
- - 0
140
- version: "0"
141
- required_rubygems_version: !ruby/object:Gem::Requirement
142
- none: false
143
- requirements:
144
- - - ">="
145
- - !ruby/object:Gem::Version
146
- hash: 23
147
- segments:
148
- - 1
149
- - 3
150
- - 6
97
+ required_ruby_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ required_rubygems_version: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - '>='
105
+ - !ruby/object:Gem::Version
151
106
  version: 1.3.6
152
107
  requirements: []
153
-
154
108
  rubyforge_project:
155
- rubygems_version: 1.8.10
109
+ rubygems_version: 2.0.2
156
110
  signing_key:
157
- specification_version: 3
111
+ specification_version: 4
158
112
  summary: A simple layer on top of HTTParty for building API's
159
113
  test_files: []
160
-
@@ -1,23 +0,0 @@
1
- # Monkey patches HTTParty to accept persistent connections.
2
- module HTTParty
3
- class Request
4
-
5
- alias _original_http http
6
- def http
7
- options[:persistent] || _original_http
8
- end
9
-
10
- def perform
11
- validate
12
- setup_raw_request
13
- self.last_response = perform_inner_request
14
- handle_deflation
15
- handle_response
16
- end
17
-
18
- def perform_inner_request
19
- options[:persistent] ? http.request(uri, @raw_request) : http.request(@raw_request)
20
- end
21
-
22
- end
23
- end