lib/mergent/task.rb in mergent-0.1.1 vs lib/mergent/task.rb in mergent-0.1.2
- old
+ new
@@ -3,17 +3,19 @@
require_relative "client"
require_relative "object"
module Mergent
class Task < Mergent::Object
- def self.create(params = {})
- object = Client.post("tasks", params)
- new(object)
- end
+ ATTRS = %i[name description status request scheduled_for created_at].freeze
- %i[name description status request scheduled_for delay cron].each do |name|
+ ATTRS.each do |name|
define_method(name) do
- self[name]
+ @_data[name]
end
+ end
+
+ def self.create(params = {})
+ data = Client.post("tasks", params)
+ new(data)
end
end
end