redbooth-ruby 0.0.5 → 0.1.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 (52) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.travis.yml +0 -1
  4. data/README.md +187 -115
  5. data/lib/redbooth-ruby/client.rb +6 -39
  6. data/lib/redbooth-ruby/client_operations/perform.rb +93 -0
  7. data/lib/redbooth-ruby/file.rb +8 -0
  8. data/lib/redbooth-ruby/helpers.rb +32 -0
  9. data/lib/redbooth-ruby/operations/base.rb +3 -2
  10. data/lib/redbooth-ruby/request/collection.rb +3 -2
  11. data/lib/redbooth-ruby/request/connection.rb +66 -30
  12. data/lib/redbooth-ruby/request/helpers.rb +2 -2
  13. data/lib/redbooth-ruby/request/info.rb +1 -1
  14. data/lib/redbooth-ruby/request/validator.rb +2 -2
  15. data/lib/redbooth-ruby/session.rb +34 -11
  16. data/lib/redbooth-ruby/task_list.rb +28 -0
  17. data/lib/redbooth-ruby/version.rb +2 -2
  18. data/lib/redbooth-ruby.rb +6 -3
  19. data/spec/cassettes/RedboothRuby_File/_download/downloads_a_file.yml +354 -0
  20. data/spec/cassettes/RedboothRuby_Organization/_delete/makes_a_new_DELETE_request_using_the_correct_API_endpoint_to_delete_a_specific_organization.yml +4 -4
  21. data/spec/cassettes/RedboothRuby_Project/_delete/makes_a_new_DELETE_request_using_the_correct_API_endpoint_to_delete_a_specific_project.yml +110 -110
  22. data/spec/cassettes/RedboothRuby_Session/_refresh_access_token_/.yml +55 -0
  23. data/spec/cassettes/RedboothRuby_Session/_refresh_access_token_/call_on_token_refresh_with_the_old_and_new_token.yml +55 -0
  24. data/spec/cassettes/RedboothRuby_Session/_refresh_access_token_/refreshes_the_access_token.yml +55 -0
  25. data/spec/redbooth-ruby/base_spec.rb +5 -5
  26. data/spec/redbooth-ruby/client_operations/metadata_spec.rb +4 -4
  27. data/spec/redbooth-ruby/client_operations/perform_spec.rb +135 -0
  28. data/spec/redbooth-ruby/client_operations/search_spec.rb +4 -4
  29. data/spec/redbooth-ruby/client_spec.rb +2 -43
  30. data/spec/redbooth-ruby/comment_spec.rb +17 -18
  31. data/spec/redbooth-ruby/conversation_spec.rb +16 -16
  32. data/spec/redbooth-ruby/file_spec.rb +29 -22
  33. data/spec/redbooth-ruby/me_spec.rb +2 -2
  34. data/spec/redbooth-ruby/membership_spec.rb +18 -18
  35. data/spec/redbooth-ruby/note_spec.rb +16 -16
  36. data/spec/redbooth-ruby/organization_spec.rb +16 -16
  37. data/spec/redbooth-ruby/person_spec.rb +18 -18
  38. data/spec/redbooth-ruby/project_spec.rb +18 -18
  39. data/spec/redbooth-ruby/request/base_spec.rb +5 -5
  40. data/spec/redbooth-ruby/request/collection_spec.rb +3 -3
  41. data/spec/redbooth-ruby/request/connection_spec.rb +8 -8
  42. data/spec/redbooth-ruby/request/info_spec.rb +13 -13
  43. data/spec/redbooth-ruby/request/response_spec.rb +4 -4
  44. data/spec/redbooth-ruby/request/validator_spec.rb +7 -7
  45. data/spec/redbooth-ruby/session_spec.rb +100 -0
  46. data/spec/redbooth-ruby/subtaks_spec.rb +16 -16
  47. data/spec/redbooth-ruby/task_spec.rb +22 -22
  48. data/spec/redbooth-ruby/user_spec.rb +4 -4
  49. data/spec/redbooth_spec.rb +13 -13
  50. data/spec/spec_helper.rb +2 -3
  51. data/temp/spec/files/test_download.txt +8 -0
  52. metadata +41 -24
@@ -1,4 +1,4 @@
1
- require "spec_helper"
1
+ require 'spec_helper'
2
2
 
3
3
  describe RedboothRuby::Membership, vcr: 'membership' do
4
4
  include_context 'authentication'
@@ -14,7 +14,7 @@ describe RedboothRuby::Membership, vcr: 'membership' do
14
14
  client.membership(:show, id: 1)
15
15
  end
16
16
 
