bcx 0.2.1 → 0.3.0

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.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +32 -7
  3. data/docs/docco.css +10 -4
  4. data/docs/{bcx.html → lib/bcx.html} +37 -22
  5. data/docs/{http.html → lib/bcx/client/http.html} +32 -22
  6. data/docs/{oauth.html → lib/bcx/client/oauth.html} +33 -23
  7. data/docs/{configuration.html → lib/bcx/configuration.html} +7 -7
  8. data/docs/lib/bcx/launchpad/oauth.html +137 -0
  9. data/docs/{access.html → lib/bcx/resources/access.html} +31 -21
  10. data/docs/lib/bcx/resources/authorization.html +140 -0
  11. data/docs/{person.html → lib/bcx/resources/person.html} +31 -21
  12. data/docs/{project.html → lib/bcx/resources/project.html} +32 -22
  13. data/docs/{todo.html → lib/bcx/resources/todo.html} +33 -23
  14. data/docs/{todolist.html → lib/bcx/resources/todolist.html} +34 -24
  15. data/docs/{response_error.html → lib/bcx/response_error.html} +14 -14
  16. data/docs/{version.html → lib/bcx/version.html} +5 -5
  17. data/docs/public/fonts/aller-bold.eot +0 -0
  18. data/docs/public/fonts/aller-bold.ttf +0 -0
  19. data/docs/public/fonts/aller-bold.woff +0 -0
  20. data/docs/public/fonts/aller-light.eot +0 -0
  21. data/docs/public/fonts/aller-light.ttf +0 -0
  22. data/docs/public/fonts/aller-light.woff +0 -0
  23. data/docs/public/fonts/novecento-bold.eot +0 -0
  24. data/docs/public/fonts/novecento-bold.ttf +0 -0
  25. data/docs/public/fonts/novecento-bold.woff +0 -0
  26. data/lib/bcx.rb +5 -0
  27. data/lib/bcx/client/oauth.rb +1 -1
  28. data/lib/bcx/launchpad/oauth.rb +22 -0
  29. data/lib/bcx/resources/authorization.rb +16 -0
  30. data/lib/bcx/version.rb +1 -1
  31. data/spec/bcx/authorization_spec.rb +13 -0
  32. data/spec/bcx/launchpad_spec.rb +16 -0
  33. data/spec/cassettes/Bcx_Resources_Authorization/GET_/authorization/first_account_should_have_the_correct_id.yml +52 -0
  34. metadata +34 -25
  35. data/docs/collection.html +0 -103
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3a60a4978282cb6d3b02a7f1eb070546e0ff0892
4
- data.tar.gz: aa2e131f7174f59d14a00d900a07437f15f2ff3f
3
+ metadata.gz: d6d2d2236905537633927c923ec9c22407d9c69c
4
+ data.tar.gz: 334534b503a68bcf68117a178dd862f42f2c9050
5
5
  SHA512:
6
- metadata.gz: 5f2d853424c6203825cd722f3b8d23929f0f9bf3b7e63a29e4b0ac88c674ac5b617e071ff80e5f903a57eba676b157451be9ed73df864fdadfb9e68975429100
7
- data.tar.gz: 715fbe0d2c8bff8f94b7d8abc6b63d92fc40e134aa4a05fd79659752b5d09f0b4d565dc2a2d7d21a5000ff3b17398d02b63730f79ce57a5af68d25a4c4dd4071
6
+ metadata.gz: f5d20e326ecbd1356836a96ecd5736caecdd1ae35cee80b9e8da90a09ba2a9ac60431e3cd6dc72f32142d5411aa75525cdce081e6653ca5cdf6d45b00707607b
7
+ data.tar.gz: 52aa8ffbf33947d254676c15d3f593b10841046764e15d8e2a419970c3d1604c88ce59d5e8b1099b0b8351edd9806308d94b3cce82437c10a0328c2383f20607
data/README.md CHANGED
@@ -43,6 +43,29 @@ Bcx.configure do |config|
43
43
  end
