Class: PlatformLib::TaskService

Inherits:
Object
  • Object
show all
Includes:
ServiceBase
Defined in:
lib/platform_lib/task_service.rb

Overview

Public: A wrapper around the Task Data Service

Examples:

# the preferred method 
service = PlatformLib::DataService.new("user", "pass").task_service

# direct instantiation
service = PlatformLib::TaskService.new("auth_token")

Constant Summary collapse

END_POINT =
"http://data.task.theplatform.com/task/data/Task"

Instance Method Summary collapse

Constructor Details

#initialize(auth_token) ⇒ TaskService

Public: Creates a new instance

auth_token - the authentication token to be used



24
25
26
# File 'lib/platform_lib/task_service.rb', line 24

def initialize(auth_token)
  @auth_token = auth_token
end

Instance Method Details

#get_task_items(params = {}, &block) ⇒ Object

Public: Queries the task end point

params - an optional hash of parameters (query string) block - an optional block to be called for each item returned

Examples:

items = task_service.get_task_items(range: "1-10")

task_service.get_task_items(byCustomValue: "{test}{val}") do |item|
  puts item.title
end

Returns the items supplied from the service



42
43
44
45
46
47
48
# File 'lib/platform_lib/task_service.rb', line 42

def get_task_items(params = {}, &block)
  if block.nil?
    get_entries(END_POINT, params)      
  else
    get_entries(END_POINT, params, &block)
  end
end