Class: ThreeScale::Client::HTTPClient::BaseClient

Inherits:
Object
  • Object
show all
Defined in:
lib/3scale/client/http_client.rb

Direct Known Subclasses

NetHttp, NetHttpPersistent

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(host, port) ⇒ BaseClient

Returns a new instance of BaseClient.



37
38
39
40
# File 'lib/3scale/client/http_client.rb', line 37

def initialize(host, port)
  @host = host
  @port = port
end

Class Method Details

.available?Boolean

Returns:

  • (Boolean)


31
32
# File 'lib/3scale/client/http_client.rb', line 31

def self.available?
end

.prepareObject



34
35
# File 'lib/3scale/client/http_client.rb', line 34

def self.prepare
end

Instance Method Details

#get_request(path) ⇒ Object



42
43
44
45
46
47
# File 'lib/3scale/client/http_client.rb', line 42

def get_request(path)
  get = Net::HTTP::Get.new(path)
  get.add_field(*USER_CLIENT_HEADER)
  get.add_field('Host', @host)
  get
end

#post_request(path, payload) ⇒ Object



49
50
51
52
53
54
55
# File 'lib/3scale/client/http_client.rb', line 49

def post_request(path, payload)
  post = Net::HTTP::Post.new(path)
  post.add_field(*USER_CLIENT_HEADER)
  post.add_field('Host', @host)
  post.set_form_data(payload)
  post
end