Class: HttpMimic::Client
- Inherits:
-
Object
- Object
- HttpMimic::Client
- Defined in:
- lib/http_mimic/client.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
-
#default_options ⇒ Object
Returns the value of attribute default_options.
Instance Method Summary collapse
- #delete(url, options = {}) ⇒ Object
- #get(url, options = {}) ⇒ Object
- #head(url, options = {}) ⇒ Object
-
#initialize(options = {}, config = nil) ⇒ Client
constructor
A new instance of Client.
- #options(url, options = {}) ⇒ Object
- #patch(url, options = {}) ⇒ Object
- #post(url, options = {}) ⇒ Object
- #put(url, options = {}) ⇒ Object
- #request(method, url, options = {}) ⇒ Object
Constructor Details
#initialize(options = {}, config = nil) ⇒ Client
Returns a new instance of Client.
7 8 9 10 |
# File 'lib/http_mimic/client.rb', line 7 def initialize( = {}, config = nil) @default_options = .dup @config = config || HttpMimic.configuration.dup end |
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
5 6 7 |
# File 'lib/http_mimic/client.rb', line 5 def config @config end |
#default_options ⇒ Object
Returns the value of attribute default_options.
5 6 7 |
# File 'lib/http_mimic/client.rb', line 5 def @default_options end |
Instance Method Details
#delete(url, options = {}) ⇒ Object
28 29 30 |
# File 'lib/http_mimic/client.rb', line 28 def delete(url, = {}) request(:delete, url, ) end |
#get(url, options = {}) ⇒ Object
12 13 14 |
# File 'lib/http_mimic/client.rb', line 12 def get(url, = {}) request(:get, url, ) end |
#head(url, options = {}) ⇒ Object
32 33 34 |
# File 'lib/http_mimic/client.rb', line 32 def head(url, = {}) request(:head, url, ) end |
#options(url, options = {}) ⇒ Object
36 37 38 |
# File 'lib/http_mimic/client.rb', line 36 def (url, = {}) request(:options, url, ) end |
#patch(url, options = {}) ⇒ Object
24 25 26 |
# File 'lib/http_mimic/client.rb', line 24 def patch(url, = {}) request(:patch, url, ) end |
#post(url, options = {}) ⇒ Object
16 17 18 |
# File 'lib/http_mimic/client.rb', line 16 def post(url, = {}) request(:post, url, ) end |
#put(url, options = {}) ⇒ Object
20 21 22 |
# File 'lib/http_mimic/client.rb', line 20 def put(url, = {}) request(:put, url, ) end |