class Embulk::Input::SlackChannelMessages
Public Class Methods
resume(task, columns, count) { |task, columns, count| ... }
click to toggle source
# File lib/embulk/input/slack_channel_messages.rb, line 30 def self.resume(task, columns, count, &control) task_reports = yield(task, columns, count) next_config_diff = {} return next_config_diff end
transaction(config, &control)
click to toggle source
# File lib/embulk/input/slack_channel_messages.rb, line 18 def self.transaction(config, &control) # configuration code: task = { "token" => config.param("token", :string), "channel_ids" => config.param("channel_ids", :array), } columns = @@columns.map.with_index{ |column, index| Column.new(index, *column) } resume(task, columns, 1, &control) end
Public Instance Methods
init()
click to toggle source
TODO def self.guess(config)
sample_records = [ {"example"=>"a", "column"=>1, "value"=>0.1}, {"example"=>"a", "column"=>2, "value"=>0.2}, ] columns = Guess::SchemaGuess.from_hash_records(sample_records) return {"columns" => columns}
end
# File lib/embulk/input/slack_channel_messages.rb, line 47 def init @token = task["token"] @channel_ids = task["channel_ids"] @service = Slack::Service.new(@token) end
run()
click to toggle source
# File lib/embulk/input/slack_channel_messages.rb, line 53 def run @service.check_token @service.check_channels(@channel_ids) @channel_ids.each do |channel_id| @service.compose_record(channel_id) do |record| # ex) page_builder.add([<col1>, <col2>, <col3> ...]) page_builder.add(@@columns.map{|col| record[col[0]]}) end end page_builder.finish task_report = {} return task_report end