17
- describe "#initialize" do
17
+ describe '#initialize' do
18
18
  subject { membership }
19
19
 
20
20
  it { expect(subject.id).to eql 1 }
@@ -22,11 +22,11 @@ describe RedboothRuby::Membership, vcr: 'membership' do
22
22
  it { expect(subject.role).to eql 'admin' }
23
23
  end
24
24
 
25
- describe ".show" do
25
+ describe '.show' do
26
26
  subject { membership }
27
27
 
28
- it "makes a new GET request using the correct API endpoint to receive a specific membership" do
29
- expect(RedboothRuby).to receive(:request).with(:get, nil, "#{endpoint_name}/1", {}, { session: session }).and_call_original
28
+ it 'makes a new GET request using the correct API endpoint to receive a specific membership' do
29
+ expect(RedboothRuby).to receive(:request).with(:get, nil, "#{ endpoint_name }/1", {}, { session: session }).and_call_original
30
30
  subject
31
31
  end
32
32
 
@@ -35,11 +35,11 @@ describe RedboothRuby::Membership, vcr: 'membership' do
35
35
  it { expect(subject.role).to eql 'admin' }
36
36
  end
37
37
 
38
- describe ".update" do
38
+ describe '.update' do
39
39
  subject { client.membership(:update, id: 6, role: 'admin') }
40
40
 
41
- it "makes a new PUT request using the correct API endpoint to receive a specific membership" do
42
- expect(RedboothRuby).to receive(:request).with(:put, nil, "#{endpoint_name}/6", { role: 'admin' }, { session: session }).and_call_original
41
+ it 'makes a new PUT request using the correct API endpoint to receive a specific membership' do
42
+ expect(RedboothRuby).to receive(:request).with(:put, nil, "#{ endpoint_name }/6", { role: 'admin' }, { session: session }).and_call_original
43
43
  subject
44
44
  end
45
45
 
@@ -47,12 +47,12 @@ describe RedboothRuby::Membership, vcr: 'membership' do
47
47
  it { expect(subject.id).to eql 6 }
48
48
  end
49
49
 
50
- describe ".create" do
50
+ describe '.create' do
51
51
  subject { new_record }
52
52
  let(:response) { double(:response, data: {} )}
53
53
 
54
- it "makes a new POST request using the correct API endpoint to create a specific membership" do
55
- expect(RedboothRuby).to receive(:request).with(:post, nil, "#{endpoint_name}", create_params, { session: session }).and_return(response)
54
+ it 'makes a new POST request using the correct API endpoint to create a specific membership' do
55
+ expect(RedboothRuby).to receive(:request).with(:post, nil, endpoint_name, create_params, { session: session }).and_return(response)
56
56
  subject
57
57
  end
58
58
 
@@ -63,23 +63,23 @@ describe RedboothRuby::Membership, vcr: 'membership' do
63
63
  end
64
64
  end
65
65
 
66
- describe ".delete" do
66
+ describe '.delete' do
67
67
  subject { client.membership(:delete, id: new_record.id) }
68
68
 
69
- it "makes a new DELETE request using the correct API endpoint to delete a specific membership" do
70
- expect(RedboothRuby).to receive(:request).with(:delete, nil, "#{endpoint_name}/#{new_record.id}", {}, { session: session }).and_call_original
69
+ it 'makes a new DELETE request using the correct API endpoint to delete a specific membership' do
70
+ expect(RedboothRuby).to receive(:request).with(:delete, nil, "#{ endpoint_name }/#{ new_record.id }", {}, { session: session }).and_call_original
71
71
  subject
72
72
  end
73
73
  end
74
74
 
75
- describe ".index" do
75
+ describe '.index' do
76
76
  subject { client.membership(:index) }
77
77
 
78
- it "makes a new PUT request using the correct API endpoint to receive a specific membership" do
79
- expect(RedboothRuby).to receive(:request).with(:get, nil, "#{endpoint_name}", {}, { session: session }).and_call_original
78
+ it 'makes a new PUT request using the correct API endpoint to receive a specific membership' do
79
+ expect(RedboothRuby).to receive(:request).with(:get, nil, endpoint_name, {}, { session: session }).and_call_original
80
80
  subject
81
81
  end
82
82
 
83
83
  it { expect(subject.class).to eql RedboothRuby::Request::Collection }
84
84
  end
85
- end
85
+ end
@@ -1,4 +1,4 @@
1
- require "spec_helper"
1
+ require 'spec_helper'
2
2
 
3
3
  describe RedboothRuby::Note, vcr: 'notes' do
4
4
  include_context 'authentication'
