Class: TreasureData::Schedule

Inherits:
Model
  • Object
show all
Defined in:
lib/td/client/model.rb

Instance Attribute Summary collapse

Attributes inherited from Model

#client

Instance Method Summary collapse

Constructor Details

#initialize(client, name, cron, query, database = nil, result_url = nil, timezone = nil, delay = nil, next_time = nil, priority = nil, retry_limit = nil, org_name = nil) ⇒ Schedule

Returns a new instance of Schedule.

Parameters:

  • client (TreasureData::Client)
  • name (String)
  • cron (String)
  • query (String)
  • database (Fixnum) (defaults to: nil)
  • result_url (String) (defaults to: nil)
  • timezone (String) (defaults to: nil)
  • delay (String) (defaults to: nil)
  • next_time (String) (defaults to: nil)
  • priority (String) (defaults to: nil)
  • retry_limit (String) (defaults to: nil)
  • org_name (String) (defaults to: nil)


693
694
695
696
697
698
699
700
701
702
703
704
705
706
# File 'lib/td/client/model.rb', line 693

def initialize(client, name, cron, query, database=nil, result_url=nil, timezone=nil, delay=nil, next_time=nil,
               priority=nil, retry_limit=nil, org_name=nil)
  super(client)
  @name = name
  @cron = cron
  @query = query
  @database = database
  @result_url = result_url
  @timezone = timezone
  @delay = delay
  @next_time = next_time
  @priority = priority
  @retry_limit = retry_limit
end

Instance Attribute Details

#cronObject (readonly)



717
# File 'lib/td/client/model.rb', line 717

attr_reader :name, :cron, :query, :database, :result_url, :timezone, :delay, :priority, :retry_limit, :org_name

#databaseObject (readonly)



717
# File 'lib/td/client/model.rb', line 717

attr_reader :name, :cron, :query, :database, :result_url, :timezone, :delay, :priority, :retry_limit, :org_name

#delayObject (readonly)



717
# File 'lib/td/client/model.rb', line 717

attr_reader :name, :cron, :query, :database, :result_url, :timezone, :delay, :priority, :retry_limit, :org_name

#nameObject (readonly)



717
718
719
# File 'lib/td/client/model.rb', line 717

def name
  @name
end

#org_nameObject (readonly)

Returns the value of attribute org_name.



717
# File 'lib/td/client/model.rb', line 717

attr_reader :name, :cron, :query, :database, :result_url, :timezone, :delay, :priority, :retry_limit, :org_name

#priorityObject (readonly)



717
# File 'lib/td/client/model.rb', line 717

attr_reader :name, :cron, :query, :database, :result_url, :timezone, :delay, :priority, :retry_limit, :org_name

#queryObject (readonly)



717
# File 'lib/td/client/model.rb', line 717

attr_reader :name, :cron, :query, :database, :result_url, :timezone, :delay, :priority, :retry_limit, :org_name

#result_urlObject (readonly)



717
# File 'lib/td/client/model.rb', line 717

attr_reader :name, :cron, :query, :database, :result_url, :timezone, :delay, :priority, :retry_limit, :org_name

#retry_limitObject (readonly)



717
# File 'lib/td/client/model.rb', line 717

attr_reader :name, :cron, :query, :database, :result_url, :timezone, :delay, :priority, :retry_limit, :org_name

#timezoneObject (readonly)

Returns the value of attribute timezone.



717
718
719
# File 'lib/td/client/model.rb', line 717

def timezone
  @timezone
end

Instance Method Details

#next_timeTime?

Returns:

  • (Time, nil)


720
721
722
# File 'lib/td/client/model.rb', line 720

def next_time
  @next_time ? Time.parse(@next_time) : nil
end

#run(time, num) ⇒ Array

Parameters:

  • time (String)
  • num (Fixnum)

Returns:

  • (Array)


727
728
729
# File 'lib/td/client/model.rb', line 727

def run(time, num)
  @client.run_schedule(@name, time, num)
end