asana 0.0.6 → 0.1.1
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.
- checksums.yaml +9 -9
- data/.codeclimate.yml +4 -0
- data/.gitignore +12 -20
- data/.rspec +4 -0
- data/.rubocop.yml +18 -0
- data/.travis.yml +12 -0
- data/.yardopts +5 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +17 -0
- data/Guardfile +85 -4
- data/LICENSE.txt +21 -0
- data/README.md +264 -135
- data/Rakefile +62 -7
- data/asana.gemspec +27 -21
- data/examples/Gemfile +6 -0
- data/examples/Gemfile.lock +56 -0
- data/examples/api_token.rb +21 -0
- data/examples/cli_app.rb +25 -0
- data/examples/events.rb +38 -0
- data/examples/omniauth_integration.rb +54 -0
- data/lib/asana.rb +8 -11
- data/lib/asana/authentication.rb +8 -0
- data/lib/asana/authentication/oauth2.rb +42 -0
- data/lib/asana/authentication/oauth2/access_token_authentication.rb +51 -0
- data/lib/asana/authentication/oauth2/bearer_token_authentication.rb +32 -0
- data/lib/asana/authentication/oauth2/client.rb +50 -0
- data/lib/asana/authentication/token_authentication.rb +20 -0
- data/lib/asana/client.rb +124 -0
- data/lib/asana/client/configuration.rb +165 -0
- data/lib/asana/errors.rb +90 -0
- data/lib/asana/http_client.rb +155 -0
- data/lib/asana/http_client/environment_info.rb +53 -0
- data/lib/asana/http_client/error_handling.rb +103 -0
- data/lib/asana/http_client/response.rb +32 -0
- data/lib/asana/resources.rb +11 -0
- data/lib/asana/resources/attachment.rb +44 -0
- data/lib/asana/resources/attachment_uploading.rb +33 -0
- data/lib/asana/resources/collection.rb +68 -0
- data/lib/asana/resources/event.rb +49 -0
- data/lib/asana/resources/event_subscription.rb +12 -0
- data/lib/asana/resources/events.rb +101 -0
- data/lib/asana/resources/project.rb +145 -19
- data/lib/asana/resources/registry.rb +62 -0
- data/lib/asana/resources/resource.rb +103 -0
- data/lib/asana/resources/response_helper.rb +14 -0
- data/lib/asana/resources/story.rb +58 -7
- data/lib/asana/resources/tag.rb +111 -19
- data/lib/asana/resources/task.rb +284 -57
- data/lib/asana/resources/team.rb +55 -0
- data/lib/asana/resources/user.rb +65 -10
- data/lib/asana/resources/workspace.rb +79 -34
- data/lib/asana/ruby2_0_0_compatibility.rb +3 -0
- data/lib/asana/version.rb +3 -1
- data/lib/templates/index.js +8 -0
- data/lib/templates/resource.ejs +225 -0
- data/package.json +7 -0
- metadata +91 -51
- data/LICENSE +0 -22
- data/lib/asana/config.rb +0 -23
- data/lib/asana/resource.rb +0 -52
- data/spec/asana/resources/project_spec.rb +0 -63
- data/spec/asana/resources/story_spec.rb +0 -39
- data/spec/asana/resources/tag_spec.rb +0 -63
- data/spec/asana/resources/task_spec.rb +0 -95
- data/spec/asana/resources/user_spec.rb +0 -64
- data/spec/asana/resources/workspace_spec.rb +0 -108
- data/spec/spec_helper.rb +0 -9
data/package.json
ADDED
metadata
CHANGED
@@ -1,131 +1,178 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: asana
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Txus
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-06-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: oauth2
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: '1.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: '1.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: faraday
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
34
|
-
type: :
|
33
|
+
version: '0.9'
|
34
|
+
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: '0.9'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: faraday_middleware
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
48
|
-
type: :
|
47
|
+
version: '0.9'
|
48
|
+
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: '0.9'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: faraday_middleware-multi_json
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.
|
61
|
+
version: '0.0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: bundler
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.7'
|
62
76
|
type: :development
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
80
|
- - ~>
|
67
81
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
82
|
+
version: '1.7'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
84
|
+
name: rake
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
87
|
- - ~>
|
74
88
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
89
|
+
version: '10.0'
|
76
90
|
type: :development
|
77
91
|
prerelease: false
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
79
93
|
requirements:
|
80
94
|
- - ~>
|
81
95
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
96
|
+
version: '10.0'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
98
|
+
name: rspec
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
86
100
|
requirements:
|
87
101
|
- - ~>
|
88
102
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
103
|
+
version: '3.2'
|
90
104
|
type: :development
|
91
105
|
prerelease: false
|
92
106
|
version_requirements: !ruby/object:Gem::Requirement
|
93
107
|
requirements:
|
94
108
|
- - ~>
|
95
109
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
97
|
-
description: Ruby
|
110
|
+
version: '3.2'
|
111
|
+
description: Official Ruby client for the Asana API
|
98
112
|
email:
|
99
|
-
-
|
113
|
+
- me@txus.io
|
100
114
|
executables: []
|
101
115
|
extensions: []
|
102
116
|
extra_rdoc_files: []
|
103
117
|
files:
|
118
|
+
- .codeclimate.yml
|
104
119
|
- .gitignore
|
120
|
+
- .rspec
|
121
|
+
- .rubocop.yml
|
122
|
+
- .travis.yml
|
123
|
+
- .yardopts
|
124
|
+
- CODE_OF_CONDUCT.md
|
105
125
|
- Gemfile
|
106
126
|
- Guardfile
|
107
|
-
- LICENSE
|
127
|
+
- LICENSE.txt
|
108
128
|
- README.md
|
109
129
|
- Rakefile
|
110
130
|
- asana.gemspec
|
131
|
+
- bin/console
|
132
|
+
- bin/setup
|
133
|
+
- examples/Gemfile
|
134
|
+
- examples/Gemfile.lock
|
135
|
+
- examples/api_token.rb
|
136
|
+
- examples/cli_app.rb
|
137
|
+
- examples/events.rb
|
138
|
+
- examples/omniauth_integration.rb
|
111
139
|
- lib/asana.rb
|
112
|
-
- lib/asana/
|
113
|
-
- lib/asana/
|
140
|
+
- lib/asana/authentication.rb
|
141
|
+
- lib/asana/authentication/oauth2.rb
|
142
|
+
- lib/asana/authentication/oauth2/access_token_authentication.rb
|
143
|
+
- lib/asana/authentication/oauth2/bearer_token_authentication.rb
|
144
|
+
- lib/asana/authentication/oauth2/client.rb
|
145
|
+
- lib/asana/authentication/token_authentication.rb
|
146
|
+
- lib/asana/client.rb
|
147
|
+
- lib/asana/client/configuration.rb
|
148
|
+
- lib/asana/errors.rb
|
149
|
+
- lib/asana/http_client.rb
|
150
|
+
- lib/asana/http_client/environment_info.rb
|
151
|
+
- lib/asana/http_client/error_handling.rb
|
152
|
+
- lib/asana/http_client/response.rb
|
153
|
+
- lib/asana/resources.rb
|
154
|
+
- lib/asana/resources/attachment.rb
|
155
|
+
- lib/asana/resources/attachment_uploading.rb
|
156
|
+
- lib/asana/resources/collection.rb
|
157
|
+
- lib/asana/resources/event.rb
|
158
|
+
- lib/asana/resources/event_subscription.rb
|
159
|
+
- lib/asana/resources/events.rb
|
114
160
|
- lib/asana/resources/project.rb
|
161
|
+
- lib/asana/resources/registry.rb
|
162
|
+
- lib/asana/resources/resource.rb
|
163
|
+
- lib/asana/resources/response_helper.rb
|
115
164
|
- lib/asana/resources/story.rb
|
116
165
|
- lib/asana/resources/tag.rb
|
117
166
|
- lib/asana/resources/task.rb
|
167
|
+
- lib/asana/resources/team.rb
|
118
168
|
- lib/asana/resources/user.rb
|
119
169
|
- lib/asana/resources/workspace.rb
|
170
|
+
- lib/asana/ruby2_0_0_compatibility.rb
|
120
171
|
- lib/asana/version.rb
|
121
|
-
-
|
122
|
-
-
|
123
|
-
-
|
124
|
-
|
125
|
-
- spec/asana/resources/user_spec.rb
|
126
|
-
- spec/asana/resources/workspace_spec.rb
|
127
|
-
- spec/spec_helper.rb
|
128
|
-
homepage: http://github.com/rbright/asana
|
172
|
+
- lib/templates/index.js
|
173
|
+
- lib/templates/resource.ejs
|
174
|
+
- package.json
|
175
|
+
homepage: https://github.com/asana/ruby-asana
|
129
176
|
licenses:
|
130
177
|
- MIT
|
131
178
|
metadata: {}
|
@@ -135,9 +182,9 @@ require_paths:
|
|
135
182
|
- lib
|
136
183
|
required_ruby_version: !ruby/object:Gem::Requirement
|
137
184
|
requirements:
|
138
|
-
- -
|
185
|
+
- - ~>
|
139
186
|
- !ruby/object:Gem::Version
|
140
|
-
version: '0'
|
187
|
+
version: '2.0'
|
141
188
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
142
189
|
requirements:
|
143
190
|
- - ! '>='
|
@@ -145,15 +192,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
145
192
|
version: '0'
|
146
193
|
requirements: []
|
147
194
|
rubyforge_project:
|
148
|
-
rubygems_version: 2.
|
195
|
+
rubygems_version: 2.4.5
|
149
196
|
signing_key:
|
150
197
|
specification_version: 4
|
151
|
-
summary: Ruby
|
152
|
-
test_files:
|
153
|
-
- spec/asana/resources/project_spec.rb
|
154
|
-
- spec/asana/resources/story_spec.rb
|
155
|
-
- spec/asana/resources/tag_spec.rb
|
156
|
-
- spec/asana/resources/task_spec.rb
|
157
|
-
- spec/asana/resources/user_spec.rb
|
158
|
-
- spec/asana/resources/workspace_spec.rb
|
159
|
-
- spec/spec_helper.rb
|
198
|
+
summary: Official Ruby client for the Asana API
|
199
|
+
test_files: []
|
data/LICENSE
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
Copyright (c) 2012-2013 Ryan Bright
|
2
|
-
|
3
|
-
MIT License
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
a copy of this software and associated documentation files (the
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
11
|
-
the following conditions:
|
12
|
-
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
included in all copies or substantial portions of the Software.
|
15
|
-
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/lib/asana/config.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
require 'asana/resource'
|
2
|
-
require 'asana/version'
|
3
|
-
|
4
|
-
module Asana
|
5
|
-
module Config
|
6
|
-
|
7
|
-
API_VERSION = '1.0'
|
8
|
-
DEFAULT_ENDPOINT = "https://app.asana.com/api/#{API_VERSION}/"
|
9
|
-
USER_AGENT = "Asana Ruby Gem #{Asana::VERSION}"
|
10
|
-
|
11
|
-
attr_accessor :api_key
|
12
|
-
|
13
|
-
def configure
|
14
|
-
yield self
|
15
|
-
Resource.site = DEFAULT_ENDPOINT
|
16
|
-
Resource.user = self.api_key
|
17
|
-
Resource.password = ''
|
18
|
-
Resource.format = :json
|
19
|
-
self
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
23
|
-
end
|
data/lib/asana/resource.rb
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
module Asana
|
2
|
-
class Resource < ActiveResource::Base
|
3
|
-
class << self
|
4
|
-
|
5
|
-
def check_prefix_options(options)
|
6
|
-
end
|
7
|
-
|
8
|
-
def custom_method_collection_url(method_name, options = {})
|
9
|
-
prefix_options, query_options = split_options(options)
|
10
|
-
if method_name
|
11
|
-
"#{prefix(prefix_options)}#{collection_name}/#{method_name}.#{format.extension}#{query_string(query_options)}"
|
12
|
-
else
|
13
|
-
"#{prefix(prefix_options)}#{collection_name}.#{format.extension}#{query_string(query_options)}"
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def parent_resources(*resources)
|
18
|
-
@parent_resources = resources
|
19
|
-
end
|
20
|
-
|
21
|
-
def prefix(options = {})
|
22
|
-
if options.any?
|
23
|
-
self.site.path + options.map { |k, v| "#{k.to_s.chomp('_id').pluralize}/#{v}" }.join + '/'
|
24
|
-
else
|
25
|
-
self.site.path
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def prefix_options
|
30
|
-
id ? {} : super
|
31
|
-
end
|
32
|
-
|
33
|
-
def prefix_source
|
34
|
-
if @parent_resources
|
35
|
-
self.site.path + @parent_resources.map { |r| "#{r.to_s.pluralize}/:#{r}_id" }.join + '/'
|
36
|
-
else
|
37
|
-
self.site.path
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
end
|
42
|
-
|
43
|
-
def method_not_allowed
|
44
|
-
raise ActiveResource::MethodNotAllowed.new(__method__)
|
45
|
-
end
|
46
|
-
|
47
|
-
def to_json(options={})
|
48
|
-
super({ :root => 'data' }.merge(options))
|
49
|
-
end
|
50
|
-
|
51
|
-
end
|
52
|
-
end
|
@@ -1,63 +0,0 @@
|
|
1
|
-
require_relative '../../spec_helper'
|
2
|
-
|
3
|
-
module Asana
|
4
|
-
describe Project do
|
5
|
-
|
6
|
-
before do
|
7
|
-
VCR.insert_cassette('projects', :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 projects' do
|
19
|
-
projects = Project.all
|
20
|
-
projects.must_be_instance_of Array
|
21
|
-
projects.first.must_be_instance_of Project
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
describe '.create' do
|
26
|
-
it 'should raise an ActiveResource::MethodNotAllowed exception' do
|
27
|
-
project = Project.new
|
28
|
-
lambda { project.save }.must_raise ActiveResource::MethodNotAllowed
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
describe '.find' do
|
33
|
-
it 'should return a single project' do
|
34
|
-
project = Project.find(Project.all.first.id)
|
35
|
-
project.must_be_instance_of Project
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
describe '#destroy' do
|
40
|
-
it 'should raise an ActiveResource::MethodNotAllowed exception' do
|
41
|
-
project = Project.all.first
|
42
|
-
lambda { project.destroy}.must_raise ActiveResource::MethodNotAllowed
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
describe '#modify' do
|
47
|
-
it 'should modify the given project with a new name' do
|
48
|
-
project = Workspace.all.first.create_project(:name => 'asana-test-project-foo')
|
49
|
-
project.modify(:name => 'asana-test-project-bar').name.must_equal 'asana-test-project-bar'
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
describe '#tasks' do
|
54
|
-
it 'should return all tasks for the given project' do
|
55
|
-
projects = Project.all.first
|
56
|
-
tasks = projects.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,39 +0,0 @@
|
|
1
|
-
require_relative '../../spec_helper'
|
2
|
-
|
3
|
-
module Asana
|
4
|
-
describe Story do
|
5
|
-
|
6
|
-
before do
|
7
|
-
VCR.insert_cassette('stories', :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 story' do
|
19
|
-
story_id = Project.all.first.tasks.first.stories.first.id
|
20
|
-
Story.find(story_id).must_be_instance_of Story
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
describe '#destroy' do
|
25
|
-
it 'should raise an ActiveResource::MethodNotAllowed exception' do
|
26
|
-
story = Project.all.first.tasks.first.stories.first
|
27
|
-
lambda { story.destroy }.must_raise ActiveResource::MethodNotAllowed
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
describe '#update' do
|
32
|
-
it 'should raise an ActiveResource::MethodNotAllowed exception' do
|
33
|
-
story = Project.all.first.tasks.first.stories.first
|
34
|
-
lambda { story.save }.must_raise ActiveResource::MethodNotAllowed
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|
39
|
-
end
|