@@ -14,7 +14,7 @@ describe RedboothRuby::Note, vcr: 'notes' do
14
14
  client.note(:show, id: 1)
15
15
  end
16
16
 
17
- describe "#initialize" do
17
+ describe '#initialize' do
18
18
  subject { note }
19
19
 
20
20
  it { expect(subject.id).to eql 1 }
@@ -24,11 +24,11 @@ describe RedboothRuby::Note, vcr: 'notes' do
24
24
  it { expect(subject.is_private).to eql false }
25
25
  end
26
26
 
27
- describe ".show" do
27
+ describe '.show' do
28
28
  subject { note }
29
29
 
30
- it "makes a new GET request using the correct API endpoint to receive a specific note" do
31
- expect(RedboothRuby).to receive(:request).with(:get, nil, "#{endpoint}/1", {}, { session: session }).and_call_original
30
+ it 'makes a new GET request using the correct API endpoint to receive a specific note' do
31
+ expect(RedboothRuby).to receive(:request).with(:get, nil, "#{ endpoint }/1", {}, { session: session }).and_call_original
32
32
  subject
33
33
  end
34
34
 
@@ -37,11 +37,11 @@ describe RedboothRuby::Note, vcr: 'notes' do
37
37
  it { expect(subject.project_id).to eql 2 }
38
38
  end
39
39
 
40
- describe ".update" do
40
+ describe '.update' do
41
41
  subject { client.note(:update, id: 2, name: 'new test name') }
42
42
 
43
- it "makes a new PUT request using the correct API endpoint to receive a specific note" do
44
- expect(RedboothRuby).to receive(:request).with(:put, nil, "#{endpoint}/2", { name: 'new test name' }, { session: session }).and_call_original
43
+ it 'makes a new PUT request using the correct API endpoint to receive a specific note' do
44
+ expect(RedboothRuby).to receive(:request).with(:put, nil, "#{ endpoint }/2", { name: 'new test name' }, { session: session }).and_call_original
45
45
  subject
46
46
  end
47
47
 
@@ -49,10 +49,10 @@ describe RedboothRuby::Note, vcr: 'notes' do
49
49
  it { expect(subject.id).to eql 2 }
50
50
  end
51
51
 
52
- describe ".create" do
52
+ describe '.create' do
53
53
  subject { new_record }
54
54
 
55
- it "makes a new POST request using the correct API endpoint to create a specific note" do
55
+ it 'makes a new POST request using the correct API endpoint to create a specific note' do
56
56
  expect(RedboothRuby).to receive(:request).with(:post, nil, endpoint, create_params, { session: session }).and_call_original
57
57
  subject
58
58
  end
@@ -62,23 +62,23 @@ describe RedboothRuby::Note, vcr: 'notes' do
62
62
  it { expect(subject.user_id).to eql 1 }
63
63
  end
64
64
 
65
- describe ".delete" do
65
+ describe '.delete' do
66
66
  subject { client.note(:delete, id: new_record.id) }
67
67
 
68
- it "makes a new DELETE request using the correct API endpoint to delete a specific note" do
69
- expect(RedboothRuby).to receive(:request).with(:delete, nil, "#{endpoint}/#{new_record.id}", {}, { session: session }).and_call_original
68
+ it 'makes a new DELETE request using the correct API endpoint to delete a specific note' do
69
+ expect(RedboothRuby).to receive(:request).with(:delete, nil, "#{ endpoint }/#{ new_record.id }", {}, { session: session }).and_call_original
70
70
  subject
71
71
  end
72
72
  end
73
73
 
74
- describe ".index" do
74
+ describe '.index' do
75
75
  subject { client.note(:index) }
76
76
 
77
- it "makes a new GET request using the correct API endpoint to receive notes collection" do
77
+ it 'makes a new GET request using the correct API endpoint to receive notes collection' do
78
78
  expect(RedboothRuby).to receive(:request).with(:get, nil, endpoint, {}, { session: session }).and_call_original
79
79
  subject
80
80
  end
81
81
 
82
82
  it { expect(subject.class).to eql RedboothRuby::Request::Collection }
83
83
  end
84
- end
84
+ end
@@ -1,4 +1,4 @@
1
- require "spec_helper"
1
+ require 'spec_helper'
2
2
 
3
3
  describe RedboothRuby::Organization, vcr: 'organization' do
4
4
  include_context 'authentication'
@@ -11,7 +11,7 @@ describe RedboothRuby::Organization, vcr: 'organization' do
11
11
  client.organization(:show, id: 1)
12
12
  end
13
13
 
14
- describe "#initialize" do
14
+ describe '#initialize' do
15
15
  subject { organization }
16
16
 