44
44
  ```
45
45
 
46
+ ### Launchpad API client
47
+
48
+ Before connecting to the Basecamp API you can optionally use this client to obtain a list of a user's available accounts and products. They may be a mix of Basecamp Next, Basecamp Classic, Campfire & other products.
49
+
50
+ From 37signal's API docs:
51
+
52
+ > This endpoint should be first request made after you've obtained a user's authorization token via OAuth. You can pick which account to use for a given product, and then base where to make requests to from the chosen account's href field.
53
+
54
+ ```ruby
55
+ launchpad = Bcx::Launchpad::OAuth.new(client_id: '1234567890', client_secret: '831994c4170', access_token: 'b02ff9345c3')
56
+ authorization = launchpad.authorization!
57
+
58
+ authorization.identity.name
59
+ # => "Joe Bloggs"
60
+
61
+ authorization.accounts
62
+ # => [...]
63
+ ```
64
+
65
+ See [these docs](https://github.com/37signals/api/blob/master/sections/authentication.md#get-authorization) for more details.
66
+
67
+ ### Basecamp clients
68
+
46
69
  You can connect to the Basecamp API using the Bcx client. The client provides authentication over HTTP or OAuth.
47
70
 
48
71
  #### HTTP Basic Auth
@@ -59,6 +82,12 @@ client = Bcx::Client::OAuth.new(client_id: '1234567890', client_secret: '831994c
59
82
 
60
83
  You can get a `client_id` and `client_secret` from https://integrate.37signals.com/
61
84
 
85
+ You can also pass an `:account` option to the OAuth client (allowing multiple clients in your app).
86
+
87
+ ```ruby
88
+ client = Bcx::Client::OAuth.new(account: 99999999, ...)
89
+ ```
90
+
62
91
  ### Resources
63
92
 
64
93
  The following resources are fully implemented and tested.
@@ -68,6 +97,8 @@ The following resources are fully implemented and tested.
68
97
  * [Todolists](http://paulspringett.github.io/bcx/docs/todolist.html)
69
98
  * [Todos](http://paulspringett.github.io/bcx/docs/todo.html)
70
99
  * [Accesses](http://paulspringett.github.io/bcx/docs/access.html)
100
+ * [Authorization](http://paulspringett.github.io/bcx/docs/authorization.html) (Launchpad API)
101
+
71
102
 
72
103
  #### Bang operators
73
104
 
@@ -125,13 +156,7 @@ $ rake docs:generate
125
156
 
126
157
  ### Contributing
127
158
 
128
- The following endpoints are implemented and tested:
129
-
130
- * People
131
- * Projects
132
- * Todolists
133
- * Todos
134
- * Accesses
159
+ The endpoints listed under [Resources](https://github.com/paulspringett/bcx#resources) above are implemented and tested.
135
160
 
136
161
  All other endpoints still need implementing, see the official
137
162
  [Basecamp Next API docs](https://github.com/37signals/bcx-api) for details on what to implement.
@@ -51,9 +51,17 @@ b, strong {
51
51
  font-family: "aller-bold";
52
52
  }
53
53
 
54
- p, ul, ol {
54
+ p {
55
55
  margin: 15px 0 0px;
56
56
  }
57
+ .annotation ul, .annotation ol {
58
+ margin: 25px 0;
59
+ }
60
+ .annotation ul li, .annotation ol li {
61
+ font-size: 14px;
62
+ line-height: 18px;
63
+ margin: 10px 0;
64
+ }
57
65
 
58
66
  h1, h2, h3, h4, h5, h6 {
59
67
  color: #112233;
@@ -70,7 +78,7 @@ h1 {
70
78
 
71
79
  hr {
72
80
  border: 0;
73
- background: 1px solid #ddd;
81
+ background: 1px #ddd;
74
82
  height: 1px;
75
83
  margin: 20px 0;
76
84
  }
@@ -205,7 +213,6 @@ ul.sections > li > div {
205
213
  }
206
214
 
207
215
  ul.sections > li > div.content {
208
- background: #f5f5ff;
209
216
  overflow-x:auto;
210
217
  -webkit-box-shadow: inset 0 0 5px #e5e5ee;
211
218
  box-shadow: inset 0 0 5px #e5e5ee;
@@ -306,7 +313,6 @@ ul.sections > li > div {
306
313
  ul.sections > li > div.content {
307
314
  padding: 13px;
308
315
  vertical-align: top;
309
- background: #f5f5ff;
310
316
  border: none;
311
317
  -webkit-box-shadow: none;
312
318
  box-shadow: none;
@@ -5,7 +5,7 @@
5
5
  <title>bcx.rb</title>
6
6
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
7
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" />
8
+ <link rel="stylesheet" media="all" href="../docco.css" />
9
9
  </head>
10
10
  <body>
11
11
  <div id="container">
@@ -20,57 +20,67 @@
20
20
 
21
21
 
22
22
  <a class="source" href="bcx.html">
23
- bcx.rb
23
+ lib/bcx.rb
24
24
  </a>
25
25
 
26
26
 
27
- <a class="source" href="http.html">
28
- http.rb
27
+ <a class="source" href="bcx/client/http.html">
28
+ lib/bcx/client/http.rb
29
29
  </a>
30
30
 
31
31
 
32
- <a class="source" href="oauth.html">
33
- oauth.rb
32
+ <a class="source" href="bcx/client/oauth.html">
33
+ lib/bcx/client/oauth.rb
34
34
  </a>
35
35
 
36
36
 
37
- <a class="source" href="configuration.html">
38
- configuration.rb
37
+ <a class="source" href="bcx/configuration.html">
38
+ lib/bcx/configuration.rb
39
39
  </a>
40
40
 
41
41
 
42
- <a class="source" href="access.html">
43
- access.rb
42
+ <a class="source" href="bcx/launchpad/oauth.html">
43
+ lib/bcx/launchpad/oauth.rb
44
44
  </a>
45
45
 
46
46
 
47
- <a class="source" href="person.html">
48
- person.rb
47
+ <a class="source" href="bcx/resources/access.html">
48
+ lib/bcx/resources/access.rb
49
49
  </a>
50
50
 
51
51
 
52
- <a class="source" href="project.html">
53
- project.rb
52
+ <a class="source" href="bcx/resources/authorization.html">
53
+ lib/bcx/resources/authorization.rb
54
54
  </a>
55
55
 
56
56
 
57
- <a class="source" href="todo.html">
58
- todo.rb
57
+ <a class="source" href="bcx/resources/person.html">
58
+ lib/bcx/resources/person.rb
59
59
  </a>
60
60
 
61
61
 
62
- <a class="source" href="todolist.html">
63
- todolist.rb
62
+ <a class="source" href="bcx/resources/project.html">
63
+ lib/bcx/resources/project.rb
64
64
  </a>
65
65
 
66
66
 
67
- <a class="source" href="response_error.html">
68
- response_error.rb
67
+ <a class="source" href="bcx/resources/todo.html">
68
+ lib/bcx/resources/todo.rb
69
69
  </a>
70
70
 
71
71
 
72
- <a class="source" href="version.html">
73
- version.rb
72
+ <a class="source" href="bcx/resources/todolist.html">
73
+ lib/bcx/resources/todolist.rb
74
+ </a>
75
+
76
+
77
+ <a class="source" href="bcx/response_error.html">
78
+ lib/bcx/response_error.rb
79
+ </a>
80
+
81
+
82
+ <a class="source" href="bcx/version.html">
83
+ lib/bcx/version.rb
74
84
  </a>
75
85
 
76
86
  </div>
@@ -123,6 +133,7 @@
123
133
  autoload <span class="symbol">:Project</span>, <span class="string">'bcx/resources/project'</span>
124
134
  autoload <span class="symbol">:Person</span>, <span class="string">'bcx/resources/person'</span>
125
135
  autoload <span class="symbol">:Access</span>, <span class="string">'bcx/resources/access'</span>
136
+ autoload <span class="symbol">:Authorization</span>, <span class="string">'bcx/resources/authorization'</span>
126
137
  <span class="keyword">end</span>
127
138
 
128
139
  <span class="class"><span class="keyword">module</span> <span class="title">Client</span></span>
@@ -130,6 +141,10 @@
130
141
  autoload <span class="symbol">:OAuth</span>, <span class="string">'bcx/client/oauth'</span>
131
142
  <span class="keyword">end</span>
132
143
 
144
+ <span class="class"><span class="keyword">module</span> <span class="title">Launchpad</span></span>
145
+ autoload <span class="symbol">:OAuth</span>, <span class="string">'bcx/launchpad/oauth'</span>
146
+ <span class="keyword">end</span>
147
+
133
148
  <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
149
  attr_accessor <span class="symbol">:configuration</span>
135
150
  <span class="keyword">end</span></pre></div></div>
@@ -5,7 +5,7 @@
5
5
  <title>http.rb</title>
6
6
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
7
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" />
8
+ <link rel="stylesheet" media="all" href="../../../docco.css" />
9
9
  </head>
10
10
  <body>
11
11
  <div id="container">
@@ -19,58 +19,68 @@
19
19
  <div id="jump_page">
20
20
 
21
21
 
22
- <a class="source" href="bcx.html">
23
- bcx.rb
22
+ <a class="source" href="../../bcx.html">
23
+ lib/bcx.rb
24
24
  </a>
25
25
 
26
26
 
27
27
  <a class="source" href="http.html">
28
- http.rb
28
+ lib/bcx/client/http.rb
29
29
  </a>
30
30
 
31
31
 
32
32
  <a class="source" href="oauth.html">
33
- oauth.rb
33
+ lib/bcx/client/oauth.rb
34
34
  </a>
35
35
 
36
36
 
37
- <a class="source" href="configuration.html">
38
- configuration.rb
37
+ <a class="source" href="../configuration.html">
38
+ lib/bcx/configuration.rb
39
39
  </a>
40
40
 
41
41
 
42
- <a class="source" href="access.html">
43
- access.rb
42
+ <a class="source" href="../launchpad/oauth.html">
43
+ lib/bcx/launchpad/oauth.rb
44
44
  </a>
45
45
 
46
46
 
47
- <a class="source" href="person.html">
48
- person.rb
47
+ <a class="source" href="../resources/access.html">
48
+ lib/bcx/resources/access.rb
49
49
  </a>
50
50
 
51
51
 
52
- <a class="source" href="project.html">
53
- project.rb
52
+ <a class="source" href="../resources/authorization.html">
53
+ lib/bcx/resources/authorization.rb
54
54
  </a>
55
55
 
56
56
 
57
- <a class="source" href="todo.html">
58
- todo.rb
57
+ <a class="source" href="../resources/person.html">
58
+ lib/bcx/resources/person.rb
59
59
  </a>
60
60
 
61
61
 
62
- <a class="source" href="todolist.html">
63
- todolist.rb
62
+ <a class="source" href="../resources/project.html">
63
+ lib/bcx/resources/project.rb
64
64
  </a>
65
65
 
66
66
 
67
- <a class="source" href="response_error.html">
68
- response_error.rb
67
+ <a class="source" href="../resources/todo.html">
68
+ lib/bcx/resources/todo.rb
69
69
  </a>
70
70
 
71
71
 
72
- <a class="source" href="version.html">
73
- version.rb
72
+ <a class="source" href="../resources/todolist.html">
73
+ lib/bcx/resources/todolist.rb
74
+ </a>
75
+
76
+
77
+ <a class="source" href="../response_error.html">
78
+ lib/bcx/response_error.rb
79
+ </a>
80
+
81
+
82
+ <a class="source" href="../version.html">
83
+ lib/bcx/version.rb
74
84
  </a>
75
85
 
76
86
  </div>
@@ -96,7 +106,7 @@
96
106
  <h2>HTTP Client</h2>
97
107
  <p>Provides a client to access the Basecamp Next API using HTTP authentication</p>
98
108
  <p>Example:</p>
99
- <pre><code>client = Bcx::Client::HTTP.new(login: &#39;username&#39;, password: &#39;secret&#39;)</code></pre>
109
+ <pre><code>client = <span class="constant">Bcx::Client::HTTP</span>.new(<span class="symbol">login:</span> <span class="string">'username'</span>, <span class="symbol">password:</span> <span class="string">'secret'</span>)</code></pre>
100
110
 
101
111
  </div>
102
112
 
@@ -5,7 +5,7 @@
5
5
  <title>oauth.rb</title>
6
6
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
7
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" />
8
+ <link rel="stylesheet" media="all" href="../../../docco.css" />
9
9
  </head>
10
10
  <body>
11
11
  <div id="container">
@@ -19,58 +19,68 @@
19
19
  <div id="jump_page">
20
20
 
21
21
 
22
- <a class="source" href="bcx.html">
23
- bcx.rb
22
+ <a class="source" href="../../bcx.html">
23
+ lib/bcx.rb
24
24
  </a>
25
25
 
26
26
 
27
27
  <a class="source" href="http.html">
28
- http.rb
28
+ lib/bcx/client/http.rb
29
29
  </a>
30
30
 
31
31
 
32
32
  <a class="source" href="oauth.html">
33
- oauth.rb
33
+ lib/bcx/client/oauth.rb
34
34
  </a>
35
35
 
36
36
 
37
- <a class="source" href="configuration.html">
38
- configuration.rb
37
+ <a class="source" href="../configuration.html">
38
+ lib/bcx/configuration.rb
39
39
  </a>
40
40
 
41
41
 
42
- <a class="source" href="access.html">
43
- access.rb
42
+ <a class="source" href="../launchpad/oauth.html">
43
+ lib/bcx/launchpad/oauth.rb
44
44
  </a>
45
45
 
46
46
 
47
- <a class="source" href="person.html">
48
- person.rb
47
+ <a class="source" href="../resources/access.html">
48
+ lib/bcx/resources/access.rb
49
49
  </a>
50
50
 
51
51
 
52
- <a class="source" href="project.html">
53
- project.rb
52
+ <a class="source" href="../resources/authorization.html">
53
+ lib/bcx/resources/authorization.rb
54
54
  </a>
55
55
 
56
56
 
57
- <a class="source" href="todo.html">
58
- todo.rb
57
+ <a class="source" href="../resources/person.html">
58
+ lib/bcx/resources/person.rb
59
59
  </a>
60
60
 
61
61
 
62
- <a class="source" href="todolist.html">
63
- todolist.rb
62
+ <a class="source" href="../resources/project.html">
63
+ lib/bcx/resources/project.rb
64
64
  </a>
65
65
 
66
66
 
67
- <a class="source" href="response_error.html">
68
- response_error.rb
67
+ <a class="source" href="../resources/todo.html">
68
+ lib/bcx/resources/todo.rb
69
69
  </a>
70
70
 
71
71
 
72
- <a class="source" href="version.html">
73
- version.rb
72
+ <a class="source" href="../resources/todolist.html">
73
+ lib/bcx/resources/todolist.rb
74
+ </a>
75
+
76
+
77
+ <a class="source" href="../response_error.html">
78
+ lib/bcx/response_error.rb
79
+ </a>
80
+
81
+
82
+ <a class="source" href="../version.html">
83
+ lib/bcx/version.rb
74
84
  </a>
75
85
 
76
86
  </div>
@@ -96,7 +106,7 @@
96
106
  <h2>Oauth Client</h2>
97
107
  <p>Provides a client to access the Basecamp Next API via OAuth credentials</p>
98
108
  <p>Example:</p>
99
- <pre><code>client = Bcx::Client::OAuth.new(client_id: &#39;1234567890&#39;, client_secret: &#39;831994c4170&#39;, access_token: &#39;b02ff9345c3&#39;)</code></pre>
109
+ <pre><code>client = <span class="constant">Bcx::Client::OAuth</span>.new(<span class="symbol">client_id:</span> <span class="string">'1234567890'</span>, <span class="symbol">client_secret:</span> <span class="string">'831994c4170'</span>, <span class="symbol">access_token:</span> <span class="string">'b02ff9345c3'</span>)</code></pre>
100
110
 
101
111
  </div>
102
112
 
@@ -115,7 +125,7 @@
115
125
  resource <span class="symbol">:people</span>, <span class="symbol">class_name:</span> <span class="string">'Bcx::Resources::Person'</span>
116
126
 
117
127
  <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
128
+ <span class="variable">@account</span> = options[<span class="symbol">:account</span>] || <span class="constant">Bcx</span>.configuration.account
119
129
  <span class="variable">@api_version</span> = <span class="constant">Bcx</span>.configuration.api_version
120
130
 
121
131
  options[<span class="symbol">:site</span>] = <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>