active_collab 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MTAwYjdjMzI0Zjc2MTdhMTIzNDBlYjM2MjQ1ZmQyNzU3YTk1YTE1Yg==
5
+ data.tar.gz: !binary |-
6
+ ZTI5YTcxZGMwYjE2NmQ1NGUzZDBlYzQyMjcwNDU5NWE0MDBkYTRmMg==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ YzUyMjRjMzI4MzQ4ZTE4NDE3YzAxM2M4ZjBjYjM4NjQ5ZGE5ZTlhMzMyMmU0
10
+ ZWM3MzFiNzAwNDRjNmFkY2Y1ZGZjZTFlNDFjMjQwNzFjYmNkYzI2YTg5MWI2
11
+ ZjgyNmYwYzMxNGQ3ODAwYzU0MTQ1OTY2NGI4MWFkMzg4MGZmOWM=
12
+ data.tar.gz: !binary |-
13
+ Mjg0YzU5ZWUyZjgyOWViMDczZGQ5YzJlNDYzOWJjMDFjMzY0ZjA1ZTY0OGM2
14
+ OTFhMDhlNWYzM2UwOTBjNmY2MTVmMzRlOTBkMmY1N2Q2Mjk3MWNhYzczMzZj
15
+ MDJiZTAyMTExNTIyOWZhNDRjYzBjY2E4OTIyY2ZhN2JiOGE3Y2I=
data/README.md CHANGED
@@ -22,7 +22,7 @@ Or install it yourself as:
22
22
  ```ruby
23
23
  require 'active_collab'
24
24
 
25
- #creating a client
25
+ #create a client
26
26
  url = "http://myactivecollabinstance.com/api.php"
27
27
  api_key = MY_API_KEY
28
28
  client = ActiveCollab::Client.new(url,api_key)
@@ -30,8 +30,14 @@ client = ActiveCollab::Client.new(url,api_key)
30
30
  #listing projects
31
31
  projects = client.projects
32
32
 
33
- #listing tasks
34
- tasks = client.tasks
33
+ #listing tasks for project_id = 1
34
+ tasks = client.tasks(1)
35
+
36
+ #listing categories for project_id = 1
37
+ tasks = client.categories(1)
38
+
39
+ #creating a tsk for project_id = 1
40
+ task = client.add_task(1, {"name": "New task", "body": "New task description."})
35
41
 
36
42
  ```
37
43
 
@@ -4,6 +4,7 @@ require 'active_collab/api/projects'
4
4
  require 'active_collab/api/tasks'
5
5
  require 'active_collab/api/time_records'
6
6
  require 'active_collab/api/users'
7
+ require 'active_collab/api/categories'
7
8
 
8
9
  module ActiveCollab
9
10
  class Client
@@ -12,6 +13,7 @@ module ActiveCollab
12
13
  include ActiveCollab::API::Tasks
13
14
  include ActiveCollab::API::TimeRecords
14
15
  include ActiveCollab::API::Users
16
+ include ActiveCollab::API::Categories
15
17
 
16
18
  def initialize(url, api_key)
17
19
  @api_url = url
@@ -0,0 +1,18 @@
1
+ require 'active_collab/categorie'
2
+ module ActiveCollab
3
+ module API
4
+ module Categories
5
+
6
+ def categories(project_id)
7
+ url = "#{@api_url}?path_info=/projects/#{project_id}/tasks/categories&auth_api_token=#{@api_key}"
8
+ response = HTTParty.get(url)
9
+ response_categories = response["categories"].first[1]
10
+ categories = response_categories.collect do |c|
11
+ ActiveCollab::Categorie.from_hash(c)
12
+ end
13
+ categories
14
+ end
15
+
16
+ end
17
+ end
18
+ end
@@ -18,6 +18,13 @@ module ActiveCollab
18
18
  tasks
19
19
  end
20
20
 
21
+ def add_task(project_id, task_options = {})
22
+ url = "#{@api_url}?path_info=/projects/#{project_id}/tasks/add&auth_api_token=#{@api_key}"
23
+ options = { body: {task: task_options, submitted: 'submitted'} }
24
+ response = HTTParty.post(url, options)
25
+ ActiveCollab::Task.from_hash(response["task"])
26
+ end
27
+
21
28
  end
22
29
  end
23
30
  end
@@ -0,0 +1,11 @@
1
+ class ActiveCollab::Categorie
2
+ attr_accessor :id, :name
3
+
4
+ def self.from_hash(hash)
5
+ categorie = ActiveCollab::Categorie.new
6
+ categorie.id = hash["id"].to_i
7
+ categorie.name = hash["name"]
8
+ categorie
9
+ end
10
+
11
+ end
@@ -1,3 +1,3 @@
1
1
  module ActiveCollab
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_collab
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
5
- prerelease:
4
+ version: 0.0.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - Marcos Beirigo
@@ -10,12 +9,11 @@ authors:
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2012-11-28 00:00:00.000000000 Z
12
+ date: 2014-06-09 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: httparty
17
16
  requirement: !ruby/object:Gem::Requirement
18
- none: false
19
17
  requirements:
20
18
  - - ! '>='
21
19
  - !ruby/object:Gem::Version
@@ -23,7 +21,6 @@ dependencies:
23
21
  type: :runtime
24
22
  prerelease: false
25
23
  version_requirements: !ruby/object:Gem::Requirement
26
- none: false
27
24
  requirements:
28
25
  - - ! '>='
29
26
  - !ruby/object:Gem::Version
@@ -44,10 +41,12 @@ files:
44
41
  - Rakefile
45
42
  - active_collab.gemspec
46
43
  - lib/active_collab.rb
44
+ - lib/active_collab/api/categories.rb
47
45
  - lib/active_collab/api/projects.rb
48
46
  - lib/active_collab/api/tasks.rb
49
47
  - lib/active_collab/api/time_records.rb
50
48
  - lib/active_collab/api/users.rb
49
+ - lib/active_collab/categorie.rb
51
50
  - lib/active_collab/project.rb
52
51
  - lib/active_collab/task.rb
53
52
  - lib/active_collab/time_record.rb
@@ -55,26 +54,25 @@ files:
55
54
  - lib/active_collab/version.rb
56
55
  homepage: https://github.com/jera/active_collab
57
56
  licenses: []
57
+ metadata: {}
58
58
  post_install_message:
59
59
  rdoc_options: []
60
60
  require_paths:
61
61
  - lib
62
62
  required_ruby_version: !ruby/object:Gem::Requirement
63
- none: false
64
63
  requirements:
65
64
  - - ! '>='
66
65
  - !ruby/object:Gem::Version
67
66
  version: '0'
68
67
  required_rubygems_version: !ruby/object:Gem::Requirement
69
- none: false
70
68
  requirements:
71
69
  - - ! '>='
72
70
  - !ruby/object:Gem::Version
73
71
  version: '0'
74
72
  requirements: []
75
73
  rubyforge_project:
76
- rubygems_version: 1.8.24
74
+ rubygems_version: 2.1.11
77
75
  signing_key:
78
- specification_version: 3
76
+ specification_version: 4
79
77
  summary: activecollab ruby
80
78
  test_files: []