17
17
  it { expect(subject.id).to eql 1 }
@@ -20,11 +20,11 @@ describe RedboothRuby::Organization, vcr: 'organization' do
20
20
  it { expect(subject.domain).to eql nil }
21
21
  end
22
22
 
23
- describe ".show" do
23
+ describe '.show' do
24
24
  subject { organization }
25
25
 
26
- it "makes a new GET request using the correct API endpoint to receive a specific organization" do
27
- expect(RedboothRuby).to receive(:request).with(:get, nil, "organizations/1", {}, { session: session }).and_call_original
26
+ it 'makes a new GET request using the correct API endpoint to receive a specific organization' do
27
+ expect(RedboothRuby).to receive(:request).with(:get, nil, 'organizations/1', {}, { session: session }).and_call_original
28
28
  subject
29
29
  end
30
30
 
@@ -34,11 +34,11 @@ describe RedboothRuby::Organization, vcr: 'organization' do
34
34
  it { expect(subject.domain).to eql nil }
35
35
  end
36
36
 
37
- describe ".update" do
37
+ describe '.update' do
38
38
  subject { client.organization(:update, id: 2, name: 'new test name') }
39
39
 
40
- it "makes a new PUT request using the correct API endpoint to receive a specific organization" do
41
- expect(RedboothRuby).to receive(:request).with(:put, nil, "organizations/2", { name: 'new test name' }, { session: session }).and_call_original
40
+ it 'makes a new PUT request using the correct API endpoint to receive a specific organization' do
41
+ expect(RedboothRuby).to receive(:request).with(:put, nil, 'organizations/2', { name: 'new test name' }, { session: session }).and_call_original
42
42
  subject
43
43
  end
44
44
 
@@ -46,10 +46,10 @@ describe RedboothRuby::Organization, vcr: 'organization' do
46
46
  it { expect(subject.id).to eql 2 }
47
47
  end
48
48
 
49
- describe ".create" do
49
+ describe '.create' do
50
50
  subject { new_organization }
51
51
 
52
- it "makes a new POST request using the correct API endpoint to create a specific organization" do
52
+ it 'makes a new POST request using the correct API endpoint to create a specific organization' do
53
53
  expect(RedboothRuby).to receive(:request).with(:post, nil, "organizations", create_organization_params, { session: session }).and_call_original
54
54
  subject
55
55
  end
@@ -57,24 +57,24 @@ describe RedboothRuby::Organization, vcr: 'organization' do
57
57
  it { expect(subject.name).to eql 'new Organization' }
58
58
  end
59
59
 
60
- describe ".delete" do
60
+ describe '.delete' do
61
61
  subject { client.organization(:delete, id: new_organization.id) }
62
62
  before { allow_any_instance_of(RedboothRuby::Client).to receive(:sleep) }
63
63
 
64
- it "makes a new DELETE request using the correct API endpoint to delete a specific organization" do
64
+ it 'makes a new DELETE request using the correct API endpoint to delete a specific organization' do
65
65
  expect(RedboothRuby).to receive(:request).with(:delete, nil, "organizations/#{new_organization.id}", {}, { session: session }).twice.and_call_original
66
66
  subject
67
67
  end
68
68
  end
69
69
 
70
- describe ".index" do
70
+ describe '.index' do
71
71
  subject { client.organization(:index) }
72
72
 
73
- it "makes a new PUT request using the correct API endpoint to receive a specific organization" do
74
- expect(RedboothRuby).to receive(:request).with(:get, nil, "organizations", {}, { session: session }).and_call_original
73
+ it 'makes a new PUT request using the correct API endpoint to receive a specific organization' do
74
+ expect(RedboothRuby).to receive(:request).with(:get, nil, 'organizations', {}, { session: session }).and_call_original
75
75
  subject
76
76
  end
77
77
 
78
78
  it { expect(subject.class).to eql RedboothRuby::Request::Collection }
79
79
  end
80
- end
80
+ end
@@ -1,4 +1,4 @@
1
- require "spec_helper"
1
+ require 'spec_helper'
2
2
 
3
3
  describe RedboothRuby::Person, vcr: 'person' do
4
4
  include_context 'authentication'
@@ -14,7 +14,7 @@ describe RedboothRuby::Person, vcr: 'person' do
14
14
  client.person(:show, id: 1)
15
15
  end
16
16
 
17
- describe "#initialize" do
17
+ describe '#initialize' do
18
18
  subject { person }
19
19
 
20
20
  it { expect(subject.id).to eql 1 }
@@ -22,11 +22,11 @@ describe RedboothRuby::Person, vcr: 'person' do
22
22
  it { expect(subject.role).to eql 'admin' }
