api_for_asana 0.0.1 → 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 +4 -4
- data/README.md +107 -0
- data/lib/api_for_asana/version.rb +1 -1
- data/lib/api_for_asana.rb +10 -0
- data/spec/api_for_asana_spec.rb +12 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f8625a70dc2a0bbcf9db770477c38f95e32fa44e13bc71a60276be983d897a5
|
4
|
+
data.tar.gz: 7b9eb78aa907c57ffb7ed4da99136429dcfa1d9de6d645f2ec380fdfec2d773b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90ec20d8ed487721653805567945dab5f2f33d09a1edc22a657027991e73cf37c01af43fc7f2da66d9a5dc377b133906156272d3d50f31a330cb647db4d98767
|
7
|
+
data.tar.gz: f3cd0e58a11cfa63f07c7e63c74128850700034d1079425283883971782990addf5c25d37d5158fd9a83ec9678a77a25c0044241d01577c05aaf54628d225375
|
data/README.md
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
|
2
|
+
<a name="readme-top"></a>
|
3
|
+
|
4
|
+
# 📗 Table of Contents
|
5
|
+
- [📗 Table of Contents](#-table-of-contents)
|
6
|
+
- [📖 api\_for\_asana ](#-api_for_asana-)
|
7
|
+
- [Installation ](#installation-)
|
8
|
+
- [Usage](#usage)
|
9
|
+
- [To get all section](#to-get-all-section)
|
10
|
+
- [To update the section](#to-update-the-section)
|
11
|
+
- [To delete the section](#to-delete-the-section)
|
12
|
+
- [To create new section](#to-create-new-section)
|
13
|
+
- [Run Test](#run-test)
|
14
|
+
- [👥 Authors ](#-authors-)
|
15
|
+
- [🤝 Contributing ](#-contributing-)
|
16
|
+
- [⭐️ Show your support ](#️-show-your-support-)
|
17
|
+
|
18
|
+
# 📖 api_for_asana <a name="about-project"></a>
|
19
|
+
|
20
|
+
This gem is an API wrapper for interacting with Asana. It allows me to create sections, retrieve tasks from a given section, update sections, and delete sections.
|
21
|
+
|
22
|
+
## Installation <a name="tech-stack"></a>
|
23
|
+
|
24
|
+
Add the following code to you Gemfile
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
gem 'api_for_asana'
|
28
|
+
```
|
29
|
+
|
30
|
+
Then run
|
31
|
+
|
32
|
+
`bundler install`
|
33
|
+
|
34
|
+
|
35
|
+
### Usage
|
36
|
+
|
37
|
+
`include` this gem on your controller like.
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
class HomesController < ApplicationController
|
41
|
+
include ApiForAsana
|
42
|
+
|
43
|
+
...
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
```
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
|
52
|
+
#### To get all section
|
53
|
+
|
54
|
+
Use get_sections method like below
|
55
|
+
|
56
|
+
```ruby
|
57
|
+
get_sections
|
58
|
+
|
59
|
+
```
|
60
|
+
#### To update the section
|
61
|
+
|
62
|
+
Use update_section method like below
|
63
|
+
|
64
|
+
```ruby
|
65
|
+
update_section(id, name)
|
66
|
+
|
67
|
+
```
|
68
|
+
#### To delete the section
|
69
|
+
|
70
|
+
Use delete_section method like below
|
71
|
+
|
72
|
+
```ruby
|
73
|
+
delete_section(id)
|
74
|
+
|
75
|
+
```
|
76
|
+
|
77
|
+
#### To create new section
|
78
|
+
|
79
|
+
Use create_section method like below
|
80
|
+
|
81
|
+
```ruby
|
82
|
+
create_section(name)
|
83
|
+
|
84
|
+
```
|
85
|
+
### Run Test
|
86
|
+
on your terminal run
|
87
|
+
`rspec spec`
|
88
|
+
|
89
|
+
## 👥 Authors <a name="authors"></a>
|
90
|
+
|
91
|
+
👤 Melashu Amare
|
92
|
+
|
93
|
+
- GitHub: [@melashu](https://github.com/melashu)
|
94
|
+
- Twitter: [@meshu102](https://twitter.com/meshu102)
|
95
|
+
- LinkedIn: [Melashu Amare](https://www.linkedin.com/in/melashu-amare/)
|
96
|
+
|
97
|
+
## 🤝 Contributing <a name="contributing"></a>
|
98
|
+
|
99
|
+
This repo is open for contributions. Issues, and feature requests are welcome!
|
100
|
+
|
101
|
+
Feel free to check the [issues page.](https://github.com/melashu/api_for_asana/issues)
|
102
|
+
|
103
|
+
## ⭐️ Show your support <a name="support"></a>
|
104
|
+
|
105
|
+
Give a star if you like this project!
|
106
|
+
|
107
|
+
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
data/lib/api_for_asana.rb
CHANGED
@@ -46,6 +46,16 @@ module ApiForAsana
|
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
+
def update_task(id, name)
|
50
|
+
uri = URI("https://app.asana.com/api/1.0/tasks/#{id}")
|
51
|
+
req = Net::HTTP::Put.new(uri)
|
52
|
+
req['Authorization'] = token
|
53
|
+
req.set_form_data(name: name)
|
54
|
+
Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
|
55
|
+
http.request(req)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
49
59
|
private
|
50
60
|
|
51
61
|
def project_url
|
data/spec/api_for_asana_spec.rb
CHANGED
@@ -73,6 +73,18 @@ describe 'ApiForAsana' do
|
|
73
73
|
end
|
74
74
|
|
75
75
|
end
|
76
|
+
context 'When we try to update the task with wrong id' do
|
77
|
+
it 'should return status code 404' do
|
78
|
+
res = dummy.update_task('12048846103271', 'Draft Logo')
|
79
|
+
expect(res.code).to eq('404')
|
80
|
+
end
|
81
|
+
end
|
82
|
+
context 'When we try to update the task with valid task id' do
|
83
|
+
it 'should return status code 200' do
|
84
|
+
res = dummy.update_task('1204884611102860', 'Draft Logo')
|
85
|
+
expect(res.code).to eq('200')
|
86
|
+
end
|
87
|
+
end
|
76
88
|
|
77
89
|
context 'When we try to create new section' do
|
78
90
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: api_for_asana
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Melashu Amare
|
@@ -45,6 +45,7 @@ extensions: []
|
|
45
45
|
extra_rdoc_files: []
|
46
46
|
files:
|
47
47
|
- Gemfile
|
48
|
+
- README.md
|
48
49
|
- api_for_asana.gemspec
|
49
50
|
- lib/api_for_asana.rb
|
50
51
|
- lib/api_for_asana/version.rb
|