dbc-ruby 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +51 -9
- data/lib/dbc-ruby/version.rb +1 -1
- data/lib/dbc-ruby.rb +2 -2
- metadata +1 -1
data/README.md
CHANGED
@@ -1,18 +1,60 @@
|
|
1
|
-
#DBC Ruby
|
1
|
+
#DBC API Ruby Client
|
2
2
|
|
3
3
|
## Installation
|
4
4
|
|
5
5
|
If you want to use the Dev Bootcamp (DBC) Ruby gem, run:
|
6
6
|
|
7
|
-
gem install
|
8
|
-
|
9
|
-
## Requirements
|
7
|
+
gem install dbc-ruby
|
10
8
|
|
11
|
-
|
12
|
-
* rest-client
|
9
|
+
## Configuration
|
13
10
|
|
14
|
-
|
11
|
+
You must have an api key to make api requests with this gem.
|
12
|
+
You can see your api key by logging in at [dev.devbootcamp.com](http://dev.devbootcamp.com)
|
15
13
|
|
16
|
-
|
14
|
+
Set your DBC_API environment variable to your api key, or use the gem to configure your key:
|
15
|
+
```ruby
|
16
|
+
DBC::token = # your api key
|
17
|
+
```
|
18
|
+
For making requests between DBC shared applications, you must also congifure the shared key.
|
19
|
+
Set your DBC_SHARED environment variable to the shared key, or use the gem:
|
20
|
+
```ruby
|
21
|
+
DBC::shared_token = # the shared token
|
22
|
+
```
|
17
23
|
|
18
|
-
|
24
|
+
## Methods
|
25
|
+
|
26
|
+
### User
|
27
|
+
|
28
|
+
Class methods:
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
DBC::User.all() # => all users
|
32
|
+
DBC::User.all(page: 1, per_page: 10) # => first 10 users
|
33
|
+
DBC::User.find(id) # => a specific user by user_id
|
34
|
+
```
|
35
|
+
|
36
|
+
Instance methods:
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
user.cohort # => a specific user's cohort object
|
40
|
+
user.challenge_attempts # => a user's challenge attempts
|
41
|
+
user.exercise_attempts # => a user's exercies attempts
|
42
|
+
```
|
43
|
+
|
44
|
+
### Cohort
|
45
|
+
|
46
|
+
Class methods:
|
47
|
+
|
48
|
+
```ruby
|
49
|
+
DBC::Cohort.all() # => all cohorts
|
50
|
+
DBC::Cohort.all(page: 1, per_page: 10) # => first 10 cohorts
|
51
|
+
DBC::Cohort.find(id) # => a specific cohort by user_id
|
52
|
+
```
|
53
|
+
|
54
|
+
### Challenge
|
55
|
+
|
56
|
+
### ChallengeAttempt
|
57
|
+
|
58
|
+
### Exercise
|
59
|
+
|
60
|
+
### ExerciseAttempt
|
data/lib/dbc-ruby/version.rb
CHANGED
data/lib/dbc-ruby.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require_relative 'dbc/dbc_object'
|
1
|
+
require_relative 'dbc/dbc_object'
|
2
2
|
require_relative 'dbc/user'
|
3
3
|
require_relative 'dbc/cohort'
|
4
4
|
require_relative 'dbc/challenge'
|
@@ -11,7 +11,7 @@ require 'json'
|
|
11
11
|
require 'rest_client'
|
12
12
|
|
13
13
|
module DBC
|
14
|
-
@api_url = 'https://api.devbootcamp.com'
|
14
|
+
@api_url = 'https://api.devbootcamp.com/v1'
|
15
15
|
@token = nil
|
16
16
|
@shared_token = nil
|
17
17
|
|