23
23
  end
24
24
 
25
- describe ".show" do
25
+ describe '.show' do
26
26
  subject { person }
27
27
 
28
- it "makes a new GET request using the correct API endpoint to receive a specific person" do
29
- expect(RedboothRuby).to receive(:request).with(:get, nil, "#{endpoint_name}/1", {}, { session: session }).and_call_original
28
+ it 'makes a new GET request using the correct API endpoint to receive a specific person' do
29
+ expect(RedboothRuby).to receive(:request).with(:get, nil, "#{ endpoint_name }/1", {}, { session: session }).and_call_original
30
30
  subject
31
31
  end
32
32
 
@@ -35,11 +35,11 @@ describe RedboothRuby::Person, vcr: 'person' do
35
35
  it { expect(subject.role).to eql 'admin' }
36
36
  end
37
37
 
38
- describe ".update" do
38
+ describe '.update' do
39
39
  subject { client.person(:update, id: 6, role: 'admin') }
40
40
 
41
- it "makes a new PUT request using the correct API endpoint to receive a specific person" do
42
- expect(RedboothRuby).to receive(:request).with(:put, nil, "#{endpoint_name}/6", { role: 'admin' }, { session: session }).and_call_original
41
+ it 'makes a new PUT request using the correct API endpoint to receive a specific person' do
42
+ expect(RedboothRuby).to receive(:request).with(:put, nil, "#{ endpoint_name }/6", { role: 'admin' }, { session: session }).and_call_original
43
43
  subject
44
44
  end
45
45
 
@@ -47,12 +47,12 @@ describe RedboothRuby::Person, vcr: 'person' do
47
47
  it { expect(subject.id).to eql 6 }
48
48
  end
49
49
 
50
- describe ".create" do
50
+ describe '.create' do
51
51
  subject { new_person }
52
52
  let(:response) { double(:response, data: {} )}
53
53
 
54
- it "makes a new POST request using the correct API endpoint to create a specific person" do
55
- expect(RedboothRuby).to receive(:request).with(:post, nil, "#{endpoint_name}", create_params, { session: session }).and_return(response)
54
+ it 'makes a new POST request using the correct API endpoint to create a specific person' do
55
+ expect(RedboothRuby).to receive(:request).with(:post, nil, endpoint_name, create_params, { session: session }).and_return(response)
56
56
  subject
57
57
  end
58
58
 
@@ -63,23 +63,23 @@ describe RedboothRuby::Person, vcr: 'person' do
63
63
  end
64
64
  end
65
65
 
66
- describe ".delete" do
66
+ describe '.delete' do
67
67
  subject { client.person(:delete, id: new_person.id) }
68
68
 
69
- it "makes a new DELETE request using the correct API endpoint to delete a specific person" do
70
- expect(RedboothRuby).to receive(:request).with(:delete, nil, "#{endpoint_name}/#{new_person.id}", {}, { session: session }).and_call_original
69
+ it 'makes a new DELETE request using the correct API endpoint to delete a specific person' do
70
+ expect(RedboothRuby).to receive(:request).with(:delete, nil, "#{ endpoint_name }/#{ new_person.id }", {}, { session: session }).and_call_original
71
71
  subject
72
72
  end
73
73
  end
74
74
 
75
- describe ".index" do
75
+ describe '.index' do
76
76
  subject { client.person(:index) }
77
77
 
78
- it "makes a new PUT request using the correct API endpoint to receive a specific person" do
79
- expect(RedboothRuby).to receive(:request).with(:get, nil, "#{endpoint_name}", {}, { session: session }).and_call_original
78
+ it 'makes a new PUT request using the correct API endpoint to receive a specific person' do
79
+ expect(RedboothRuby).to receive(:request).with(:get, nil, endpoint_name, {}, { session: session }).and_call_original
80
80
  subject
81
81
  end
82
82
 
83
83
  it { expect(subject.class).to eql RedboothRuby::Request::Collection }
84
84
  end
85
- end
85
+ end
@@ -1,4 +1,4 @@
1
- require "spec_helper"
1
+ require 'spec_helper'
2
2
 
3
3
  describe RedboothRuby::Project, vcr: 'project' do
4
4
  include_context 'authentication'
@@ -13,7 +13,7 @@ describe RedboothRuby::Project, vcr: 'project' do
13
13
  client.project(:show, id: 1)
14
14
  end
15
15
 
16
- describe "#initialize" do
16
+ describe '#initialize' do
17
17
  subject { project }
18
18
 
19
19
  it { expect(subject.id).to eql 1 }
