asana-wrap 0.0.2

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 043d36cbd3878273c9d0225fef9d17e2558ffba3
4
+ data.tar.gz: 5ba590f4cdc2ea7a90df867808b407738e6dadb9
5
+ SHA512:
6
+ metadata.gz: 7ca600395dfcae36119ac111ed6834e62c792b738779a9e66aaf372fabc3d82a01f006beb852e1528bc2b699914c6238364c85e972954886751411546b7c74fb
7
+ data.tar.gz: 4571b4bb0e6386b5c0f2369ccdf6807c633d334f7fb6baf065aa90f25d0c61264f87a6c3ca204ec387030927ae4ae7d8ce1a9bbfb5fefcbefcc67a8e4bec83d6
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+ gem 'httparty'
3
+ # Specify your gem's dependencies in asanaparty.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 ctres
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/README.md ADDED
@@ -0,0 +1,23 @@
1
+ # Asana_Party
2
+
3
+ Ruby Wrapper for the [Asana API](http://developer.asana.com/documentation/). It is for use with the Oauth Token acquired from the Authorization Grant Flow.
4
+
5
+ ## Installation
6
+
7
+ gem file is not done yet
8
+
9
+
10
+ ## Testing the rakefile
11
+
12
+ #paste in your copy of the authentication token received from the oauth flow and off you go.
13
+
14
+
15
+ TODO: Write usage instructions here
16
+
17
+ ## Contributing
18
+
19
+ 1. Fork it
20
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
21
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
22
+ 4. Push to the branch (`git push origin my-new-feature`)
23
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,152 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rubygems'
3
+ require 'rake'
4
+ require './lib/asana'
5
+ require './lib/asana/client'
6
+ require './lib/asana/user'
7
+ require './lib/asana/workspace'
8
+ require './lib/asana/project'
9
+ require './lib/asana/task'
10
+
11
+ #token is for colin's klarna account - temporary token
12
+ token = '0/ed47416f821826838c215c639b184fbc'
13
+
14
+ namespace :asana do
15
+ desc 'all tasks'
16
+ task :do_all do
17
+ puts 'get_user'
18
+ Rake::Task['asana:get_user'].invoke
19
+ puts 'get_users'
20
+ Rake::Task['asana:get_users'].invoke
21
+ puts 'get_user_by'
22
+ Rake::Task['asana:get_user_by_id'].invoke
23
+ puts 'get_workspaces'
24
+ Rake::Task['asana:get_workspaces'].invoke
25
+ puts 'workspace_by'
26
+ Rake::Task['asana:get_workspace_by'].invoke
27
+ puts 'get_projects'
28
+ Rake::Task['asana:get_projects'].invoke
29
+ puts 'get_tasks'
30
+ Rake::Task['asana:get_tasks'].invoke
31
+ puts 'get_task_by_id'
32
+ Rake::Task['asana:get_task_by'].invoke
33
+ puts 'get_tasks_by_project'
34
+ Rake::Task['asana:get_tasks_by_project'].invoke
35
+ puts 'get_tasks_by_workspace'
36
+ Rake::Task['asana:get_tasks_in_workspace'].invoke
37
+ puts 'get_project_by'
38
+ Rake::Task['asana:get_project_by'].invoke
39
+ end
40
+
41
+ desc 'get the current user'
42
+ task :get_user do
43
+ params = {
44
+ fields: "email"
45
+ }
46
+ Asana::Client.authenticate(token)
47
+ Asana::User.me(params)
48
+ end
49
+
50
+ desc 'get all users'
51
+ task :get_users do
52
+ params = {
53
+ fields: 'email'
54
+ }
55
+ Asana::Client.authenticate(token)
56
+ Asana::User.all(params)
57
+ end
58
+
59
+ desc 'get user by id'
60
+ task :get_user_by_id do
61
+ Asana::Client.authenticate(token)
62
+ params = {
63
+ user: '1266608946889'
64
+ }
65
+ Asana::User.get_by_id(params)
66
+ end
67
+
68
+ desc 'get users by workspace'
69
+ task :get_users_by_workspace do
70
+ Asana::Client.authenticate(token)
71
+ params = {
72
+ workspace: '451824357556',
73
+ }
74
+ Asana::User.by_workspace(params)
75
+ end
76
+
77
+ desc 'get all workspaces'
78
+ task :get_workspaces do
79
+ params = {}
80
+ Asana::Client.authenticate(token)
81
+ Asana::Workspace.all(params)
82
+ end
83
+
84
+ desc 'get workspace by id'
85
+ task :get_workspace_by do
86
+
87
+ params ={
88
+ workspace: '451824357556'
89
+ }
90
+ Asana::Client.authenticate(token)
91
+ Asana::Workspace.workspace(params)
92
+ end
93
+
94
+ desc 'get all projects'
95
+ task :get_projects do
96
+ params = {}
97
+ Asana::Client.authenticate(token)
98
+ Asana::Project.all(params)
99
+ end
100
+
101
+ desc 'get project by id'
102
+ task :get_project_by do
103
+ params = {
104
+ project: '1636943013621'
105
+ }
106
+ Asana::Client.authenticate(token)
107
+ Asana::Project.id(params)
108
+ end
109
+
110
+ desc 'get tasks'
111
+ task :get_tasks do
112
+ params = {
113
+ project: '1636943013621'
114
+ }
115
+ Asana::Client.authenticate(token)
116
+ Asana::Task.all(params)
117
+ end
118
+
119
+ desc 'get task by id'
120
+ task :get_task_by do
121
+ params = {
122
+ task: '1636943013660',
123
+ fields: 'completed'
124
+ }
125
+ Asana::Client.authenticate(token)
126
+ Asana::Task.id(params)
127
+ end
128
+
129
+ desc 'get tasks by project'
130
+ task :get_tasks_by_project do
131
+ params = {
132
+ project: '1636943013621'
133
+ }
134
+ Asana::Client.authenticate(token)
135
+ Asana::Task.project_tasks(params)
136
+ end
137
+
138
+ desc 'get tasks in workspace'
139
+ task :get_tasks_in_workspace do
140
+ params = {
141
+ assignee: "me",
142
+ workspace: '451824357556'
143
+ }
144
+ Asana::Client.authenticate(token)
145
+ Asana::Task.workspace_tasks(params)
146
+ end
147
+ end
148
+
149
+
150
+
151
+
152
+
data/lib/asana.rb ADDED
@@ -0,0 +1,9 @@
1
+ module Asana
2
+ end
3
+ require 'asana/version'
4
+ require 'asana/client'
5
+ require 'asana/user'
6
+ require 'asana/project'
7
+ require 'asana/task'
8
+ require 'asana/workspace'
9
+
@@ -0,0 +1,32 @@
1
+ module Asana
2
+ require 'httparty'
3
+ class Client
4
+ include HTTParty
5
+ attr_accessor :token
6
+
7
+ def self.authenticate(token)
8
+ @token = token
9
+ self.base_uri 'https://app.asana.com/api/1.0'
10
+ self.headers 'Authorization' => "Bearer #{@token}"
11
+ end
12
+
13
+ def self.format(uri, params)
14
+ options = {}
15
+ options = self.prefix_engine(params)
16
+ self.getresponse(uri, options)
17
+ end
18
+
19
+ private
20
+ def self.prefix_engine(params)
21
+ temphash = {}
22
+ mappings = {fields: 'opt_fields', assignee: 'assignee'}
23
+ temphash[:query] = Hash[params.map {|k,v| [mappings[k]|| k, v] }]
24
+ temphash
25
+ end
26
+
27
+ def self.getresponse(uri, options)
28
+ response = self.get(uri, options)
29
+ response
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,15 @@
1
+ module Asana
2
+ class Project < Asana::Client
3
+ def self.all(params = {})
4
+ uri = "/projects"
5
+ self.format(uri, params)
6
+ end
7
+
8
+ def self.id(params ={})
9
+ uri = "/projects/#{params[:project]}"
10
+ params.delete(:project)
11
+ self.format(uri, params)
12
+ end
13
+ end
14
+ end
15
+
data/lib/asana/task.rb ADDED
@@ -0,0 +1,30 @@
1
+ module Asana
2
+ class Task < Asana::Client
3
+
4
+ def self.all(params = {})
5
+ uri = "/tasks"
6
+ self.format(uri, params)
7
+ end
8
+
9
+ def self.id(params = {})
10
+ uri = "/tasks/#{params[:task]}"
11
+ params.delete(:task)
12
+ self.format(uri, params)
13
+ end
14
+
15
+ def self.project_tasks(params = {})
16
+ uri = "/projects/#{params[:project]}/tasks"
17
+ params.delete(:project)
18
+ self.format(uri, params)
19
+ end
20
+
21
+ def self.workspace_tasks(params = {})
22
+ uri = "/workspaces/#{params[:workspace]}/tasks"
23
+ params.delete(:workspace)
24
+ self.format(uri, params)
25
+ end
26
+ end
27
+ end
28
+
29
+
30
+ #show all workspaces available
data/lib/asana/user.rb ADDED
@@ -0,0 +1,29 @@
1
+ module Asana
2
+ class User < Asana::Client
3
+
4
+ def self.me(params = {})
5
+ uri = "/users/me"
6
+ self.format(uri, params)
7
+ end
8
+
9
+ def self.get_by_id(params = {})
10
+ uri = "/users/#{params[:user]}"
11
+ params.delete(:user)
12
+ self.format(uri, params)
13
+ end
14
+
15
+ def self.all(params = {})
16
+ options = {}
17
+ options = self.prefix_engine(params)
18
+ uri = "/users"
19
+ self.format(uri, params)
20
+ end
21
+
22
+ def self.by_workspace(params ={})
23
+ uri = "/workspaces/#{params[:workspace]}/users"
24
+ self.format(uri, params)
25
+ end
26
+ end
27
+ end
28
+
29
+
@@ -0,0 +1,3 @@
1
+ module Asana
2
+ VERSION = "0.0.2"
3
+ end
@@ -0,0 +1,17 @@
1
+ module Asana
2
+ class Workspace < Asana::Client
3
+
4
+ def self.all(params = {})
5
+ uri = "/projects"
6
+ self.format(uri, params)
7
+ end
8
+
9
+ def self.workspace(params = {})
10
+ uri = "/workspaces/#{params[:task]}"
11
+ self.format(uri, params)
12
+ end
13
+ end
14
+ end
15
+
16
+
17
+ #show all workspaces available
metadata ADDED
@@ -0,0 +1,98 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: asana-wrap
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - ctres
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-07-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: httparty
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: ruby wrapper for Asana using HTTParty
56
+ email:
57
+ - treseler@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - .gitignore
63
+ - Gemfile
64
+ - LICENSE.txt
65
+ - README.md
66
+ - Rakefile
67
+ - lib/asana.rb
68
+ - lib/asana/client.rb
69
+ - lib/asana/project.rb
70
+ - lib/asana/task.rb
71
+ - lib/asana/user.rb
72
+ - lib/asana/version.rb
73
+ - lib/asana/workspace.rb
74
+ homepage: ''
75
+ licenses:
76
+ - MIT
77
+ metadata: {}
78
+ post_install_message:
79
+ rdoc_options: []
80
+ require_paths:
81
+ - lib
82
+ required_ruby_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - '>='
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ required_rubygems_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - '>='
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ requirements: []
93
+ rubyforge_project:
94
+ rubygems_version: 2.0.3
95
+ signing_key:
96
+ specification_version: 4
97
+ summary: a lightweight wrapper for Asana
98
+ test_files: []