Class: TableauServerClient::Resources::Connection

Inherits:
Resource
  • Object
show all
Defined in:
lib/tableau_server_client/resources/connection.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Resource

attr_reader, attributes, #attributes, #delete!, extract_attributes, extract_site_path, #initialize, location, #location, #path, plural_resource_name, resource_name, #server_url, #site_id, #site_path

Methods included from TableauServerClient::RequestBuilder

#build_request

Constructor Details

This class inherits a constructor from TableauServerClient::Resources::Resource

Instance Attribute Details

#embed_passwordObject

Returns the value of attribute embed_password.



8
9
10
# File 'lib/tableau_server_client/resources/connection.rb', line 8

def embed_password
  @embed_password
end

#idObject (readonly)

Returns the value of attribute id.



8
9
10
# File 'lib/tableau_server_client/resources/connection.rb', line 8

def id
  @id
end

#passwordObject

Returns the value of attribute password.



8
9
10
# File 'lib/tableau_server_client/resources/connection.rb', line 8

def password
  @password
end

#server_addressObject (readonly)

Returns the value of attribute server_address.



8
9
10
# File 'lib/tableau_server_client/resources/connection.rb', line 8

def server_address
  @server_address
end

#server_portObject (readonly)

Returns the value of attribute server_port.



8
9
10
# File 'lib/tableau_server_client/resources/connection.rb', line 8

def server_port
  @server_port
end

#typeObject (readonly)

Returns the value of attribute type.



8
9
10
# File 'lib/tableau_server_client/resources/connection.rb', line 8

def type
  @type
end

#user_nameObject

Returns the value of attribute user_name.



8
9
10
# File 'lib/tableau_server_client/resources/connection.rb', line 8

def user_name
  @user_name
end

Class Method Details

.from_collection_response(client, path, xml) ⇒ Object



16
17
18
19
20
21
# File 'lib/tableau_server_client/resources/connection.rb', line 16

def self.from_collection_response(client, path, xml)
  xml.xpath("//xmlns:connections/xmlns:connection").each do |s|
    id = s['id']
    yield from_response(client, "#{path}/#{id}", s)
  end
end

.from_response(client, path, xml) ⇒ Object



11
12
13
14
# File 'lib/tableau_server_client/resources/connection.rb', line 11

def self.from_response(client, path, xml)
  attrs = extract_attributes(xml)
  new(client, path, attrs)
end

Instance Method Details

#to_requestObject



23
24
25
26
27
28
# File 'lib/tableau_server_client/resources/connection.rb', line 23

def to_request
  request = build_request {|b|
    b.connection(serverAddress: server_address, serverPort: server_port,
                 userName: user_name, password: password, embedPassword: embed_password)
  }
end

#update!Object



30
31
32
# File 'lib/tableau_server_client/resources/connection.rb', line 30

def update!
  @client.update self
end