bcx 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 3a60a4978282cb6d3b02a7f1eb070546e0ff0892
4
+ data.tar.gz: aa2e131f7174f59d14a00d900a07437f15f2ff3f
5
+ SHA512:
6
+ metadata.gz: 5f2d853424c6203825cd722f3b8d23929f0f9bf3b7e63a29e4b0ac88c674ac5b617e071ff80e5f903a57eba676b157451be9ed73df864fdadfb9e68975429100
7
+ data.tar.gz: 715fbe0d2c8bff8f94b7d8abc6b63d92fc40e134aa4a05fd79659752b5d09f0b4d565dc2a2d7d21a5000ff3b17398d02b63730f79ce57a5af68d25a4c4dd4071
data/README.md CHANGED
@@ -21,14 +21,28 @@ Fully-fledged Ruby API wrapper for Basecamp Next
21
21
  $ gem install bcx
22
22
  ```
23
23
 
24
- Or if you are using Bundler
24
+ Or if you are using Bundler, add
25
25
 
26
26
  ```ruby
27
27
  gem 'bcx'
28
28
  ```
29
29
 
30
+ to your `Gemfile` and run
31
+
32
+ ```bash
33
+ $ bundle install
34
+ ```
35
+
30
36
  ### Usage
31
37
 
38
+ Configure Bcx for your Basecamp account
39
+
40
+ ```ruby
41
+ Bcx.configure do |config|
42
+ config.account = '1234567890'
43
+ end
44
+ ```
45
+
32
46
  You can connect to the Basecamp API using the Bcx client. The client provides authentication over HTTP or OAuth.
33
47
 
34
48
  #### HTTP Basic Auth
@@ -53,6 +67,7 @@ The following resources are fully implemented and tested.
53
67
  * [Projects](http://paulspringett.github.io/bcx/docs/project.html)
54
68
  * [Todolists](http://paulspringett.github.io/bcx/docs/todolist.html)
55
69
  * [Todos](http://paulspringett.github.io/bcx/docs/todo.html)
70
+ * [Accesses](http://paulspringett.github.io/bcx/docs/access.html)
56
71
 
57
72
  #### Bang operators
58
73
 
@@ -116,6 +131,7 @@ The following endpoints are implemented and tested:
116
131
  * Projects
117
132
  * Todolists
118
133
  * Todos
134
+ * Accesses
119
135
 
120
136
  All other endpoints still need implementing, see the official
121
137
  [Basecamp Next API docs](https://github.com/37signals/bcx-api) for details on what to implement.
@@ -15,7 +15,7 @@ Gem::Specification.new do |gem|
15
15
  gem.require_paths = ["lib"]
16
16
  gem.version = Bcx::VERSION
17
17
 
18
- gem.add_runtime_dependency 'rapidash', '0.3.0.beta2'
18
+ gem.add_runtime_dependency 'rapidash', '~>0.3.0'
19
19
 
20
20
  gem.add_development_dependency 'rake'
21
21
  gem.add_development_dependency 'rspec'
@@ -0,0 +1,123 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <title>access.rb</title>
6
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
7
+ <meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
8
+ <link rel="stylesheet" media="all" href="docco.css" />
9
+ </head>
10
+ <body>
11
+ <div id="container">
12
+ <div id="background"></div>
13
+
14
+ <ul id="jump_to">
15
+ <li>
16
+ <a class="large" href="javascript:void(0);">Jump To &hellip;</a>
17
+ <a class="small" href="javascript:void(0);">+</a>
18
+ <div id="jump_wrapper">
19
+ <div id="jump_page">
20
+
21
+
22
+ <a class="source" href="bcx.html">
23
+ bcx.rb
24
+ </a>
25
+
26
+
27
+ <a class="source" href="http.html">
28
+ http.rb
29
+ </a>
30
+
31
+
32
+ <a class="source" href="oauth.html">
33
+ oauth.rb
34
+ </a>
35
+
36
+
37
+ <a class="source" href="configuration.html">
38
+ configuration.rb
39
+ </a>
40
+
41
+
42
+ <a class="source" href="access.html">
43
+ access.rb
44
+ </a>
45
+
46
+
47
+ <a class="source" href="person.html">
48
+ person.rb
49
+ </a>
50
+
51
+
52
+ <a class="source" href="project.html">
53
+ project.rb
54
+ </a>
55
+
56
+
57
+ <a class="source" href="todo.html">
58
+ todo.rb
59
+ </a>
60
+
61
+
62
+ <a class="source" href="todolist.html">
63
+ todolist.rb
64
+ </a>
65
+
66
+
67
+ <a class="source" href="response_error.html">
68
+ response_error.rb
69
+ </a>
70
+
71
+
72
+ <a class="source" href="version.html">
73
+ version.rb
74
+ </a>
75
+
76
+ </div>
77
+ </li>
78
+ </ul>
79
+
80
+ <ul class="sections">
81
+
82
+ <li id="title">
83
+ <div class="annotation">
84
+ <h1>access.rb</h1>
85
+ </div>
86
+ </li>
87
+
88
+
89
+
90
+ <li id="section-1">
91
+ <div class="annotation">
92
+
93
+ <div class="pilwrap ">
94
+ <a class="pilcrow" href="#section-1">&#182;</a>
95
+ </div>
96
+ <p>Bcx::Resources::Access</p>
97
+ <p>Provides access to accesses resource at per-project level</p>
98
+ <h4>Get accesses for a project</h4>
99
+ <p><code>GET /projects/1/accesses.json</code></p>
100
+ <pre><code>client.projects(1).accesses!</code></pre>
101
+ <h4>Grant access</h4>
102
+ <p><code>POST /projects/1/accesses.json</code></p>
103
+ <pre><code>client.projects(1).accesses.create!(ids: [ 5, 6, 10])</code></pre>
104
+ <h4>Revoke access</h4>
105
+ <p><code>DELETE /projects/1/accesses/1.json</code></p>
106
+ <pre><code>client.projects(1).accesses(1).delete!</code></pre>
107
+
108
+ </div>
109
+
110
+ <div class="content"><div class='highlight'><pre><span class="class"><span class="keyword">module</span> <span class="title">Bcx</span></span>
111
+ <span class="class"><span class="keyword">module</span> <span class="title">Resources</span></span>
112
+ <span class="class"><span class="keyword">class</span> <span class="title">Access</span> <span class="inheritance">&lt; <span class="parent">Rapidash::Base</span></span></span>
113
+
114
+ <span class="keyword">end</span>
115
+ <span class="keyword">end</span>
116
+ <span class="keyword">end</span></pre></div></div>
117
+
118
+ </li>
119
+
120
+ </ul>
121
+ </div>
122
+ </body>
123
+ </html>
@@ -0,0 +1,177 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <title>bcx.rb</title>
6
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
7
+ <meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
8
+ <link rel="stylesheet" media="all" href="docco.css" />
9
+ </head>
10
+ <body>
11
+ <div id="container">
12
+ <div id="background"></div>
13
+
14
+ <ul id="jump_to">
15
+ <li>
16
+ <a class="large" href="javascript:void(0);">Jump To &hellip;</a>
17
+ <a class="small" href="javascript:void(0);">+</a>
18
+ <div id="jump_wrapper">
19
+ <div id="jump_page">
20
+
21
+
22
+ <a class="source" href="bcx.html">
23
+ bcx.rb
24
+ </a>
25
+
26
+
27
+ <a class="source" href="http.html">
28
+ http.rb
29
+ </a>
30
+
31
+
32
+ <a class="source" href="oauth.html">
33
+ oauth.rb
34
+ </a>
35
+
36
+
37
+ <a class="source" href="configuration.html">
38
+ configuration.rb
39
+ </a>
40
+
41
+
42
+ <a class="source" href="access.html">
43
+ access.rb
44
+ </a>
45
+
46
+
47
+ <a class="source" href="person.html">
48
+ person.rb
49
+ </a>
50
+
51
+
52
+ <a class="source" href="project.html">
53
+ project.rb
54
+ </a>
55
+
56
+
57
+ <a class="source" href="todo.html">
58
+ todo.rb
59
+ </a>
60
+
61
+
62
+ <a class="source" href="todolist.html">
63
+ todolist.rb
64
+ </a>
65
+
66
+
67
+ <a class="source" href="response_error.html">
68
+ response_error.rb
69
+ </a>
70
+
71
+
72
+ <a class="source" href="version.html">
73
+ version.rb
74
+ </a>
75
+
76
+ </div>
77
+ </li>
78
+ </ul>
79
+
80
+ <ul class="sections">
81
+
82
+ <li id="title">
83
+ <div class="annotation">
84
+ <h1>bcx.rb</h1>
85
+ </div>
86
+ </li>
87
+
88
+
89
+
90
+ <li id="section-1">
91
+ <div class="annotation">
92
+
93
+ <div class="pilwrap ">
94
+ <a class="pilcrow" href="#section-1">&#182;</a>
95
+ </div>
96
+
97
+ </div>
98
+
99
+ <div class="content"><div class='highlight'><pre><span class="keyword">require</span> <span class="string">'rapidash'</span>
100
+ <span class="keyword">require</span> <span class="string">'bcx/version'</span></pre></div></div>
101
+
102
+ </li>
103
+
104
+
105
+ <li id="section-2">
106
+ <div class="annotation">
107
+
108
+ <div class="pilwrap for-h2">
109
+ <a class="pilcrow" href="#section-2">&#182;</a>
110
+ </div>
111
+ <h2>Bcx</h2>
112
+ <p>Fully-fledged Ruby API wrapper for Basecamp Next</p>
113
+ <p>See the <a href="https://github.com/paulspringett/bcx#readme">README</a> for usage</p>
114
+
115
+ </div>
116
+
117
+ <div class="content"><div class='highlight'><pre><span class="class"><span class="keyword">module</span> <span class="title">Bcx</span></span>
118
+ autoload <span class="symbol">:Configuration</span>, <span class="string">'bcx/configuration'</span>
119
+
120
+ <span class="class"><span class="keyword">module</span> <span class="title">Resources</span></span>
121
+ autoload <span class="symbol">:Todo</span>, <span class="string">'bcx/resources/todo'</span>
122
+ autoload <span class="symbol">:Todolist</span>, <span class="string">'bcx/resources/todolist'</span>
123
+ autoload <span class="symbol">:Project</span>, <span class="string">'bcx/resources/project'</span>
124
+ autoload <span class="symbol">:Person</span>, <span class="string">'bcx/resources/person'</span>
125
+ autoload <span class="symbol">:Access</span>, <span class="string">'bcx/resources/access'</span>
126
+ <span class="keyword">end</span>
127
+
128
+ <span class="class"><span class="keyword">module</span> <span class="title">Client</span></span>
129
+ autoload <span class="symbol">:HTTP</span>, <span class="string">'bcx/client/http'</span>
130
+ autoload <span class="symbol">:OAuth</span>, <span class="string">'bcx/client/oauth'</span>
131
+ <span class="keyword">end</span>
132
+
133
+ <span class="class"><span class="keyword">class</span> <span class="inheritance">&lt;</span><span class="inheritance">&lt; <span class="parent">self</span></span></span>
134
+ attr_accessor <span class="symbol">:configuration</span>
135
+ <span class="keyword">end</span></pre></div></div>
136
+
137
+ </li>
138
+
139
+
140
+ <li id="section-3">
141
+ <div class="annotation">
142
+
143
+ <div class="pilwrap ">
144
+ <a class="pilcrow" href="#section-3">&#182;</a>
145
+ </div>
146
+ <p>Expose configuration block</p>
147
+
148
+ </div>
149
+
150
+ <div class="content"><div class='highlight'><pre> <span class="function"><span class="keyword">def</span> <span class="title"><span class="keyword">self</span></span>.<span class="title">configure</span></span>
151
+ <span class="keyword">self</span>.configuration ||= <span class="constant">Configuration</span>.new
152
+ <span class="keyword">yield</span>(configuration)
153
+ <span class="keyword">end</span>
154
+ <span class="keyword">end</span></pre></div></div>
155
+
156
+ </li>
157
+
158
+
159
+ <li id="section-4">
160
+ <div class="annotation">
161
+
162
+ <div class="pilwrap ">
163
+ <a class="pilcrow" href="#section-4">&#182;</a>
164
+ </div>
165
+ <p>Use custom <code>Bcx::ResponseError</code> on top of Rapidash&#39;s error handling</p>
166
+
167
+ </div>
168
+
169
+ <div class="content"><div class='highlight'><pre><span class="keyword">require</span> <span class="string">'bcx/response_error'</span>
170
+ <span class="constant">Rapidash</span>.response_exception_class = <span class="constant">Bcx::ResponseError</span></pre></div></div>
171
+
172
+ </li>
173
+
174
+ </ul>
175
+ </div>
176
+ </body>
177
+ </html>
@@ -33,11 +33,6 @@
33
33
  version.rb
34
34
  </a>
35
35
 
36
-
37
- <a class="source" href="collection.html">
38
- collection.rb
39
- </a>
40
-
41
36
  </div>
42
37
  </li>
43
38
  </ul>
@@ -55,33 +50,20 @@
55
50
  <li id="section-1">
56
51
  <div class="annotation">
57
52
 
58
- <div class="pilwrap ">
53
+ <div class="pilwrap for-h2">
59
54
  <a class="pilcrow" href="#section-1">&#182;</a>
60
55
  </div>
61
-
62
- </div>
63
-
64
- <div class="content"><div class='highlight'><pre><span class="class"><span class="keyword">module</span> <span class="title">Bcx</span></span></pre></div></div>
65
-
66
- </li>
67
-
68
-
69
- <li id="section-2">
70
- <div class="annotation">
71
-
72
- <div class="pilwrap ">
73
- <a class="pilcrow" href="#section-2">&#182;</a>
74
- </div>
75
- <p>Bcx::Configuration
76
- Provides a configuration block for setting up the Bcx client
77
- Example:</p>
78
- <p> Bcx.configure do |config|
79
- config.account = &#39;1234567890&#39;
80
- end</p>
56
+ <h2>Configuration</h2>
57
+ <p>Provides a configuration block for setting up the Bcx client</p>
58
+ <p>Example:</p>
59
+ <pre><code>Bcx.configure do |config|
60
+ config.account = &#39;1234567890&#39;
61
+ end</code></pre>
81
62
 
82
63
  </div>
83
64
 
84
- <div class="content"><div class='highlight'><pre> <span class="class"><span class="keyword">class</span> <span class="title">Configuration</span></span>
65
+ <div class="content"><div class='highlight'><pre><span class="class"><span class="keyword">module</span> <span class="title">Bcx</span></span>
66
+ <span class="class"><span class="keyword">class</span> <span class="title">Configuration</span></span>
85
67
  attr_accessor <span class="symbol">:account</span>, <span class="symbol">:api_version</span>
86
68
 
87
69
  <span class="function"><span class="keyword">def</span> <span class="title">initialize</span></span>
@@ -0,0 +1,134 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <title>http.rb</title>
6
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
7
+ <meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
8
+ <link rel="stylesheet" media="all" href="docco.css" />
9
+ </head>
10
+ <body>
11
+ <div id="container">
12
+ <div id="background"></div>
13
+
14
+ <ul id="jump_to">
15
+ <li>
16
+ <a class="large" href="javascript:void(0);">Jump To &hellip;</a>
17
+ <a class="small" href="javascript:void(0);">+</a>
18
+ <div id="jump_wrapper">
19
+ <div id="jump_page">
20
+
21
+
22
+ <a class="source" href="bcx.html">
23
+ bcx.rb
24
+ </a>
25
+
26
+
27
+ <a class="source" href="http.html">
28
+ http.rb
29
+ </a>
30
+
31
+
32
+ <a class="source" href="oauth.html">
33
+ oauth.rb
34
+ </a>
35
+
36
+
37
+ <a class="source" href="configuration.html">
38
+ configuration.rb
39
+ </a>
40
+
41
+
42
+ <a class="source" href="access.html">
43
+ access.rb
44
+ </a>
45
+
46
+
47
+ <a class="source" href="person.html">
48
+ person.rb
49
+ </a>
50
+
51
+
52
+ <a class="source" href="project.html">
53
+ project.rb
54
+ </a>
55
+
56
+
57
+ <a class="source" href="todo.html">
58
+ todo.rb
59
+ </a>
60
+
61
+
62
+ <a class="source" href="todolist.html">
63
+ todolist.rb
64
+ </a>
65
+
66
+
67
+ <a class="source" href="response_error.html">
68
+ response_error.rb
69
+ </a>
70
+
71
+
72
+ <a class="source" href="version.html">
73
+ version.rb
74
+ </a>
75
+
76
+ </div>
77
+ </li>
78
+ </ul>
79
+
80
+ <ul class="sections">
81
+
82
+ <li id="title">
83
+ <div class="annotation">
84
+ <h1>http.rb</h1>
85
+ </div>
86
+ </li>
87
+
88
+
89
+
90
+ <li id="section-1">
91
+ <div class="annotation">
92
+
93
+ <div class="pilwrap for-h2">
94
+ <a class="pilcrow" href="#section-1">&#182;</a>
95
+ </div>
96
+ <h2>HTTP Client</h2>
97
+ <p>Provides a client to access the Basecamp Next API using HTTP authentication</p>
98
+ <p>Example:</p>
99
+ <pre><code>client = Bcx::Client::HTTP.new(login: &#39;username&#39;, password: &#39;secret&#39;)</code></pre>
100
+
101
+ </div>
102
+
103
+ <div class="content"><div class='highlight'><pre><span class="class"><span class="keyword">module</span> <span class="title">Bcx</span></span>
104
+ <span class="class"><span class="keyword">module</span> <span class="title">Client</span></span>
105
+ <span class="class"><span class="keyword">class</span> <span class="title">HTTP</span> <span class="inheritance">&lt; <span class="parent">Rapidash::Client</span></span></span>
106
+ method <span class="symbol">:http</span>
107
+
108
+ extension <span class="symbol">:json</span>
109
+ encode_request_with <span class="symbol">:json</span>
110
+
111
+ raise_errors
112
+
113
+ resource <span class="symbol">:projects</span>, <span class="symbol">class_name:</span> <span class="string">'Bcx::Resources::Project'</span>
114
+ resource <span class="symbol">:todolists</span>, <span class="symbol">class_name:</span> <span class="string">'Bcx::Resources::Todolist'</span>
115
+ resource <span class="symbol">:people</span>, <span class="symbol">class_name:</span> <span class="string">'Bcx::Resources::Person'</span>
116
+
117
+ <span class="function"><span class="keyword">def</span> <span class="title">initialize</span><span class="params">(options = {})</span></span>
118
+ <span class="variable">@account</span> = <span class="constant">Bcx</span>.configuration.account
119
+ <span class="variable">@api_version</span> = <span class="constant">Bcx</span>.configuration.api_version
120
+
121
+ <span class="keyword">self</span>.<span class="keyword">class</span>.site(<span class="string">"https://basecamp.com/<span class="subst">#{<span class="variable">@account</span>}</span>/api/<span class="subst">#{<span class="variable">@api_version</span>}</span>/"</span>)
122
+
123
+ <span class="keyword">super</span>(options)
124
+ <span class="keyword">end</span>
125
+ <span class="keyword">end</span>
126
+ <span class="keyword">end</span>
127
+ <span class="keyword">end</span></pre></div></div>
128
+
129
+ </li>
130
+
131
+ </ul>
132
+ </div>
133
+ </body>
134
+ </html>