Class: Client

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Client

Returns a new instance of Client.



4
5
6
7
8
# File 'lib/icwot/client.rb', line 4

def initialize(options = {})
  @content_type = options[:content_type] || 'application/json'
  @uri = options[:uri]
  @port = options[:port]
end

Instance Attribute Details

#content_typeObject

Returns the value of attribute content_type.



2
3
4
# File 'lib/icwot/client.rb', line 2

def content_type
  @content_type
end

#portObject

Returns the value of attribute port.



2
3
4
# File 'lib/icwot/client.rb', line 2

def port
  @port
end

#uriObject

Returns the value of attribute uri.



2
3
4
# File 'lib/icwot/client.rb', line 2

def uri
  @uri
end

Instance Method Details

#to_sObject



14
15
16
17
18
19
20
21
# File 'lib/icwot/client.rb', line 14

def to_s
  case content_type
    when 'application/json'
      to_hash.to_json
    when 'application/xml'
      to_xml
  end
end