Class: Fastly::Client::Curl

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

Overview

:nodoc: all

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(host, port = 80) ⇒ Curl

Returns a new instance of Curl.



105
106
107
108
109
# File 'lib/fastly/client.rb', line 105

def initialize(host, port=80)
    self.host     = host
    self.port     = port
    self.protocol = 'https'
end

Instance Attribute Details

#hostObject

Returns the value of attribute host.



103
104
105
# File 'lib/fastly/client.rb', line 103

def host
  @host
end

#portObject

Returns the value of attribute port.



103
104
105
# File 'lib/fastly/client.rb', line 103

def port
  @port
end

#protocolObject

Returns the value of attribute protocol.



103
104
105
# File 'lib/fastly/client.rb', line 103

def protocol
  @protocol
end

Instance Method Details

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



123
124
125
# File 'lib/fastly/client.rb', line 123

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

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



111
112
113
# File 'lib/fastly/client.rb', line 111

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

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



115
116
117
# File 'lib/fastly/client.rb', line 115

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

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



119
120
121
# File 'lib/fastly/client.rb', line 119

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

#use_ssl=(ssl) ⇒ Object



127
128
129
# File 'lib/fastly/client.rb', line 127

def use_ssl=(ssl)
    self.protocol = ssl ? 'https' : 'http'
end