Class: TableauServerClient::Resources::ExtractRefresh

Inherits:
Resource
  • Object
show all
Defined in:
lib/tableau_server_client/resources/extract_refresh.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, resource_name, #site_path

Methods included from TableauServerClient::RequestBuilder

#build_request

Constructor Details

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

Instance Attribute Details

#consecutive_failed_countObject (readonly)

Returns the value of attribute consecutive_failed_count.



10
11
12
# File 'lib/tableau_server_client/resources/extract_refresh.rb', line 10

def consecutive_failed_count
  @consecutive_failed_count
end

#idObject (readonly)

Returns the value of attribute id.



10
11
12
# File 'lib/tableau_server_client/resources/extract_refresh.rb', line 10

def id
  @id
end

#priorityObject (readonly)

Returns the value of attribute priority.



10
11
12
# File 'lib/tableau_server_client/resources/extract_refresh.rb', line 10

def priority
  @priority
end

#typeObject (readonly)

Returns the value of attribute type.



10
11
12
# File 'lib/tableau_server_client/resources/extract_refresh.rb', line 10

def type
  @type
end

Class Method Details

.from_collection_response(client, path, xml) ⇒ Object



20
21
22
23
24
25
# File 'lib/tableau_server_client/resources/extract_refresh.rb', line 20

def self.from_collection_response(client, path, xml)
  xml.xpath("//xmlns:tasks/xmlns:task/xmlns:extractRefresh").each do |s|
    id = s.xpath("@id").first.value
    yield from_response(client, "#{path}/#{id}", s)
  end
end

.from_response(client, path, xml) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/tableau_server_client/resources/extract_refresh.rb', line 12

def self.from_response(client, path, xml)
  attrs = extract_attributes(xml)
  attrs['schedule_id'] = xml.xpath("xmlns:schedule/@id").first.value
  attrs['workbook_id'] = xml.xpath("xmlns:workbook/@id").first&.value
  attrs['datasource_id'] = xml.xpath("xmlns:datasource/@id").first&.value
  new(client, path, attrs)
end

.plural_resource_nameObject



27
28
29
# File 'lib/tableau_server_client/resources/extract_refresh.rb', line 27

def self.plural_resource_name
  "extractRefreshes"
end

Instance Method Details

#datasource_idObject



39
40
41
# File 'lib/tableau_server_client/resources/extract_refresh.rb', line 39

def datasource_id
  @datasource_id
end

#run_nowObject



47
48
49
50
51
# File 'lib/tableau_server_client/resources/extract_refresh.rb', line 47

def run_now
  resp = @client.create(self, path: "#{path}/runNow", request: build_request {})
  job_id = resp.xpath("//xmlns:job/@id").first.value
  Job.from_response(@client, Job.location(site_path, id = job_id).path, resp)
end

#scheduleObject



43
44
45
# File 'lib/tableau_server_client/resources/extract_refresh.rb', line 43

def schedule
  @client.get_collection(Resources::Schedule.location(nil)).first {|s| s.id == schedule_id }
end

#schedule_idObject



31
32
33
# File 'lib/tableau_server_client/resources/extract_refresh.rb', line 31

def schedule_id
  @schedule_id
end

#workbook_idObject



35
36
37
# File 'lib/tableau_server_client/resources/extract_refresh.rb', line 35

def workbook_id
  @workbook_id
end