asana 0.0.6 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +9 -9
  2. data/.codeclimate.yml +4 -0
  3. data/.gitignore +12 -20
  4. data/.rspec +4 -0
  5. data/.rubocop.yml +18 -0
  6. data/.travis.yml +12 -0
  7. data/.yardopts +5 -0
  8. data/CODE_OF_CONDUCT.md +13 -0
  9. data/Gemfile +17 -0
  10. data/Guardfile +85 -4
  11. data/LICENSE.txt +21 -0
  12. data/README.md +264 -135
  13. data/Rakefile +62 -7
  14. data/asana.gemspec +27 -21
  15. data/examples/Gemfile +6 -0
  16. data/examples/Gemfile.lock +56 -0
  17. data/examples/api_token.rb +21 -0
  18. data/examples/cli_app.rb +25 -0
  19. data/examples/events.rb +38 -0
  20. data/examples/omniauth_integration.rb +54 -0
  21. data/lib/asana.rb +8 -11
  22. data/lib/asana/authentication.rb +8 -0
  23. data/lib/asana/authentication/oauth2.rb +42 -0
  24. data/lib/asana/authentication/oauth2/access_token_authentication.rb +51 -0
  25. data/lib/asana/authentication/oauth2/bearer_token_authentication.rb +32 -0
  26. data/lib/asana/authentication/oauth2/client.rb +50 -0
  27. data/lib/asana/authentication/token_authentication.rb +20 -0
  28. data/lib/asana/client.rb +124 -0
  29. data/lib/asana/client/configuration.rb +165 -0
  30. data/lib/asana/errors.rb +90 -0
  31. data/lib/asana/http_client.rb +155 -0
  32. data/lib/asana/http_client/environment_info.rb +53 -0
  33. data/lib/asana/http_client/error_handling.rb +103 -0
  34. data/lib/asana/http_client/response.rb +32 -0
  35. data/lib/asana/resources.rb +11 -0
  36. data/lib/asana/resources/attachment.rb +44 -0
  37. data/lib/asana/resources/attachment_uploading.rb +33 -0
  38. data/lib/asana/resources/collection.rb +68 -0
  39. data/lib/asana/resources/event.rb +49 -0
  40. data/lib/asana/resources/event_subscription.rb +12 -0
  41. data/lib/asana/resources/events.rb +101 -0
  42. data/lib/asana/resources/project.rb +145 -19
  43. data/lib/asana/resources/registry.rb +62 -0
  44. data/lib/asana/resources/resource.rb +103 -0
  45. data/lib/asana/resources/response_helper.rb +14 -0
  46. data/lib/asana/resources/story.rb +58 -7
  47. data/lib/asana/resources/tag.rb +111 -19
  48. data/lib/asana/resources/task.rb +284 -57
  49. data/lib/asana/resources/team.rb +55 -0
  50. data/lib/asana/resources/user.rb +65 -10
  51. data/lib/asana/resources/workspace.rb +79 -34
  52. data/lib/asana/ruby2_0_0_compatibility.rb +3 -0
  53. data/lib/asana/version.rb +3 -1
  54. data/lib/templates/index.js +8 -0
  55. data/lib/templates/resource.ejs +225 -0
  56. data/package.json +7 -0
  57. metadata +91 -51
  58. data/LICENSE +0 -22
  59. data/lib/asana/config.rb +0 -23
  60. data/lib/asana/resource.rb +0 -52
  61. data/spec/asana/resources/project_spec.rb +0 -63
  62. data/spec/asana/resources/story_spec.rb +0 -39
  63. data/spec/asana/resources/tag_spec.rb +0 -63
  64. data/spec/asana/resources/task_spec.rb +0 -95
  65. data/spec/asana/resources/user_spec.rb +0 -64
  66. data/spec/asana/resources/workspace_spec.rb +0 -108
  67. data/spec/spec_helper.rb +0 -9