@@ -21,11 +21,11 @@ describe RedboothRuby::Project, vcr: 'project' do
21
21
  it { expect(subject.permalink).to eql 'general' }
22
22
  end
23
23
 
24
- describe ".show" do
24
+ describe '.show' do
25
25
  subject { project }
26
26
 
27
- it "makes a new GET request using the correct API endpoint to receive a specific project" do
28
- expect(RedboothRuby).to receive(:request).with(:get, nil, "#{endpoint_name}/1", {}, { session: session }).and_call_original
27
+ it 'makes a new GET request using the correct API endpoint to receive a specific project' do
28
+ expect(RedboothRuby).to receive(:request).with(:get, nil, "#{ endpoint_name }/1", {}, { session: session }).and_call_original
29
29
  subject
30
30
  end
31
31
 
@@ -34,11 +34,11 @@ describe RedboothRuby::Project, vcr: 'project' do
34
34
  it { expect(subject.permalink).to eql 'general' }
35
35
  end
36
36
 
37
- describe ".update" do
37
+ describe '.update' do
38
38
  subject { client.project(:update, id: 2, name: 'new test name') }
39
39
 
40
- it "makes a new PUT request using the correct API endpoint to receive a specific project" do
41
- expect(RedboothRuby).to receive(:request).with(:put, nil, "#{endpoint_name}/2", { name: 'new test name' }, { session: session }).and_call_original
40
+ it 'makes a new PUT request using the correct API endpoint to receive a specific project' do
41
+ expect(RedboothRuby).to receive(:request).with(:put, nil, "#{ endpoint_name }/2", { name: 'new test name' }, { session: session }).and_call_original
42
42
  subject
43
43
  end
44
44
 
@@ -46,35 +46,35 @@ describe RedboothRuby::Project, vcr: 'project' do
46
46
  it { expect(subject.id).to eql 2 }
47
47
  end
48
48
 
49
- describe ".create" do
49
+ describe '.create' do
50
50
  subject { new_project }
51
51
 
52
- it "makes a new POST request using the correct API endpoint to create a specific project" do
53
- expect(RedboothRuby).to receive(:request).with(:post, nil, "#{endpoint_name}", create_params, { session: session }).and_call_original
52
+ it 'makes a new POST request using the correct API endpoint to create a specific project' do
53
+ expect(RedboothRuby).to receive(:request).with(:post, nil, endpoint_name, create_params, { session: session }).and_call_original
54
54
  subject
55
55
  end
56
56
 
57
57
  it { expect(subject.name).to eql 'new Project' }
58
58
  end
59
59
 
60
- describe ".delete" do
60
+ describe '.delete' do
61
61
  subject { client.project(:delete, id: new_project.id) }
62
62
  before { allow_any_instance_of(RedboothRuby::Client).to receive(:sleep) }
63
63
 
64
- it "makes a new DELETE request using the correct API endpoint to delete a specific project" do
65
- expect(RedboothRuby).to receive(:request).with(:delete, nil, "#{endpoint_name}/#{new_project.id}", {}, { session: session }).at_least(:twice).and_call_original
64
+ it 'makes a new DELETE request using the correct API endpoint to delete a specific project' do
65
+ expect(RedboothRuby).to receive(:request).with(:delete, nil, "#{ endpoint_name }/#{ new_project.id }", {}, { session: session }).at_least(:twice).and_call_original
66
66
  subject
67
67
  end
68
68
  end
69
69
 
70
- describe ".index" do
70
+ describe '.index' do
71
71
  subject { client.project(:index) }
72
72
 
73
- it "makes a new PUT request using the correct API endpoint to receive a specific project" do
74
- expect(RedboothRuby).to receive(:request).with(:get, nil, "#{endpoint_name}", {}, { session: session }).and_call_original
73
+ it 'makes a new PUT request using the correct API endpoint to receive a specific project' do
74
+ expect(RedboothRuby).to receive(:request).with(:get, nil, endpoint_name, {}, { session: session }).and_call_original
75
75
  subject
76
76
  end
77
77
 
78
78
  it { expect(subject.class).to eql RedboothRuby::Request::Collection }
79
79
  end
80
- end
80
+ end
@@ -1,4 +1,4 @@
1
- require "spec_helper"
1
+ require 'spec_helper'
2
2
 
3
3
  describe RedboothRuby::Request::Base do
4
4
  let(:consumer_key) { '_your_consumen_key_' }
@@ -18,12 +18,12 @@ describe RedboothRuby::Request::Base do
18
18
  end
19
19
  end
20
20
 
21
- describe "#perform" do
21
+ describe '#perform' do
22
22
  it 'raises AuthenticationError if request is not valid' do
