Class: Teamweek::Api::Client

Inherits:
Object
  • Object
show all
Includes:
Importer
Defined in:
lib/teamweek/api/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Importer

#bulk_import, #bulk_post, #bulk_uri

Constructor Details

#initialize(client, account_id, opts = {}) ⇒ Client

Returns a new instance of Client.



8
9
10
11
# File 'lib/teamweek/api/client.rb', line 8

def initialize(client, , opts={})
  @client = client
  set_base_uri(opts[:base_uri], )
end

Instance Attribute Details

#base_uriObject

Returns the value of attribute base_uri.



6
7
8
# File 'lib/teamweek/api/client.rb', line 6

def base_uri
  @base_uri
end

#clientObject

Returns the value of attribute client.



5
6
7
# File 'lib/teamweek/api/client.rb', line 5

def client
  @client
end

Instance Method Details

#import_projects(data) ⇒ Teamweek::Api::Project

Posts projects to Teamweek bulk_import url.

Parameters:

  • projects:

    an array of projects data as hash.

Returns:



25
26
27
# File 'lib/teamweek/api/client.rb', line 25

def import_projects(data)
  bulk_import('projects', data, Teamweek::Api::Project)
end

#import_tasks(data) ⇒ Teamweek::Api::Task

Posts tasks to Teamweek bulk_import url.

Parameters:

  • tasks:

    an array of tasks data as hash.

Returns:



33
34
35
# File 'lib/teamweek/api/client.rb', line 33

def import_tasks(data)
  bulk_import('tasks', data, Teamweek::Api::Task)
end

#import_users(data) ⇒ Teamweek::Api::User

Posts users to Teamweek bulk_import url.

Parameters:

  • users:

    an array of users data as hash.

Returns:



17
18
19
# File 'lib/teamweek/api/client.rb', line 17

def import_users(data)
  bulk_import('users', data, Teamweek::Api::User)
end