@@ -1,63 +0,0 @@
1
- require_relative '../../spec_helper'
2
-
3
- module Asana
4
- describe Tag do
5
-
6
- before do
7
- VCR.insert_cassette('tags', :record => :all)
8
- Asana.configure do |c|
9
- c.api_key = ENV['ASANA_API_KEY']
10
- end
11
- end
12
-
13
- after do
14
- VCR.eject_cassette
15
- end
16
-
17
- describe '.all' do
18
- it 'should return all of the user\'s tags' do
19
- tags = Tag.all
20
- tags.must_be_instance_of Array
21
- tags.first.must_be_instance_of Tag
22
- end
23
- end
24
-
25
- describe '.create' do
26
- it 'should raise an ActiveResource::MethodNotAllowed exception' do
27
- tag = Tag.new
28
- lambda { tag.save }.must_raise ActiveResource::MethodNotAllowed
29
- end
30
- end
31
-
32
- describe '.find' do
33
- it 'should return a single tag' do
34
- tag = Tag.find(Tag.all.first.id)
35
- tag.must_be_instance_of Tag
36
- end
37
- end
38
-
39
- describe '#destroy' do
40
- it 'should raise an ActiveResource::MethodNotAllowed exception' do
41
- tag = Tag.all.first
42
- lambda { tag.destroy}.must_raise ActiveResource::MethodNotAllowed
43
- end
44
- end
45
-
46
- describe '#modify' do
47
- it 'should modify the given tag with a new name' do
48
- tag = Workspace.all.first.create_tag(:name => 'asana-test-tag-foo')
49
- tag.modify(:name => 'asana-test-tag-bar').name.must_equal 'asana-test-tag-bar'
50
- end
51
- end
52
-
53
- describe '#tasks' do
54
- it 'should return all tasks for the given tag' do
55
- tag = Tag.all.first
56
- tasks = tag.tasks
57
- tasks.must_be_instance_of Array
58
- tasks.first.must_be_instance_of Task
59
- end
60
- end
61
-
62
- end
63
- end
@@ -1,95 +0,0 @@
1
- require_relative '../../spec_helper'
2
-
3
- module Asana
4
- describe Task do
5
-
6
- before do
7
- VCR.insert_cassette('tasks', :record => :all)
8
- Asana.configure do |c|
9
- c.api_key = ENV['ASANA_API_KEY']
10
- end
11
- end
12
-
13
- after do
14
- VCR.eject_cassette
15
- end
16
-
17
- describe '.find' do
18
- it 'should return a single task' do
19
- task = Task.find(Workspace.all.first.tasks(:me).first.id)
20
- task.must_be_instance_of Task
21
- end
22
- end
23
-
24
- describe '#modify' do
25
- it 'should modify the given task with a new name' do
26
- task = Workspace.all.first.create_task(:name => 'asana-test-foo', :assignee => 'me')
27
- task.modify(:name => 'asana-test-bar').name.must_equal 'asana-test-bar'
28
- end
29
- end
30
-
31
- describe '#projects' do
32
- it 'should return all projects for the given task' do
33
- task = Project.all.first.tasks.first
34
- projects = task.projects
35
- projects.must_be_instance_of Array
36
- projects.first.must_be_instance_of Project
37
- end
38
- end
39
-
40
- describe '#add_project' do
41
- it 'should add the project to the given task' do
42
- task = Workspace.all.first.create_task(:name => 'asana-test-task-add-project', :assignee => 'me')
43
- project = Workspace.all.first.create_project(:name => 'asana-test-task-parent-project')
44
- task.add_project project.id
45
- end
46
- end
47
-
48
- describe '#add_tag' do
49
- it 'should add the tag to the given task' do
50
- task = Workspace.all.first.create_task(:name => 'asana-test-task-add-tag', :assignee => 'me')
51
- tag = Workspace.all.first.create_tag(:name => 'asana-test-task-parent-tag')
52
- task.add_tag tag.id
53
- end
54
- end
55
-
56
- describe '#create_story' do
57
- it 'should create a new story for the given task' do
58
- task = Project.all.first.tasks.first
59
- story = task.create_story(:text => 'foo')
60
- story.must_be_instance_of Story
61
- end
62
- end
63
-
64
- describe '#stories' do
65
- it 'should return all stories for the given task' do
66
- task = Project.all.first.tasks.first
67
- stories = task.stories
68
- stories.must_be_instance_of Array
69
- stories.first.must_be_instance_of Story
70
- end
71
- end
72
-
73
- describe '#create_subtask' do
74
- it 'should create a new subtask for the given task' do
75
- task = Project.all.first.tasks.first
76
- subtask = task.create_subtask(:name => 'asana-test-subtask', :assignee => 'me')
77
- subtask.must_be_instance_of Task
78
- subtask.parent.must_be_instance_of Task
79
- subtask.parent.id.must_equal task.id
80
- end
81
- end
82
-
83
- describe '#subtasks' do
84
- it 'should return all subtasks for the given task' do
85
- task = Project.all.first.tasks.first
86
- subtasks = task.subtasks
87
- subtasks.must_be_instance_of Array
88
- subtasks.first.must_be_instance_of Task
89
- subtasks.first.parent.must_be_instance_of Task
90
- subtasks.first.parent.id.must_equal task.id
91
- end
92
- end
93
-
94
- end
95
- end
@@ -1,64 +0,0 @@
1
- require_relative '../../spec_helper'
2
-
3
- module Asana
4
- describe User do
5
-
6
- before do
7
- VCR.insert_cassette('users', :record => :all)
8
- Asana.configure do |c|
9
- c.api_key = ENV['ASANA_API_KEY']
10
- end
11
- end
12
-
13
- after do
14
- VCR.eject_cassette
15
- end
16
-
17
- describe '.all' do
18
- it 'should return all users for all of the given user\'s workspaces' do
19
- users = User.all
20
- users.must_be_instance_of Array
21
- users.first.must_be_instance_of User
22
- end
23
- end
24
-
25
- describe '.find' do
26
- it 'should return the user with the given ID' do
27
- user = User.me
28
- user = User.find(user.id)
29
- user.wont_be_nil
30
- user.must_be_instance_of User
31
- end
32
- end
33
-
34
- describe '.me' do
35
- it 'should return the user associated with the given API key' do
36
- user = User.me
37
- user.wont_be_nil
38
- user.must_be_instance_of User
39
- end
40
- end
41
-
42
- describe '#destroy' do
43
- it 'should raise an ActiveResource::MethodNotAllowed exception' do
44
- user = User.me
45
- lambda { user.destroy }.must_raise ActiveResource::MethodNotAllowed
46
- end
47
- end
48
-
49
- describe '#save' do
50
- it 'should raise an ActiveResource::MethodNotAllowed exception' do
51
- user = User.me
52
- lambda { user.save }.must_raise ActiveResource::MethodNotAllowed
53
- end
54
- end
55
-
56
- describe '#update' do
57
- it 'should raise an ActiveResource::MethodNotAllowed exception' do
58
- user = User.me
59
- lambda { user.update_attribute(:name, 'foo') }.must_raise ActiveResource::MethodNotAllowed
60
- end
61
- end
62
-
63
- end
64
- end
@@ -1,108 +0,0 @@
1
- require_relative '../../spec_helper'
2
-
3
- module Asana
4
- describe Workspace do
5
-
6
- before do
7
- VCR.insert_cassette('workspaces', :record => :all)
8
- Asana.configure do |c|
9
- c.api_key = ENV['ASANA_API_KEY']
10
- end
11
- end
12
-
13
- after do
14
- VCR.eject_cassette
15
- end
16
-
17
- describe '.all' do
18
- it 'should return all of the user\'s workspaces' do
19
- workspaces = Workspace.all
20
- workspaces.must_be_instance_of Array
21
- workspaces.first.must_be_instance_of Workspace
22
- end
23
- end
24
-
25
- describe '.find' do
26
- it 'should return a single workspace' do
27
- workspace = Workspace.find(Workspace.all.first.id)
28
- workspace.must_be_instance_of Workspace
29
- end
30
- end
31
-
32
- describe '#create' do
33
- it 'should raise an ActiveResource::MethodNotAllowed exception' do
34
- workspace = Workspace.new
35
- lambda { workspace.save }.must_raise ActiveResource::MethodNotAllowed
36
- end
37
- end
38
-
39
- describe '#create_task' do
40
- it 'should create a new task for the given workspace' do
41
- workspace = Workspace.all.first
42
- task = workspace.create_task(:name => 'asana-test-task', :assignee => 'me')
43
- task.must_be_instance_of Task
44
- end
45
- end
46
-
47
- describe '#create_project' do
48
- it 'should create a new project for the given workspace' do
49
- workspace = Workspace.all.first
50
- project = workspace.create_project(:name => 'asana-test-project')
51
- project.must_be_instance_of Project
52
- end
53
- end
54
-
55
- describe '#update' do
56
- it 'should update the given workspace with a new name' do
57
- workspace = Workspace.all.last
58
- workspace.update_attribute(:name, 'foo')
59
- workspace.name.must_equal 'foo'
60
- end
61
- end
62
-
63
- describe '#destroy' do
64
- it 'should raise an ActiveResource::MethodNotAllowed exception' do
65
- workspace = Workspace.all.first
66
- lambda { workspace.destroy }.must_raise ActiveResource::MethodNotAllowed
67
- end
68
- end
69
-
70
- describe '#projects' do
71
- it 'should return all projects for the given workspace' do
72
- workspace = Workspace.all.first
73
- projects = workspace.projects
74
- projects.must_be_instance_of Array
75
- projects.first.must_be_instance_of Project
76
- end
77
- end
78
-
79
- describe '#tags' do
80
- it 'should return all tags for the given workspace' do
81
- workspace = Workspace.all.first
82
- tags = workspace.tags
83
- tags.must_be_instance_of Array
84
- tags.first.must_be_instance_of Tag
85
- end
86
- end
87
-
88
- describe '#tasks' do
89
- it 'should return all tasks for the given workspace' do
90
- workspace = Workspace.all.first
91
- user = User.all.first
92
- tasks = workspace.tasks(user.id)
93
- tasks.must_be_instance_of Array
94
- tasks.first.must_be_instance_of Task
95
- end
96
- end
97
-
98
- describe '#users' do
99
- it 'should return all users for the given workspace' do
100
- workspace = Workspace.all.first
101
- users = workspace.users
102
- users.must_be_instance_of Array
103
- users.first.must_be_instance_of User
104
- end
105
- end
106
-
107
- end
108
- end
@@ -1,9 +0,0 @@
1
- require 'minitest/autorun'
2
- require 'vcr'
3
- require 'asana'
4
-
5
- VCR.configure do |c|
6
- c.cassette_library_dir = 'spec/fixtures/cassettes'
7
- c.hook_into :webmock
8
- c.filter_sensitive_data('<API_KEY>') { ENV['ASANA_API_KEY'] }
9
- end