23
23
  allow(request_base).to receive(:valid?).and_return(false)
24
24
  expect{request_base.perform}.to raise_error{ RedboothRuby::AuthenticationError }
25
25
  end
26
- it "performs an https request" do
26
+ it 'performs an https request' do
27
27
  allow_any_instance_of(RedboothRuby::Request::Base).to receive(:valid?).and_return(true)
28
28
 
29
29
  expect(connection).to receive(:set_request_data)
@@ -34,7 +34,7 @@ describe RedboothRuby::Request::Base do
34
34
  end
35
35
  end
36
36
 
37
- describe "#valid?" do
37
+ describe '#valid?' do
38
38
  it 'is not valid if no info object given' do
39
39
  expect(RedboothRuby::Request::Base.new(nil)).to_not be_valid
40
40
  end
@@ -50,4 +50,4 @@ describe RedboothRuby::Request::Base do
50
50
  expect(request_base).to be_valid
51
51
  end
52
52
  end
53
- end
53
+ end
@@ -1,10 +1,10 @@
1
- require "spec_helper"
1
+ require 'spec_helper'
2
2
 
3
3
  describe RedboothRuby::Request::Collection, vcr: 'collection' do
4
4
  include_context 'authentication'
5
5
  let(:collection) { client.task(:index, per_page: 2) }
6
6
 
7
- describe "#initialize" do
7
+ describe '#initialize' do
8
8
  subject { collection }
9
9
 
10
10
  it { should be_a RedboothRuby::Request::Collection }
@@ -101,4 +101,4 @@ describe RedboothRuby::Request::Collection, vcr: 'collection' do
101
101
  end
102
102
  end
103
103
 
104
- end
104
+ end
@@ -1,4 +1,4 @@
1
- require "spec_helper"
1
+ require 'spec_helper'
2
2
 
3
3
  describe RedboothRuby::Request::Connection do
4
4
  let(:consumer_key) { '_your_consumen_key_' }
@@ -21,7 +21,7 @@ describe RedboothRuby::Request::Connection do
21
21
  let(:client) { RedboothRuby::Client.new(session) }
22
22
  let(:session) { RedboothRuby::Session.new(access_token) }
23
23
  let(:redbooth_protocol) { RedboothRuby.configuration[:use_ssl] ? 'https' : 'http' }
24
- let(:redbooth_url) { "#{redbooth_protocol}://#{RedboothRuby.configuration[:api_base]}/#{RedboothRuby.configuration[:api_base_path]}/#{RedboothRuby.configuration[:api_version]}" }
24
+ let(:redbooth_url) { "#{ redbooth_protocol }://#{ RedboothRuby.configuration[:api_base] }/#{ RedboothRuby.configuration[:api_base_path] }/#{ RedboothRuby.configuration[:api_version] }" }
25
25
 
26
26
  before :each do
27
27
  RedboothRuby.config do |configuration|
@@ -64,9 +64,9 @@ describe RedboothRuby::Request::Connection do
64
64
  expect(connection.request_data).to eq(
65
65
  [
66
66
  :post,
67
- "#{redbooth_url}/some/path",
68
- { body: { email: "abc_abc.com",
69
- event_types: ["user.created", "user.failed", "team.created", "documents.available"] }
67
+ "#{ redbooth_url }/some/path",
68
+ { body: { email: 'abc_abc.com',
69
+ event_types: ['user.created', 'user.failed', 'team.created', 'documents.available'] }
70
70
  }
71
71
  ]
72
72
  )
@@ -75,8 +75,8 @@ describe RedboothRuby::Request::Connection do
75
75
 
76
76
  def params
77
77
  {
78
- email: "abc_abc.com",
79
- event_types: ["user.created","user.failed", "team.created", "documents.available"]
78
+ email: 'abc_abc.com',
79
+ event_types: ['user.created', 'user.failed', 'team.created', 'documents.available']
80
80
  }
81
81
  end
82
- end
82
+ end
@@ -1,27 +1,27 @@
1
- require "spec_helper"
1
+ require 'spec_helper'
2
2
 
3
3
  describe RedboothRuby::Request::Info do
4
- describe "#url" do
5
- it "constructs the url" do
6
- info = RedboothRuby::Request::Info.new(:get, nil, "random", {id: 1} )
4
+ describe '#url' do
5
+ it 'constructs the url' do
6
+ info = RedboothRuby::Request::Info.new(:get, nil, 'random', { id: 1 })
7
7
 
8
8
  expect(info.url).to match /random/
9
9
  end
10
10
  end
11
11
 
12
- describe "#path_with_params" do
13
- it "does nothing when no params" do
14
- info = RedboothRuby::Request::Info.new(:get, nil, "random", nil)
15
- path = "/path/to/someplace"
12
+ describe '#path_with_params' do
13
+ it 'does nothing when no params' do
14
+ info = RedboothRuby::Request::Info.new(:get, nil, 'random', nil)
15
+ path = '/path/to/someplace'
16
16
 
17
17
  expect(info.path_with_params(path, {})).to eq path
18
18
  end
19
19
 
20
- it "constructs the path with params" do
21
- info = RedboothRuby::Request::Info.new(:get, nil, "random", nil)
22
- path = "/path/to/someplace"
20
+ it 'constructs the path with params' do
21
+ info = RedboothRuby::Request::Info.new(:get, nil, 'random', nil)
22
+ path = '/path/to/someplace'
23
23
 
24
- expect(info.path_with_params(path, {random: "stuff"})).to eq "#{path}?random=stuff"
24
+ expect(info.path_with_params(path, { random: 'stuff' })).to eq "#{ path }?random=stuff"
25
25
  end
26
26
  end
27
- end
27
+ end
@@ -1,4 +1,4 @@
1
- require "spec_helper"
1
+ require 'spec_helper'
2
2
 
3
3
  describe RedboothRuby::Request::Response do
4
4
  let(:headers) { {} }
@@ -8,11 +8,11 @@ describe RedboothRuby::Request::Response do
8
8
  status: status,
9
9
  headers: headers) }
