spartacus 0.2.2 → 0.2.5
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 +5 -1
- data/lib/client/alumni_stories.rb +2 -2
- data/lib/client/chapters.rb +4 -0
- data/lib/client/checkpoints.rb +13 -13
- data/lib/client/course_subjects.rb +58 -0
- data/lib/client/roadmap_sections.rb +4 -2
- data/lib/client/users.rb +29 -26
- data/lib/spartacus.rb +2 -0
- data/spartacus.gemspec +3 -1
- data/spec/cassettes/alumni_stories.yml +42 -0
- data/spec/cassettes/checkpoints.yml +398 -0
- data/spec/cassettes/roadmap_sections.yml +119 -0
- data/spec/client/alumni_stories_spec.rb +24 -0
- data/spec/client/checkpoints_spec.rb +61 -0
- data/spec/client/roadmap_sections_spec.rb +44 -0
- data/spec/client/users_spec.rb +61 -0
- data/spec/spartacus_spec.rb +0 -0
- data/spec/spec_helper.rb +16 -0
- metadata +51 -3
- data/foo.rb +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 31da9b0ec8269d6bd47177af89c7f2721723f62e
|
4
|
+
data.tar.gz: f35356df271699f8a20d8f10e2e01711447cec0e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4ac64a7fb61f7ba4aa75a17268c2e78bfef24dac1e8487294e1074d5ed79aa717f9100f5f4d2bfe857397177cee5d4d2a22a95273f9b944b92ce10c4ba20b55
|
7
|
+
data.tar.gz: d5889bae900be86b0060f25a643c398f6330b7d666410f0f42765a3764cacf97531a00d2baf58b10d676734441ebe40cdf3241e5a7dae829a97394e90aedc796
|
data/README.md
CHANGED
@@ -15,7 +15,7 @@ gem install spartacus
|
|
15
15
|
... or add to your Gemfile
|
16
16
|
|
17
17
|
```ruby
|
18
|
-
gem "spartacus", "~> 0.2.
|
18
|
+
gem "spartacus", "~> 0.2.5"
|
19
19
|
```
|
20
20
|
|
21
21
|
## Usage
|
@@ -32,6 +32,10 @@ Then use the client to make requests:
|
|
32
32
|
sc.update_checkpoint(129, {name: "New Checkpint Name"})
|
33
33
|
```
|
34
34
|
|
35
|
+
## Documentation
|
36
|
+
|
37
|
+
All the documentation lives [here](http://www.rubydoc.info/github/bmneely/spartacus/).
|
38
|
+
|
35
39
|
## Contributing
|
36
40
|
|
37
41
|
1. Fork it
|
@@ -3,7 +3,7 @@ require_relative 'base_client'
|
|
3
3
|
module AlumniStories
|
4
4
|
include BaseClient
|
5
5
|
|
6
|
-
#
|
6
|
+
# Change the sort order of an alumni story.
|
7
7
|
#
|
8
8
|
# @param id [Integer] An alumni story id.
|
9
9
|
# @param direction [String] The direction to move to the alumni story.
|
@@ -17,7 +17,7 @@ module AlumniStories
|
|
17
17
|
url = "#{@api_base_path}/alum_stories/#{id}/update_sort_order"
|
18
18
|
|
19
19
|
handle_timeouts do
|
20
|
-
response = self.class.
|
20
|
+
response = self.class.put(url,
|
21
21
|
headers: auth_header,
|
22
22
|
body: { direction: direction })
|
23
23
|
convert_response(response, "alumni_story")
|
data/lib/client/checkpoints.rb
CHANGED
@@ -45,18 +45,18 @@ module Checkpoints
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
-
# Delete a checkpoint
|
48
|
+
# # Delete a checkpoint
|
49
|
+
# #
|
50
|
+
# # @param id [Integer] A checkpoint id.
|
51
|
+
# # @return [Checkpoint] The deleted checkpoint.
|
52
|
+
# # @example Delete a checkpoint
|
53
|
+
# # Spartacus#delete_checkpoint(1, {name: 'Real Cool Checkpoint'})
|
54
|
+
# def delete_checkpoint(id)
|
55
|
+
# url = "#{@api_base_path}/checkpoints/#{id}"
|
49
56
|
#
|
50
|
-
#
|
51
|
-
#
|
52
|
-
#
|
53
|
-
#
|
54
|
-
|
55
|
-
url = "#{@api_base_path}/checkpoints/#{id}"
|
56
|
-
|
57
|
-
handle_timeouts do
|
58
|
-
response = self.class.delete(url, headers: auth_header)
|
59
|
-
convert_response(response, "checkpoint")
|
60
|
-
end
|
61
|
-
end
|
57
|
+
# handle_timeouts do
|
58
|
+
# response = self.class.delete(url, headers: auth_header)
|
59
|
+
# convert_response(response, "checkpoint")
|
60
|
+
# end
|
61
|
+
# end
|
62
62
|
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
module CourseSubjects
|
2
|
+
|
3
|
+
# Create a course subject
|
4
|
+
#
|
5
|
+
# @param name [String] Name of the subject.
|
6
|
+
# @param display_name [String] User friendly name of the subject.
|
7
|
+
# @param occupation_name [String] Name of a person who has this job.
|
8
|
+
# @param options [Hash] A customizable set of options.
|
9
|
+
# @option options [Array] :default_goal_options Default goal options.
|
10
|
+
# @option options [Integer] :director_id Id of the course director.
|
11
|
+
# @option options [String] :director_slug User friendly director name.
|
12
|
+
# @return [CourseSubject] The created course subject
|
13
|
+
# @example Create a course subject
|
14
|
+
# Spartacus#create_course_subject()
|
15
|
+
def create_course_subject(name, display_name, occupation_name, options={})
|
16
|
+
whitelist = ['default_goal_options', 'director_id', 'director_slug']
|
17
|
+
|
18
|
+
options = convert_keys(options)
|
19
|
+
course_subject_params = whitelist_params(options, whitelist)
|
20
|
+
course_subject_params.merge!({ name: name, display_name: display_name, occupation_name: occupation_name })
|
21
|
+
url = "#{@api_base_path}/course_subjects"
|
22
|
+
|
23
|
+
handle_timeouts do
|
24
|
+
response = self.class.post(url,
|
25
|
+
headers: auth_header,
|
26
|
+
body: { course_subject: course_subject_params })
|
27
|
+
convert_response(response, "course_subject")
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
# Update a course subject
|
32
|
+
#
|
33
|
+
# @param id [Integer] A course subject id.
|
34
|
+
# @param options [Hash] A customizable set of options.
|
35
|
+
# @option options [String] :name Name of the subject.
|
36
|
+
# @option options [String] :display_name User friendly name of the subject.
|
37
|
+
# @option options [String] :occupation_name Name of a person who has this job.
|
38
|
+
# @option options [Array] :default_goal_options Default goal options.
|
39
|
+
# @option options [Integer] :director_id Id of the course director.
|
40
|
+
# @option options [String] :director_slug User friendly director name.
|
41
|
+
# @return [CourseSubject] The updated course subject
|
42
|
+
# @example Update a course subject
|
43
|
+
# Spartacus#update_course_subject()
|
44
|
+
def update_course_subject(id, options={})
|
45
|
+
whitelist = ['name', 'display_name', 'occupation_name', 'default_goal_options', 'director_id', 'director_slug']
|
46
|
+
|
47
|
+
options = convert_keys(options)
|
48
|
+
course_subject_params = whitelist_params(options, whitelist)
|
49
|
+
url = "#{@api_base_path}/course_subjects/#{id}"
|
50
|
+
|
51
|
+
handle_timeouts do
|
52
|
+
response = self.class.put(url,
|
53
|
+
headers: auth_header,
|
54
|
+
body: { course_subject: course_subject_params })
|
55
|
+
convert_response(response, "course_subject")
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -16,8 +16,10 @@ module RoadmapSections
|
|
16
16
|
# @example Create a checkpoint
|
17
17
|
# Spartacus#create_checkpoint(1, {name: 'Real Cool Checkpoint'})
|
18
18
|
def create_checkpoint(id, options={})
|
19
|
-
|
20
|
-
|
19
|
+
whitelist = ['name', 'summary', 'body', 'assignment','body_and_assignment', 'points']
|
20
|
+
|
21
|
+
options = convert_keys(options)
|
22
|
+
checkpoint_params = whitelist_params(options, whitelist)
|
21
23
|
url = "#{@api_base_path}/roadmap_sections/#{id}/create_checkpoint"
|
22
24
|
|
23
25
|
handle_timeouts do
|
data/lib/client/users.rb
CHANGED
@@ -1,4 +1,7 @@
|
|
1
|
+
require_relative 'base_client'
|
2
|
+
|
1
3
|
module Users
|
4
|
+
include BaseClient
|
2
5
|
|
3
6
|
# Get all users
|
4
7
|
#
|
@@ -190,31 +193,31 @@ module Users
|
|
190
193
|
end
|
191
194
|
end
|
192
195
|
|
193
|
-
# Update a user's data
|
196
|
+
# # Update a user's data
|
197
|
+
# #
|
198
|
+
# # @param id [Integer] A user id.
|
199
|
+
# # @param options [Hash] A customizable set of options.
|
200
|
+
# # @option options [String] :how_heard How user heard about Bloc.
|
201
|
+
# # @option options [String] :how_heard_details How user heard about Bloc details.
|
202
|
+
# # @option options [String] :how_paid How user paid for Bloc.
|
203
|
+
# # @option options [String] :how_paid_details How user paid for Bloc details.
|
204
|
+
# # @return [UserData] The updated user data.
|
205
|
+
# # @example Update a user's data
|
206
|
+
# # Spartacus#update_user_data(129, {how_heard: 'On the Googles'})
|
207
|
+
# def update_user_data(id, options={})
|
208
|
+
# whitelist = ['how_heard', 'how_heard_details', 'how_paid', 'how_paid_details']
|
194
209
|
#
|
195
|
-
#
|
196
|
-
#
|
197
|
-
# @
|
198
|
-
#
|
199
|
-
#
|
200
|
-
#
|
201
|
-
#
|
202
|
-
#
|
203
|
-
#
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
user_data_params = whitelist_params(options, whitelist)
|
209
|
-
url = "#{@api_base_path}/users/#{id}/update_user_data"
|
210
|
-
|
211
|
-
handle_timeouts do
|
212
|
-
response = self.class.put(url, headers: auth_header,
|
213
|
-
body: { user_data: user_data_params })
|
214
|
-
convert_response(response, "UserData")
|
215
|
-
end
|
216
|
-
end
|
217
|
-
|
218
|
-
def replace_availability(id, time_slots={})
|
219
|
-
end
|
210
|
+
# options = convert_keys(options)
|
211
|
+
# user_data_params = whitelist_params(options, whitelist)
|
212
|
+
# url = "#{@api_base_path}/users/#{id}/update_user_data"
|
213
|
+
#
|
214
|
+
# handle_timeouts do
|
215
|
+
# response = self.class.put(url, headers: auth_header,
|
216
|
+
# body: { user_data: user_data_params })
|
217
|
+
# convert_response(response, "UserData")
|
218
|
+
# end
|
219
|
+
# end
|
220
|
+
|
221
|
+
# def replace_availability(id, time_slots={})
|
222
|
+
# end
|
220
223
|
end
|
data/lib/spartacus.rb
CHANGED
@@ -3,6 +3,7 @@ require 'json'
|
|
3
3
|
|
4
4
|
require_relative 'client/alumni_stories'
|
5
5
|
require_relative 'client/checkpoints'
|
6
|
+
require_relative 'client/course_subjects'
|
6
7
|
require_relative 'client/roadmap_sections'
|
7
8
|
require_relative 'client/users'
|
8
9
|
|
@@ -14,6 +15,7 @@ class Spartacus
|
|
14
15
|
include Users
|
15
16
|
include RoadmapSections
|
16
17
|
include AlumniStories
|
18
|
+
include CourseSubjects
|
17
19
|
|
18
20
|
def initialize(email, password, api_base_path="https://www.bloc.io/api/v1")
|
19
21
|
@api_base_path = api_base_path
|
data/spartacus.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'spartacus'
|
3
|
-
s.version = '0.2.
|
3
|
+
s.version = '0.2.5'
|
4
4
|
s.files = `git ls-files`.split($\)
|
5
5
|
s.executables = s.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
6
6
|
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
@@ -18,4 +18,6 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.add_development_dependency "bundler"
|
19
19
|
s.add_development_dependency "rspec"
|
20
20
|
s.add_development_dependency "rake"
|
21
|
+
s.add_development_dependency "vcr"
|
22
|
+
s.add_development_dependency "webmock"
|
21
23
|
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: put
|
5
|
+
uri: http://localhost:3000/api/v1/alum_stories/2/update_sort_order
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: direction=down
|
9
|
+
headers: {}
|
10
|
+
response:
|
11
|
+
status:
|
12
|
+
code: 200
|
13
|
+
message: OK
|
14
|
+
headers:
|
15
|
+
X-Frame-Options:
|
16
|
+
- SAMEORIGIN
|
17
|
+
X-Xss-Protection:
|
18
|
+
- 1; mode=block
|
19
|
+
X-Content-Type-Options:
|
20
|
+
- nosniff
|
21
|
+
Content-Type:
|
22
|
+
- application/json; charset=utf-8
|
23
|
+
Etag:
|
24
|
+
- '"7363e85fe9edee6f053a4b319588c086"'
|
25
|
+
Cache-Control:
|
26
|
+
- max-age=0, private, must-revalidate
|
27
|
+
X-Meta-Request-Version:
|
28
|
+
- 0.3.4
|
29
|
+
X-Request-Id:
|
30
|
+
- 49d671bd-e495-40aa-b1ae-e6c32b4e9d13
|
31
|
+
X-Runtime:
|
32
|
+
- '0.475900'
|
33
|
+
Vary:
|
34
|
+
- Accept-Encoding
|
35
|
+
Transfer-Encoding:
|
36
|
+
- chunked
|
37
|
+
body:
|
38
|
+
encoding: UTF-8
|
39
|
+
string: '{"success":true}'
|
40
|
+
http_version:
|
41
|
+
recorded_at: Thu, 08 Oct 2015 05:26:41 GMT
|
42
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,398 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://localhost:3000/api/v1/checkpoints/1
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers: {}
|
10
|
+
response:
|
11
|
+
status:
|
12
|
+
code: 200
|
13
|
+
message: OK
|
14
|
+
headers:
|
15
|
+
X-Frame-Options:
|
16
|
+
- SAMEORIGIN
|
17
|
+
X-Xss-Protection:
|
18
|
+
- 1; mode=block
|
19
|
+
X-Content-Type-Options:
|
20
|
+
- nosniff
|
21
|
+
Content-Type:
|
22
|
+
- application/json; charset=utf-8
|
23
|
+
Etag:
|
24
|
+
- '"67ef082b2c11d7439fda872589a3235b"'
|
25
|
+
Cache-Control:
|
26
|
+
- max-age=0, private, must-revalidate
|
27
|
+
X-Meta-Request-Version:
|
28
|
+
- 0.3.4
|
29
|
+
X-Request-Id:
|
30
|
+
- 17cee9da-faed-4c74-b9fb-7c16b08c74b5
|
31
|
+
X-Runtime:
|
32
|
+
- '0.280414'
|
33
|
+
Vary:
|
34
|
+
- Accept-Encoding
|
35
|
+
Transfer-Encoding:
|
36
|
+
- chunked
|
37
|
+
body:
|
38
|
+
encoding: UTF-8
|
39
|
+
string: '{"id":1,"name":"Command Line","body":"As a programmer, you''ll spend
|
40
|
+
a lot of your time on the command line in your terminal. The commands you
|
41
|
+
use will depend on your operating system. If you use OS X or Linux, you''ll
|
42
|
+
be entering Unix commands. If you use Windows, you''ll be entering MS-DOS
|
43
|
+
commands. Proficiency with Unix and MS-DOS commands in a terminal contributes
|
44
|
+
to proficiency in programming, so it''s important to practice these. This
|
45
|
+
screencast leads you through some basic commands.\r\n\r\n\u003ccenter\u003e\r\n\u003cvideo
|
46
|
+
width=\"853\" height=\"505\" controls\u003e \u003csource src=\"https://bloc-global-assets.s3.amazonaws.com/screencasts/Command%20Line.mp4\"
|
47
|
+
type=\"video/mp4\"\u003e \r\n\u003c/video\u003e\r\n\u003c/center\u003e\r\n\r\n###
|
48
|
+
Snippets from the Screencast\r\n\r\n### OS X\r\n\r\n```bash\r\n# Working with
|
49
|
+
directories: (OS X)\r\n\r\n$ pwd #=\u003e print working directory\r\n$
|
50
|
+
ls #=\u003e list all subdirectories in the current directory\r\n$
|
51
|
+
ls -l #=\u003e more details on our listed directories\r\n$ mkdir code #=\u003e
|
52
|
+
make a directory named code\r\n$ cd code #=\u003e change directories to
|
53
|
+
code\r\n$ pwd #=\u003e validate that you are now in the code directory\r\n$
|
54
|
+
cd .. #=\u003e move up one level in the directory chain\r\n$ cd code #=\u003e
|
55
|
+
change back to the code directory\r\n$ open . #=\u003e open the finder
|
56
|
+
window for the current directory\r\n$ man mkdir #=\u003e open the manual
|
57
|
+
for the mkdir command\r\n$ q #=\u003e exit out of the manual\r\n```\r\n\r\n```bash\r\n#
|
58
|
+
man mkdir output (OS X)\r\n\r\nNAME\r\n mkdir -- make directories\r\n\r\nSYNOPSIS\r\n mkdir
|
59
|
+
[-pv] [-m mode] directory_name ...\r\n\r\nDESCRIPTION\r\n The mkdir utility
|
60
|
+
creates the directories named as operands, in the order specified, using mode
|
61
|
+
rwxrwxrwx (0777)...\r\n```\r\n\r\n```bash\r\n# Working with files: (OS X)\r\n\r\n$
|
62
|
+
touch snippets.rb #=\u003e create a new file in the
|
63
|
+
code directory, named snippets.rb\r\n$ ls -l #=\u003e
|
64
|
+
validate that snippets.rb was created\r\n$ cat snippets.rb #=\u003e
|
65
|
+
view snippets.rb contents\r\n$ echo hello world #=\u003e
|
66
|
+
print something\r\n$ echo puts \\\"hello world\\\" \u003e snippets.rb #=\u003e
|
67
|
+
add puts hello\r\n$ cat snippets.rb #=\u003e view
|
68
|
+
snippets.rb contents\r\n$ cp snippets.rb hello.rb #=\u003e
|
69
|
+
make a copy of snippets, named hello\r\n$ mv hello.rb helloworld.rb #=\u003e
|
70
|
+
rename hello to helloworld\r\n$ rm helloworld.rb #=\u003e
|
71
|
+
delete helloworld\r\n$ ls -l #=\u003e view
|
72
|
+
the contents of the code directory\r\n$ grep hello snippets.rb #=\u003e
|
73
|
+
search the snippets file for the hello string\r\n$ cd .. #=\u003e
|
74
|
+
move up one level\r\n$ grep -r e code #=\u003e search
|
75
|
+
the code directory for any file that has an \"e\" in it\r\n```\r\n\r\n```\r\n#
|
76
|
+
Recursive option for working with directories\r\n\r\n$ mkdir temp #=\u003e
|
77
|
+
make a temp directory\r\n$ cp temp temp2 #=\u003e try to make a copy
|
78
|
+
of temp, named temp2 (won''t work)\r\n$ rm temp #=\u003e try to
|
79
|
+
delete temp (won''t work)\r\n$ cp -r temp temp2 #=\u003e make a copy of
|
80
|
+
temp, named temp2 (recursively)\r\n$ rm -r temp2 #=\u003e delete temp2
|
81
|
+
(recursively)\r\n$ ls -l #=\u003e view the contents of the temp
|
82
|
+
directory\r\n```\r\n\r\n### Windows\r\n\r\n```\r\n# Working with directories:
|
83
|
+
(Windows)\r\n\r\n$ cd #=\u003e prints working directory (or chdir)\r\n$
|
84
|
+
dir /b #=\u003e show all subdirectories in the current directory (just
|
85
|
+
directory name)\r\n$ dir #=\u003e more details on our listed directories
|
86
|
+
(/p seperates into pages)\r\n$ md code #=\u003e make a directory named
|
87
|
+
code (or mkdir)\r\n$ cd code #=\u003e change directories to code\r\n$
|
88
|
+
cd #=\u003e validate that you are now in the code directory\r\n$
|
89
|
+
cd .. #=\u003e move up one level in the directory chain\r\n$ cd code #=\u003e
|
90
|
+
change back to the code directory\r\n$ start . #=\u003e starts a windows
|
91
|
+
explorer window for the current directory\r\n$ help md #=\u003e get help
|
92
|
+
info for the mkdir command (or mkdir)\r\n```\r\n\r\n```\r\n# help md (Windows)\r\n\r\nNAME\r\n md
|
93
|
+
-- make directories\r\n\r\nCreates a directory.\r\n\r\nMKDIR [drive:]path\r\nMD
|
94
|
+
[drive:]path\r\n```\r\n\r\n```\r\n# Working with files: (Windows)\r\n\r\n$
|
95
|
+
cd. \u003e snippets.rb #=\u003e create a new file in
|
96
|
+
the code directory, named snippets.rb\r\n$ dir #=\u003e
|
97
|
+
validate that snippets.rb was created\r\n$ type snippets.rb #=\u003e
|
98
|
+
display snippets.rb contents\r\n$ echo hello world #=\u003e
|
99
|
+
print something\r\n$ echo puts \\\"hello world\\\" \u003e snippets.rb #=\u003e
|
100
|
+
add puts hello\r\n$ type snippets.rb #=\u003e display
|
101
|
+
snippets.rb contents\r\n$ copy snippets.rb hello.rb #=\u003e
|
102
|
+
make a copy of snippets, named hello\r\n$ rename hello.rb helloworld.rb #=\u003e
|
103
|
+
rename hello to helloworld\r\n$ del helloworld.rb #=\u003e
|
104
|
+
delete helloworld\r\n$ dir #=\u003e view
|
105
|
+
the contents of the code directory\r\n$ find \"hello\" snippets.rb #=\u003e
|
106
|
+
search the snippets file for the hello string\r\n$ findstr /s /i e code #=\u003e
|
107
|
+
search the current directory for any file that has an \"e\" in it\r\n```\r\n\r\n```\r\n#
|
108
|
+
Recursive option for working with directories (Windows)\r\n\r\n$ md temp #=\u003e
|
109
|
+
make a temp directory\r\n$ xcopy temp temp2 #=\u003e try to make a copy
|
110
|
+
of temp, named temp2 (won''t work b/c temp is empty)\r\n$ xcopy /e temp temp2 #=\u003e
|
111
|
+
make an empty copy of temp, named temp2\r\n$ dir #=\u003e
|
112
|
+
validate that temp2 was created\r\n$ rd temp2 #=\u003e remove
|
113
|
+
temp2 directory\r\n$ cd temp #=\u003e change to the temp directory\r\n$
|
114
|
+
cd. \u003e test.txt #=\u003e create a test file in the temp directory,
|
115
|
+
named test.txt\r\n$ cd .. #=\u003e move up one level\r\n$ xcopy
|
116
|
+
temp temp2 #=\u003e make a copy of temp, named temp2 (works because it''s
|
117
|
+
not empty)\r\n$ dir #=\u003e validate that temp2 was created\r\n$
|
118
|
+
rd temp2 #=\u003e try to delete temp (won''t work because temp2
|
119
|
+
is not empty)\r\n$ rd temp2 /s #=\u003e delete temp2 (recursively)\r\n$
|
120
|
+
dir #=\u003e view the contents of the directory\r\n```\r\n\r\n###
|
121
|
+
Resources\r\n* [Zed Shaw](http://zedshaw.com/#/start) writes a series of programming
|
122
|
+
ebooks. His [Command Line - Learn Code the Hard Way](http://cli.learncodethehardway.org/)
|
123
|
+
is a great resource for strengthening your CLI skills.\r\n* This is a [comprehensive
|
124
|
+
index of OS X terminal commands](http://ss64.com/osx/).\r\n* This is a [comprehensive
|
125
|
+
index of Windows terminal commands](http://ss64.com/nt/).\r\n* This [Basic
|
126
|
+
Unix Tutorial](http://snap.nlc.dcccd.edu/learn/idaho/unixindex.html) was created
|
127
|
+
by Idaho State University, and serves as a nice reference guide.\r\n* Here''s
|
128
|
+
some [more detail on grep](http://www.panix.com/~elflord/unix/grep.html).
|
129
|
+
Once you get proficient with grep options, you''ll find it much faster than
|
130
|
+
searching in your GUI.","parent_id":9,"created_at":"2012-11-25T22:55:59.365-05:00","updated_at":"2015-05-13T13:20:03.314-04:00","assignment":"Create
|
131
|
+
your own code directory, similar to the one in the screencast. Create files
|
132
|
+
for some of the Ruby exercises you completed. Name your files in accordance
|
133
|
+
with the exercise, and use a `.rb` extension. To seed the content of the files,
|
134
|
+
you can open them outside of the terminal and paste the code in. Once you
|
135
|
+
have a code directory filled with a handful of `.rb` files, try copying them,
|
136
|
+
renaming them and searching them. Make sure to experiment with different options
|
137
|
+
for each command as well. When you have a better feel for the command line,
|
138
|
+
delete all of the copies you made, leaving only the original `.rb` files you
|
139
|
+
created.\r\n\r\nAfter you''ve completed the tasks above, copy your entire
|
140
|
+
terminal session text and send it to your mentor. (If you already have a Github
|
141
|
+
account, you can paste it in a new Gist and send the link to your mentor.
|
142
|
+
If you don''t have a Github account, we''ll create one in the next checkpoint.)","summary":null,"points":1,"project_name":"","roadmap_id":1,"active":true,"job_prep":false,"version":[0,0],"body_file_path":"","uuid":"337340a0-cc2c-43bd-86c1-d8387487d58c","ref":"337340a0-cc2c-43bd-86c1-d8387487d58c|0","retroactive_optional_date":null}'
|
143
|
+
http_version:
|
144
|
+
recorded_at: Thu, 08 Oct 2015 05:13:00 GMT
|
145
|
+
- request:
|
146
|
+
method: get
|
147
|
+
uri: http://localhost:3000/api/v1/checkpoints/-1
|
148
|
+
body:
|
149
|
+
encoding: US-ASCII
|
150
|
+
string: ''
|
151
|
+
headers: {}
|
152
|
+
response:
|
153
|
+
status:
|
154
|
+
code: 404
|
155
|
+
message: Not Found
|
156
|
+
headers:
|
157
|
+
X-Frame-Options:
|
158
|
+
- SAMEORIGIN
|
159
|
+
X-Xss-Protection:
|
160
|
+
- 1; mode=block
|
161
|
+
X-Content-Type-Options:
|
162
|
+
- nosniff
|
163
|
+
Content-Type:
|
164
|
+
- application/json; charset=utf-8
|
165
|
+
Cache-Control:
|
166
|
+
- no-cache
|
167
|
+
X-Meta-Request-Version:
|
168
|
+
- 0.3.4
|
169
|
+
X-Request-Id:
|
170
|
+
- d3e429eb-5105-4ade-93d1-65b1836893c7
|
171
|
+
X-Runtime:
|
172
|
+
- '0.225733'
|
173
|
+
Vary:
|
174
|
+
- Accept-Encoding
|
175
|
+
Transfer-Encoding:
|
176
|
+
- chunked
|
177
|
+
body:
|
178
|
+
encoding: UTF-8
|
179
|
+
string: '{"message":"Resource not found"}'
|
180
|
+
http_version:
|
181
|
+
recorded_at: Thu, 08 Oct 2015 05:13:00 GMT
|
182
|
+
- request:
|
183
|
+
method: put
|
184
|
+
uri: http://localhost:3000/api/v1/checkpoints/2
|
185
|
+
body:
|
186
|
+
encoding: UTF-8
|
187
|
+
string: checkpoint[name]=My%20Checkpoint
|
188
|
+
headers: {}
|
189
|
+
response:
|
190
|
+
status:
|
191
|
+
code: 200
|
192
|
+
message: OK
|
193
|
+
headers:
|
194
|
+
X-Frame-Options:
|
195
|
+
- SAMEORIGIN
|
196
|
+
X-Xss-Protection:
|
197
|
+
- 1; mode=block
|
198
|
+
X-Content-Type-Options:
|
199
|
+
- nosniff
|
200
|
+
Content-Type:
|
201
|
+
- application/json; charset=utf-8
|
202
|
+
Etag:
|
203
|
+
- '"f4e8bab8402f056716ba3f174d6db83c"'
|
204
|
+
Cache-Control:
|
205
|
+
- max-age=0, private, must-revalidate
|
206
|
+
X-Meta-Request-Version:
|
207
|
+
- 0.3.4
|
208
|
+
X-Request-Id:
|
209
|
+
- f66b4590-0498-402e-b409-fb944b3ddf00
|
210
|
+
X-Runtime:
|
211
|
+
- '0.239184'
|
212
|
+
Vary:
|
213
|
+
- Accept-Encoding
|
214
|
+
Transfer-Encoding:
|
215
|
+
- chunked
|
216
|
+
body:
|
217
|
+
encoding: UTF-8
|
218
|
+
string: '{"id":2,"name":"My Checkpoint","body":"Before you build an application,
|
219
|
+
you must have an idea of what it should look like and how it will be interpreted
|
220
|
+
by users. Developers often use **wireframes** to illustrate their application
|
221
|
+
before they start coding. When drafting a wireframe, think about the primary
|
222
|
+
purpose of your application. Why should it exist? How will it make someone''s
|
223
|
+
life better? Wireframes **should not** be complicated. They should be highly
|
224
|
+
general, but still provide a context for the application throughout development.\r\n\r\nThere
|
225
|
+
are dozens of wireframing tools, but pencil and paper is our preference. It
|
226
|
+
is often tempting to incorporate all of the features that your application
|
227
|
+
could have in a wireframe. Don''t get distracted though, and err on the side
|
228
|
+
of simplicity. Reduce the number of pages and features that your site must
|
229
|
+
have to the absolute minimum. You''ll know when you''ve reached the minimally
|
230
|
+
viable product, (aka MVP), because if you were to remove one more thing, the
|
231
|
+
product would cease to make sense. \r\n \r\n### Resources\r\n* [The Boxing
|
232
|
+
Glove Technique](http://www.90percentofeverything.com/2008/01/02/the-boxing-glove-wireframing-technique/)
|
233
|
+
is an interesting method to help keep your wireframes simple.\r\n* Learn how
|
234
|
+
[37signals does HTML Prototyping](http://blog.handcraft.com/2010/07/how-37signals-does-html-prototyping/).\r\n*
|
235
|
+
If you want to use a tool to build wireframes [Balsamiq](http://www.balsamiq.com/products/mockups)
|
236
|
+
has a free trial license. It''s a nice wireframing tool, but remember that
|
237
|
+
pencil and paper are perfectly fine. ","parent_id":43,"created_at":"2012-11-25T22:55:59.504-05:00","updated_at":"2015-10-08T01:09:05.231-04:00","assignment":"Draft
|
238
|
+
a wireframe for your Blog application. Create the individual pages, as well
|
239
|
+
as the user flow. To illustrate user flow, create a diagram that describes
|
240
|
+
how a user goes through the different pages of your application. When you
|
241
|
+
think you have a good wireframe drafted, push it to Github.\r\n\r\nWe can''t
|
242
|
+
stress this enough: **err on the side of simplicity**. The goal is to get
|
243
|
+
an idea of all the pages you''ll need to make a useful app, and how they work
|
244
|
+
together.","summary":null,"points":1,"project_name":"","roadmap_id":1,"active":true,"job_prep":false,"version":[0,0],"body_file_path":"","uuid":"479dbf5e-6d01-44e9-bd77-655a0fabaf48","ref":"479dbf5e-6d01-44e9-bd77-655a0fabaf48|0","retroactive_optional_date":null}'
|
245
|
+
http_version:
|
246
|
+
recorded_at: Thu, 08 Oct 2015 05:13:01 GMT
|
247
|
+
- request:
|
248
|
+
method: put
|
249
|
+
uri: http://localhost:3000/api/v1/checkpoints/3
|
250
|
+
body:
|
251
|
+
encoding: UTF-8
|
252
|
+
string: checkpoint[name]=My%20Checkpoint&checkpoint[summary]=Great%20Summary&checkpoint[body]=Really%20great%20checkpoint&checkpoint[assignment]=Do%20the%20work%20well&checkpoint[points]=5
|
253
|
+
headers: {}
|
254
|
+
response:
|
255
|
+
status:
|
256
|
+
code: 200
|
257
|
+
message: OK
|
258
|
+
headers:
|
259
|
+
X-Frame-Options:
|
260
|
+
- SAMEORIGIN
|
261
|
+
X-Xss-Protection:
|
262
|
+
- 1; mode=block
|
263
|
+
X-Content-Type-Options:
|
264
|
+
- nosniff
|
265
|
+
Content-Type:
|
266
|
+
- application/json; charset=utf-8
|
267
|
+
Etag:
|
268
|
+
- '"dd9b8cb21292c772e8df299d6f72545f"'
|
269
|
+
Cache-Control:
|
270
|
+
- max-age=0, private, must-revalidate
|
271
|
+
X-Meta-Request-Version:
|
272
|
+
- 0.3.4
|
273
|
+
X-Request-Id:
|
274
|
+
- f678ea37-741c-4086-9deb-2bc4cea62ac9
|
275
|
+
X-Runtime:
|
276
|
+
- '0.406227'
|
277
|
+
Vary:
|
278
|
+
- Accept-Encoding
|
279
|
+
Transfer-Encoding:
|
280
|
+
- chunked
|
281
|
+
body:
|
282
|
+
encoding: UTF-8
|
283
|
+
string: '{"id":3,"name":"My Checkpoint","body":"Really great checkpoint","parent_id":7,"created_at":"2012-11-25T22:55:59.522-05:00","updated_at":"2015-10-08T01:09:05.852-04:00","assignment":"Do
|
284
|
+
the work well","summary":"Great Summary","points":5,"project_name":"","roadmap_id":1,"active":true,"job_prep":false,"version":[0,0],"body_file_path":"","uuid":"cdaa8f1f-f165-48ad-997b-b3c875c22a2b","ref":"cdaa8f1f-f165-48ad-997b-b3c875c22a2b|0","retroactive_optional_date":null}'
|
285
|
+
http_version:
|
286
|
+
recorded_at: Thu, 08 Oct 2015 05:13:02 GMT
|
287
|
+
- request:
|
288
|
+
method: put
|
289
|
+
uri: http://localhost:3000/api/v1/checkpoints/-1
|
290
|
+
body:
|
291
|
+
encoding: UTF-8
|
292
|
+
string: checkpoint[name]=My%20Checkpoint
|
293
|
+
headers: {}
|
294
|
+
response:
|
295
|
+
status:
|
296
|
+
code: 404
|
297
|
+
message: Not Found
|
298
|
+
headers:
|
299
|
+
X-Frame-Options:
|
300
|
+
- SAMEORIGIN
|
301
|
+
X-Xss-Protection:
|
302
|
+
- 1; mode=block
|
303
|
+
X-Content-Type-Options:
|
304
|
+
- nosniff
|
305
|
+
Content-Type:
|
306
|
+
- application/json; charset=utf-8
|
307
|
+
Cache-Control:
|
308
|
+
- no-cache
|
309
|
+
X-Meta-Request-Version:
|
310
|
+
- 0.3.4
|
311
|
+
X-Request-Id:
|
312
|
+
- d8027568-9e19-4a24-91db-ec556ddd7853
|
313
|
+
X-Runtime:
|
314
|
+
- '0.232196'
|
315
|
+
Vary:
|
316
|
+
- Accept-Encoding
|
317
|
+
Transfer-Encoding:
|
318
|
+
- chunked
|
319
|
+
body:
|
320
|
+
encoding: UTF-8
|
321
|
+
string: '{"message":"Resource not found"}'
|
322
|
+
http_version:
|
323
|
+
recorded_at: Thu, 08 Oct 2015 05:13:02 GMT
|
324
|
+
- request:
|
325
|
+
method: delete
|
326
|
+
uri: http://localhost:3000/api/v1/checkpoints/1
|
327
|
+
body:
|
328
|
+
encoding: US-ASCII
|
329
|
+
string: ''
|
330
|
+
headers: {}
|
331
|
+
response:
|
332
|
+
status:
|
333
|
+
code: 404
|
334
|
+
message: Not Found
|
335
|
+
headers:
|
336
|
+
X-Frame-Options:
|
337
|
+
- SAMEORIGIN
|
338
|
+
X-Xss-Protection:
|
339
|
+
- 1; mode=block
|
340
|
+
X-Content-Type-Options:
|
341
|
+
- nosniff
|
342
|
+
Content-Type:
|
343
|
+
- application/json; charset=utf-8
|
344
|
+
Cache-Control:
|
345
|
+
- no-cache
|
346
|
+
X-Meta-Request-Version:
|
347
|
+
- 0.3.4
|
348
|
+
X-Request-Id:
|
349
|
+
- e0372469-f709-496f-a344-39930f602ed4
|
350
|
+
X-Runtime:
|
351
|
+
- '0.255790'
|
352
|
+
Vary:
|
353
|
+
- Accept-Encoding
|
354
|
+
Transfer-Encoding:
|
355
|
+
- chunked
|
356
|
+
body:
|
357
|
+
encoding: UTF-8
|
358
|
+
string: '{"message":"Resource not found"}'
|
359
|
+
http_version:
|
360
|
+
recorded_at: Thu, 08 Oct 2015 05:13:03 GMT
|
361
|
+
- request:
|
362
|
+
method: delete
|
363
|
+
uri: http://localhost:3000/api/v1/checkpoints/-1
|
364
|
+
body:
|
365
|
+
encoding: US-ASCII
|
366
|
+
string: ''
|
367
|
+
headers: {}
|
368
|
+
response:
|
369
|
+
status:
|
370
|
+
code: 404
|
371
|
+
message: Not Found
|
372
|
+
headers:
|
373
|
+
X-Frame-Options:
|
374
|
+
- SAMEORIGIN
|
375
|
+
X-Xss-Protection:
|
376
|
+
- 1; mode=block
|
377
|
+
X-Content-Type-Options:
|
378
|
+
- nosniff
|
379
|
+
Content-Type:
|
380
|
+
- application/json; charset=utf-8
|
381
|
+
Cache-Control:
|
382
|
+
- no-cache
|
383
|
+
X-Meta-Request-Version:
|
384
|
+
- 0.3.4
|
385
|
+
X-Request-Id:
|
386
|
+
- 252d6db8-781f-41a3-9d21-984d1859320a
|
387
|
+
X-Runtime:
|
388
|
+
- '0.290977'
|
389
|
+
Vary:
|
390
|
+
- Accept-Encoding
|
391
|
+
Transfer-Encoding:
|
392
|
+
- chunked
|
393
|
+
body:
|
394
|
+
encoding: UTF-8
|
395
|
+
string: '{"message":"Resource not found"}'
|
396
|
+
http_version:
|
397
|
+
recorded_at: Thu, 08 Oct 2015 05:13:03 GMT
|
398
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,119 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://localhost:3000/api/v1/roadmap_sections/1/create_checkpoint
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: checkpoint[name]=My%20Checkpoint
|
9
|
+
headers: {}
|
10
|
+
response:
|
11
|
+
status:
|
12
|
+
code: 200
|
13
|
+
message: OK
|
14
|
+
headers:
|
15
|
+
X-Frame-Options:
|
16
|
+
- SAMEORIGIN
|
17
|
+
X-Xss-Protection:
|
18
|
+
- 1; mode=block
|
19
|
+
X-Content-Type-Options:
|
20
|
+
- nosniff
|
21
|
+
Content-Type:
|
22
|
+
- application/json; charset=utf-8
|
23
|
+
Etag:
|
24
|
+
- '"7ea5d04b30b7bb36a3a6eecdc4748c92"'
|
25
|
+
Cache-Control:
|
26
|
+
- max-age=0, private, must-revalidate
|
27
|
+
X-Meta-Request-Version:
|
28
|
+
- 0.3.4
|
29
|
+
X-Request-Id:
|
30
|
+
- 95473b53-16b6-444d-ab1f-c841a87bf644
|
31
|
+
X-Runtime:
|
32
|
+
- '0.434640'
|
33
|
+
Vary:
|
34
|
+
- Accept-Encoding
|
35
|
+
Transfer-Encoding:
|
36
|
+
- chunked
|
37
|
+
body:
|
38
|
+
encoding: UTF-8
|
39
|
+
string: '{"id":1788,"name":"My Checkpoint","body":null,"parent_id":null,"created_at":"2015-10-08T06:08:57.035Z","updated_at":"2015-10-08T06:08:57.035Z","assignment":null,"summary":null,"points":1,"project_name":"","roadmap_id":null,"active":true,"job_prep":false,"version":[0,0],"body_file_path":"","uuid":"1ad02a6d-6a54-4a75-947a-3c41be3d7b6d","ref":"1ad02a6d-6a54-4a75-947a-3c41be3d7b6d|0","retroactive_optional_date":null}'
|
40
|
+
http_version:
|
41
|
+
recorded_at: Thu, 08 Oct 2015 06:08:57 GMT
|
42
|
+
- request:
|
43
|
+
method: post
|
44
|
+
uri: http://localhost:3000/api/v1/roadmap_sections/-1/create_checkpoint
|
45
|
+
body:
|
46
|
+
encoding: UTF-8
|
47
|
+
string: ''
|
48
|
+
headers: {}
|
49
|
+
response:
|
50
|
+
status:
|
51
|
+
code: 404
|
52
|
+
message: Not Found
|
53
|
+
headers:
|
54
|
+
X-Frame-Options:
|
55
|
+
- SAMEORIGIN
|
56
|
+
X-Xss-Protection:
|
57
|
+
- 1; mode=block
|
58
|
+
X-Content-Type-Options:
|
59
|
+
- nosniff
|
60
|
+
Content-Type:
|
61
|
+
- application/json; charset=utf-8
|
62
|
+
Cache-Control:
|
63
|
+
- no-cache
|
64
|
+
X-Meta-Request-Version:
|
65
|
+
- 0.3.4
|
66
|
+
X-Request-Id:
|
67
|
+
- 2606a433-5680-4d52-baea-6677273a52cc
|
68
|
+
X-Runtime:
|
69
|
+
- '0.226633'
|
70
|
+
Vary:
|
71
|
+
- Accept-Encoding
|
72
|
+
Transfer-Encoding:
|
73
|
+
- chunked
|
74
|
+
body:
|
75
|
+
encoding: UTF-8
|
76
|
+
string: '{"message":"Resource not found"}'
|
77
|
+
http_version:
|
78
|
+
recorded_at: Thu, 08 Oct 2015 06:08:58 GMT
|
79
|
+
- request:
|
80
|
+
method: post
|
81
|
+
uri: http://localhost:3000/api/v1/roadmap_sections/2/create_checkpoint
|
82
|
+
body:
|
83
|
+
encoding: UTF-8
|
84
|
+
string: checkpoint[name]=My%20Checkpoint&checkpoint[summary]=Great%20Summary&checkpoint[body]=Really%20great%20checkpoint&checkpoint[assignment]=Do%20the%20work%20well&checkpoint[points]=5
|
85
|
+
headers: {}
|
86
|
+
response:
|
87
|
+
status:
|
88
|
+
code: 200
|
89
|
+
message: OK
|
90
|
+
headers:
|
91
|
+
X-Frame-Options:
|
92
|
+
- SAMEORIGIN
|
93
|
+
X-Xss-Protection:
|
94
|
+
- 1; mode=block
|
95
|
+
X-Content-Type-Options:
|
96
|
+
- nosniff
|
97
|
+
Content-Type:
|
98
|
+
- application/json; charset=utf-8
|
99
|
+
Etag:
|
100
|
+
- '"6940afdc3e4fec332723ab58c1d8fdf3"'
|
101
|
+
Cache-Control:
|
102
|
+
- max-age=0, private, must-revalidate
|
103
|
+
X-Meta-Request-Version:
|
104
|
+
- 0.3.4
|
105
|
+
X-Request-Id:
|
106
|
+
- b3fee978-de98-443f-bcb1-3def6fcaa61d
|
107
|
+
X-Runtime:
|
108
|
+
- '0.545259'
|
109
|
+
Vary:
|
110
|
+
- Accept-Encoding
|
111
|
+
Transfer-Encoding:
|
112
|
+
- chunked
|
113
|
+
body:
|
114
|
+
encoding: UTF-8
|
115
|
+
string: '{"id":1789,"name":"My Checkpoint","body":"Really great checkpoint","parent_id":null,"created_at":"2015-10-08T06:09:24.783Z","updated_at":"2015-10-08T06:09:24.783Z","assignment":"Do
|
116
|
+
the work well","summary":"Great Summary","points":5,"project_name":"","roadmap_id":null,"active":true,"job_prep":false,"version":[0,0],"body_file_path":"","uuid":"c9b685eb-626a-43ea-80d7-e1b36df4d248","ref":"c9b685eb-626a-43ea-80d7-e1b36df4d248|0","retroactive_optional_date":null}'
|
117
|
+
http_version:
|
118
|
+
recorded_at: Thu, 08 Oct 2015 06:09:25 GMT
|
119
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe AlumniStories do
|
4
|
+
before do
|
5
|
+
@client = Spartacus.new(ENV['BLOCUSER'], ENV['BLOCPASS'], 'http://localhost:3000/api/v1')
|
6
|
+
end
|
7
|
+
|
8
|
+
describe '#update_alum_story_sort_order' do
|
9
|
+
it 'returns an AlumniStory object' do
|
10
|
+
VCR.use_cassette 'alumni_stories', record: :new_episodes do
|
11
|
+
response = @client.update_alum_story_sort_order(2)
|
12
|
+
expect(response).to be_an_instance_of(AlumniStory)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'returns an error message for a missing alumni story' do
|
17
|
+
VCR.use_cassette 'checkpoints', record: :new_episodes do
|
18
|
+
response = @client.get_checkpoint(-1)
|
19
|
+
expect(response.message).to eq('Not Found')
|
20
|
+
expect(response.code).to eq(404)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Checkpoints do
|
4
|
+
before do
|
5
|
+
@client = Spartacus.new(ENV['BLOCUSER'], ENV['BLOCPASS'], 'http://localhost:3000/api/v1')
|
6
|
+
end
|
7
|
+
|
8
|
+
describe '#get_checkpoint' do
|
9
|
+
it 'returns a Checkpoint object' do
|
10
|
+
VCR.use_cassette 'checkpoints', record: :new_episodes do
|
11
|
+
response = @client.get_checkpoint(1)
|
12
|
+
expect(response).to be_an_instance_of(Checkpoint)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'returns an error message for a missing checkpoint' do
|
17
|
+
VCR.use_cassette 'checkpoints', record: :new_episodes do
|
18
|
+
response = @client.get_checkpoint(-1)
|
19
|
+
expect(response.message).to eq('Not Found')
|
20
|
+
expect(response.code).to eq(404)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe '#update_checkpoint' do
|
26
|
+
it 'returns a Checkpoint object' do
|
27
|
+
VCR.use_cassette 'checkpoints', record: :new_episodes do
|
28
|
+
response = @client.update_checkpoint(2, {name: 'My Checkpoint'})
|
29
|
+
expect(response).to be_an_instance_of(Checkpoint)
|
30
|
+
expect(response.name).to eq('My Checkpoint')
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'updates checkpoint attributes' do
|
35
|
+
VCR.use_cassette 'checkpoints', record: :new_episodes do
|
36
|
+
attributes = {
|
37
|
+
name: "My Checkpoint",
|
38
|
+
summary: "Great Summary",
|
39
|
+
body: "Really great checkpoint",
|
40
|
+
assignment: "Do the work well",
|
41
|
+
points: 5
|
42
|
+
}
|
43
|
+
|
44
|
+
response = @client.update_checkpoint(3, attributes)
|
45
|
+
expect(response.name).to eq(attributes['name'])
|
46
|
+
expect(response.summary).to eq(attributes['summary'])
|
47
|
+
expect(response.body).to eq(attributes['body'])
|
48
|
+
expect(response.assignment).to eq(attributes['assignment'])
|
49
|
+
expect(response.points).to eq(attributes['points'])
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'returns an error message for a messing checkpoint' do
|
54
|
+
VCR.use_cassette 'checkpoints', record: :new_episodes do
|
55
|
+
response = @client.update_checkpoint(-1, {name: 'My Checkpoint'})
|
56
|
+
expect(response.message).to eq('Not Found')
|
57
|
+
expect(response.code).to eq(404)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe RoadmapSections do
|
4
|
+
before do
|
5
|
+
@client = Spartacus.new(ENV['BLOCUSER'], ENV['BLOCPASS'], 'http://localhost:3000/api/v1')
|
6
|
+
end
|
7
|
+
|
8
|
+
describe '#create_checkpoint' do
|
9
|
+
it 'returns a Checkpoint object' do
|
10
|
+
VCR.use_cassette 'roadmap_sections', record: :new_episodes do
|
11
|
+
response = @client.create_checkpoint(1, {name: 'My Checkpoint'})
|
12
|
+
expect(response).to be_an_instance_of(Checkpoint)
|
13
|
+
expect(response.name).to eq('My Checkpoint')
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'returns an Checkpoint object' do
|
18
|
+
VCR.use_cassette 'roadmap_sections', record: :new_episodes do
|
19
|
+
attributes = {
|
20
|
+
name: "My Checkpoint",
|
21
|
+
summary: "Great Summary",
|
22
|
+
body: "Really great checkpoint",
|
23
|
+
assignment: "Do the work well",
|
24
|
+
points: 5
|
25
|
+
}
|
26
|
+
|
27
|
+
response = @client.create_checkpoint(2, attributes)
|
28
|
+
expect(response.name).to eq(attributes['name'])
|
29
|
+
expect(response.summary).to eq(attributes['summary'])
|
30
|
+
expect(response.body).to eq(attributes['body'])
|
31
|
+
expect(response.assignment).to eq(attributes['assignment'])
|
32
|
+
expect(response.points).to eq(attributes['points'])
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'returns an error message for a missing roadmap section' do
|
37
|
+
VCR.use_cassette 'roadmap_sections', record: :new_episodes do
|
38
|
+
response = @client.create_checkpoint(-1)
|
39
|
+
expect(response.message).to eq('Not Found')
|
40
|
+
expect(response.code).to eq(404)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Checkpoints do
|
4
|
+
before do
|
5
|
+
@client = Spartacus.new(ENV['BLOCUSER'], ENV['BLOCPASS'], 'http://localhost:3000/api/v1')
|
6
|
+
end
|
7
|
+
|
8
|
+
describe '#get_checkpoint' do
|
9
|
+
it 'returns a Checkpoint object' do
|
10
|
+
VCR.use_cassette 'checkpoints', record: :new_episodes do
|
11
|
+
response = @client.get_checkpoint(1)
|
12
|
+
expect(response).to be_an_instance_of(Checkpoint)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'returns an error message for a missing checkpoint' do
|
17
|
+
VCR.use_cassette 'checkpoints', record: :new_episodes do
|
18
|
+
response = @client.get_checkpoint(-1)
|
19
|
+
expect(response.message).to eq('Not Found')
|
20
|
+
expect(response.code).to eq(404)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe '#update_checkpoint' do
|
26
|
+
it 'returns a Checkpoint object' do
|
27
|
+
VCR.use_cassette 'checkpoints', record: :new_episodes do
|
28
|
+
response = @client.update_checkpoint(2, {name: 'My Checkpoint'})
|
29
|
+
expect(response).to be_an_instance_of(Checkpoint)
|
30
|
+
expect(response.name).to eq('My Checkpoint')
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'updates checkpoint attributes' do
|
35
|
+
VCR.use_cassette 'checkpoints', record: :new_episodes do
|
36
|
+
attributes = {
|
37
|
+
name: "My Checkpoint",
|
38
|
+
summary: "Great Summary",
|
39
|
+
body: "Really great checkpoint",
|
40
|
+
assignment: "Do the work well",
|
41
|
+
points: 5
|
42
|
+
}
|
43
|
+
|
44
|
+
response = @client.update_checkpoint(3, attributes)
|
45
|
+
expect(response.name).to eq(attributes['name'])
|
46
|
+
expect(response.summary).to eq(attributes['summary'])
|
47
|
+
expect(response.body).to eq(attributes['body'])
|
48
|
+
expect(response.assignment).to eq(attributes['assignment'])
|
49
|
+
expect(response.points).to eq(attributes['points'])
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'returns an error message for a messing checkpoint' do
|
54
|
+
VCR.use_cassette 'checkpoints', record: :new_episodes do
|
55
|
+
response = @client.update_checkpoint(-1, {name: 'My Checkpoint'})
|
56
|
+
expect(response.message).to eq('Not Found')
|
57
|
+
expect(response.code).to eq(404)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
File without changes
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require_relative '../lib/spartacus'
|
2
|
+
require 'webmock/rspec'
|
3
|
+
require 'vcr'
|
4
|
+
|
5
|
+
VCR.configure do |c|
|
6
|
+
c.cassette_library_dir = 'spec/cassettes'
|
7
|
+
c.hook_into :webmock
|
8
|
+
c.ignore_request do |request|
|
9
|
+
URI(request.uri).request_uri == '/api/v1/sessions'
|
10
|
+
end
|
11
|
+
|
12
|
+
c.before_record do |i|
|
13
|
+
i.response.headers.delete('Set-Cookie')
|
14
|
+
i.request.headers.delete('Authorization')
|
15
|
+
end
|
16
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spartacus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Neely
|
@@ -94,6 +94,34 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: vcr
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: webmock
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
97
125
|
description: A client for the Bloc API
|
98
126
|
email: ben@bloc.to
|
99
127
|
executables: []
|
@@ -105,16 +133,26 @@ files:
|
|
105
133
|
- LICENSE
|
106
134
|
- README.md
|
107
135
|
- Rakefile
|
108
|
-
- foo.rb
|
109
136
|
- lib/client/alumni_stories.rb
|
110
137
|
- lib/client/base_client.rb
|
138
|
+
- lib/client/chapters.rb
|
111
139
|
- lib/client/checkpoints.rb
|
112
140
|
- lib/client/class_factory.rb
|
141
|
+
- lib/client/course_subjects.rb
|
113
142
|
- lib/client/roadmap_sections.rb
|
114
143
|
- lib/client/users.rb
|
115
144
|
- lib/spartacus.rb
|
116
145
|
- spartacus.gemspec
|
117
146
|
- spec/.keep
|
147
|
+
- spec/cassettes/alumni_stories.yml
|
148
|
+
- spec/cassettes/checkpoints.yml
|
149
|
+
- spec/cassettes/roadmap_sections.yml
|
150
|
+
- spec/client/alumni_stories_spec.rb
|
151
|
+
- spec/client/checkpoints_spec.rb
|
152
|
+
- spec/client/roadmap_sections_spec.rb
|
153
|
+
- spec/client/users_spec.rb
|
154
|
+
- spec/spartacus_spec.rb
|
155
|
+
- spec/spec_helper.rb
|
118
156
|
homepage: http://rubygems.org/gems/spartacus
|
119
157
|
licenses:
|
120
158
|
- MIT
|
@@ -135,9 +173,19 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
135
173
|
version: '0'
|
136
174
|
requirements: []
|
137
175
|
rubyforge_project:
|
138
|
-
rubygems_version: 2.4.
|
176
|
+
rubygems_version: 2.4.8
|
139
177
|
signing_key:
|
140
178
|
specification_version: 4
|
141
179
|
summary: A client for the Bloc AP
|
142
180
|
test_files:
|
143
181
|
- spec/.keep
|
182
|
+
- spec/cassettes/alumni_stories.yml
|
183
|
+
- spec/cassettes/checkpoints.yml
|
184
|
+
- spec/cassettes/roadmap_sections.yml
|
185
|
+
- spec/client/alumni_stories_spec.rb
|
186
|
+
- spec/client/checkpoints_spec.rb
|
187
|
+
- spec/client/roadmap_sections_spec.rb
|
188
|
+
- spec/client/users_spec.rb
|
189
|
+
- spec/spartacus_spec.rb
|
190
|
+
- spec/spec_helper.rb
|
191
|
+
has_rdoc:
|
data/foo.rb
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
require_relative 'lib/spartacus'
|
2
|
-
|
3
|
-
sc = Spartacus.new("ben@bloc.io", "6EjixAvNg2oRTJ", "https://www.bloc.io/api/v1")
|
4
|
-
# puts sc.update_password(537104, "chinese1")
|
5
|
-
puts sc.update_checkpoint(129, {"body" => "my awesome checkpoint!!!!!!!!!!!!!!!", "name" => "DDDDDDDDDD"})
|
6
|
-
# checkpoint = sc.create_checkpoint(1, {name: "Super great awesome checkpoint", "body" => "WOOOOOOOHHH!!!!!H"})
|
7
|
-
# puts checkpoint
|
8
|
-
# puts sc.update_user(sc.get_me.id, {name: "Ben INTERNETS"})
|
9
|
-
# puts checkpoint.name
|
10
|
-
# puts sc.update_alum_story_sort_order(10)
|
11
|
-
# puts sc.delete_checkpoint(1788)
|