Class: Fastly::Client::Curl

Inherits:
Object
  • Object
show all
Defined in:
lib/fastly/client/curl.rb

Overview

:nodoc: all

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uri) ⇒ Curl

Returns a new instance of Curl.



9
10
11
12
13
14
# File 'lib/fastly/client/curl.rb', line 9

def initialize(uri)
  @uri      = uri
  @host     = uri.host
  @port     = uri.port
  @protocol = uri.scheme
end

Instance Attribute Details

#hostObject

Returns the value of attribute host.



7
8
9
# File 'lib/fastly/client/curl.rb', line 7

def host
  @host
end

#portObject

Returns the value of attribute port.



7
8
9
# File 'lib/fastly/client/curl.rb', line 7

def port
  @port
end

#protocolObject

Returns the value of attribute protocol.



7
8
9
# File 'lib/fastly/client/curl.rb', line 7

def protocol
  @protocol
end

#uriObject

Returns the value of attribute uri.



7
8
9
# File 'lib/fastly/client/curl.rb', line 7

def uri
  @uri
end

Instance Method Details

#delete(path, headers = {}) ⇒ Object



46
47
48
49
50
51
52
53
54
# File 'lib/fastly/client/curl.rb', line 46

def delete(path, headers = {})
  CurbFu.delete({
                  host:     host,
                  port:     port,
                  path:     path,
                  headers:  headers,
                  protocol: protocol
                })
end

#get(path, headers = {}) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/fastly/client/curl.rb', line 16

def get(path, headers = {})
  CurbFu.get({
               host:     host,
               port:     port,
               path:     path,
               headers:  headers,
               protocol: protocol
             })
end

#post(path, params, headers = {}) ⇒ Object



26
27
28
29
30
31
32
33
34
# File 'lib/fastly/client/curl.rb', line 26

def post(path, params, headers = {})
  CurbFu.post({
                host:     host,
                port:     port,
                path:     path,
                headers:  headers,
                protocol: protocol
              }, params)
end

#put(path, params, headers = {}) ⇒ Object



36
37
38
39
40
41
42
43
44
# File 'lib/fastly/client/curl.rb', line 36

def put(path, params, headers = {})
  CurbFu.put({
               host:     host,
               port:     port,
               path:     path,
               headers:  headers,
               protocol: protocol
             }, params)
end