10
10
 
11
- describe "#initialize" do
11
+ describe '#initialize' do
12
12
  subject { response }
13
13
 
14
14
  it { should be_a RedboothRuby::Request::Response }
15
- it { expect(subject.data).to eq("response" => "ok") }
15
+ it { expect(subject.data).to eq('response' => 'ok') }
16
16
  it { expect(subject.body).to eq(body) }
17
17
  it { expect(subject.headers).to eq(headers) }
18
18
  it { expect(subject.status).to eq(status) }
@@ -29,4 +29,4 @@ describe RedboothRuby::Request::Response do
29
29
  it { expect(subject.data).to be_empty }
30
30
  end
31
31
  end
32
- end
32
+ end
@@ -1,16 +1,16 @@
1
- require "spec_helper"
1
+ require 'spec_helper'
2
2
 
3
3
  describe RedboothRuby::Request::Validator do
4
- let(:info) { RedboothRuby::Request::Info.new(:get, nil, "random", OpenStruct.new(id: 1)) }
4
+ let(:info) { RedboothRuby::Request::Info.new(:get, nil, 'random', OpenStruct.new(id: 1)) }
5
5
  let(:validator) { RedboothRuby::Request::Validator.new info }
6
6
  let(:headers) { {} }
7
7
  let(:response) { OpenStruct.new(body: '{"response":"ok"}', status: 200, headers: headers) }
8
8
 
9
- describe "#validated_response_for" do
9
+ describe '#validated_response_for' do
10
10
  subject { validator.validated_response_for(response) }
11
11
 
12
12
  it { should be_a RedboothRuby::Request::Response }
13
- it { expect(subject.data).to eq("response" => "ok") }
13
+ it { expect(subject.data).to eq('response' => 'ok') }
14
14
 
15
15
  context 'where 401 status code returned' do
16
16
  let(:response) { OpenStruct.new(body: '{"error":{"message":"Unauthorized"}}', status: 401, headers: headers) }
@@ -20,13 +20,13 @@ describe RedboothRuby::Request::Validator do
20
20
  context 'where token was expired' do
21
21
  before { headers['WWW-Authenticate'] = %{Bearer realm="Doorkeeper", error="invalid_token", error_description="The access token was expired"} }
22
22
 
23
- it { expect{subject}.to raise_error(RedboothRuby::OauhtTokenExpired) }
23
+ it { expect{subject}.to raise_error(RedboothRuby::OauthTokenExpired) }
24
24
  end
25
25
 
26
26
  context 'where token was revoked' do
27
27
  before { headers['WWW-Authenticate'] = %{Bearer realm="Doorkeeper", error="invalid_token", error_description="The access token was revoked"} }
28
28
 
29
- it { expect{subject}.to raise_error(RedboothRuby::OauhtTokenRevoked) }
29
+ it { expect{subject}.to raise_error(RedboothRuby::OauthTokenRevoked) }
30
30
  end
31
31
  end
32
32
 
@@ -42,4 +42,4 @@ describe RedboothRuby::Request::Validator do
42
42
  it { expect{subject}.to raise_error(RedboothRuby::NotFound) }
43
43
  end
44
44
  end
45
- end
45
+ end