redbooth-ruby 0.0.2 → 0.0.3

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 (136) hide show
  1. checksums.yaml +4 -4
  2. data/spec/cassettes/RedboothRuby_Conversation/_create/.yml +47 -0
  3. data/spec/cassettes/RedboothRuby_Conversation/_create/makes_a_new_POST_request_using_the_correct_API_endpoint_to_create_a_specific_conversation.yml +47 -0
  4. data/spec/cassettes/RedboothRuby_Conversation/_delete/makes_a_new_DELETE_request_using_the_correct_API_endpoint_to_delete_a_specific_conversation.yml +84 -0
  5. data/spec/cassettes/RedboothRuby_Conversation/_index/.yml +99 -0
  6. data/spec/cassettes/RedboothRuby_Conversation/_index/makes_a_new_GET_request_using_the_correct_API_endpoint_to_receive_conversations_collection.yml +99 -0
  7. data/spec/cassettes/RedboothRuby_Conversation/_initialize/.yml +45 -0
  8. data/spec/cassettes/RedboothRuby_Conversation/_show/.yml +45 -0
  9. data/spec/cassettes/RedboothRuby_Conversation/_show/makes_a_new_GET_request_using_the_correct_API_endpoint_to_receive_a_specific_conversation.yml +45 -0
  10. data/spec/cassettes/RedboothRuby_Conversation/_update/.yml +47 -0
  11. data/spec/cassettes/RedboothRuby_Conversation/_update/makes_a_new_PUT_request_using_the_correct_API_endpoint_to_receive_a_specific_conversation.yml +47 -0
  12. data/spec/cassettes/{Redbooth_Me → RedboothRuby_Me}/_initialize/.yml +0 -0
  13. data/spec/cassettes/{Redbooth_Me → RedboothRuby_Me}/_show/.yml +0 -0
  14. data/spec/cassettes/{Redbooth_Me → RedboothRuby_Me}/_show/makes_a_new_GET_request_using_the_correct_API_endpoint_to_receive_a_specific_user.yml +0 -0
  15. data/spec/cassettes/{Redbooth_Me → RedboothRuby_Me}/_update/.yml +0 -0
  16. data/spec/cassettes/{Redbooth_Me → RedboothRuby_Me}/_update/integration/.yml +0 -0
  17. data/spec/cassettes/RedboothRuby_Membership/_create/integration/.yml +83 -0
  18. data/spec/cassettes/RedboothRuby_Membership/_delete/makes_a_new_DELETE_request_using_the_correct_API_endpoint_to_delete_a_specific_membership.yml +83 -0
  19. data/spec/cassettes/RedboothRuby_Membership/_index/.yml +58 -0
  20. data/spec/cassettes/RedboothRuby_Membership/_index/makes_a_new_PUT_request_using_the_correct_API_endpoint_to_receive_a_specific_membership.yml +58 -0
  21. data/spec/cassettes/RedboothRuby_Membership/_initialize/.yml +44 -0
  22. data/spec/cassettes/RedboothRuby_Membership/_show/.yml +44 -0
  23. data/spec/cassettes/RedboothRuby_Membership/_show/makes_a_new_GET_request_using_the_correct_API_endpoint_to_receive_a_specific_membership.yml +44 -0
  24. data/spec/cassettes/RedboothRuby_Membership/_update/.yml +46 -0
  25. data/spec/cassettes/RedboothRuby_Membership/_update/makes_a_new_PUT_request_using_the_correct_API_endpoint_to_receive_a_specific_membership.yml +46 -0
  26. data/spec/cassettes/{Redbooth_Organization → RedboothRuby_Organization}/_create/.yml +0 -0
  27. data/spec/cassettes/{Redbooth_Organization → RedboothRuby_Organization}/_create/makes_a_new_POST_request_using_the_correct_API_endpoint_to_create_a_specific_organization.yml +0 -0
  28. data/spec/cassettes/{Redbooth_Organization → RedboothRuby_Organization}/_delete/makes_a_new_DELETE_request_using_the_correct_API_endpoint_to_delete_a_specific_organization.yml +0 -0
  29. data/spec/cassettes/{Redbooth_Organization → RedboothRuby_Organization}/_index/.yml +0 -0
  30. data/spec/cassettes/{Redbooth_Organization → RedboothRuby_Organization}/_index/makes_a_new_PUT_request_using_the_correct_API_endpoint_to_receive_a_specific_organization.yml +0 -0
  31. data/spec/cassettes/{Redbooth_Organization → RedboothRuby_Organization}/_initialize/.yml +0 -0
  32. data/spec/cassettes/{Redbooth_Organization → RedboothRuby_Organization}/_show/.yml +0 -0
  33. data/spec/cassettes/{Redbooth_Organization → RedboothRuby_Organization}/_show/makes_a_new_GET_request_using_the_correct_API_endpoint_to_receive_a_specific_organization.yml +0 -0
  34. data/spec/cassettes/{Redbooth_Organization → RedboothRuby_Organization}/_update/.yml +0 -0
  35. data/spec/cassettes/{Redbooth_Organization → RedboothRuby_Organization}/_update/makes_a_new_PUT_request_using_the_correct_API_endpoint_to_receive_a_specific_organization.yml +0 -0
  36. data/spec/cassettes/{Redbooth_Person → RedboothRuby_Person}/_create/integration/.yml +0 -0
  37. data/spec/cassettes/{Redbooth_Person → RedboothRuby_Person}/_create/makes_a_new_POST_request_using_the_correct_API_endpoint_to_create_a_specific_person.yml +0 -0
  38. data/spec/cassettes/{Redbooth_Person → RedboothRuby_Person}/_delete/makes_a_new_DELETE_request_using_the_correct_API_endpoint_to_delete_a_specific_person.yml +0 -0
  39. data/spec/cassettes/{Redbooth_Person → RedboothRuby_Person}/_index/.yml +0 -0
  40. data/spec/cassettes/{Redbooth_Person → RedboothRuby_Person}/_index/makes_a_new_PUT_request_using_the_correct_API_endpoint_to_receive_a_specific_person.yml +0 -0
  41. data/spec/cassettes/{Redbooth_Person → RedboothRuby_Person}/_initialize/.yml +0 -0
  42. data/spec/cassettes/{Redbooth_Person → RedboothRuby_Person}/_show/.yml +0 -0
  43. data/spec/cassettes/{Redbooth_Person → RedboothRuby_Person}/_show/makes_a_new_GET_request_using_the_correct_API_endpoint_to_receive_a_specific_person.yml +0 -0
  44. data/spec/cassettes/{Redbooth_Person → RedboothRuby_Person}/_update/.yml +0 -0
  45. data/spec/cassettes/{Redbooth_Person → RedboothRuby_Person}/_update/makes_a_new_PUT_request_using_the_correct_API_endpoint_to_receive_a_specific_person.yml +0 -0
  46. data/spec/cassettes/{Redbooth_Project → RedboothRuby_Project}/_create/.yml +0 -0
  47. data/spec/cassettes/{Redbooth_Project → RedboothRuby_Project}/_create/makes_a_new_POST_request_using_the_correct_API_endpoint_to_create_a_specific_project.yml +0 -0
  48. data/spec/cassettes/{Redbooth_Project → RedboothRuby_Project}/_delete/makes_a_new_DELETE_request_using_the_correct_API_endpoint_to_delete_a_specific_project.yml +0 -0
  49. data/spec/cassettes/{Redbooth_Project → RedboothRuby_Project}/_index/.yml +0 -0
  50. data/spec/cassettes/{Redbooth_Project → RedboothRuby_Project}/_index/makes_a_new_PUT_request_using_the_correct_API_endpoint_to_receive_a_specific_project.yml +0 -0
  51. data/spec/cassettes/{Redbooth_Project → RedboothRuby_Project}/_initialize/.yml +0 -0
  52. data/spec/cassettes/{Redbooth_Project → RedboothRuby_Project}/_show/.yml +0 -0
  53. data/spec/cassettes/{Redbooth_Project → RedboothRuby_Project}/_show/makes_a_new_GET_request_using_the_correct_API_endpoint_to_receive_a_specific_project.yml +0 -0
  54. data/spec/cassettes/{Redbooth_Project → RedboothRuby_Project}/_update/.yml +0 -0
  55. data/spec/cassettes/{Redbooth_Project → RedboothRuby_Project}/_update/makes_a_new_PUT_request_using_the_correct_API_endpoint_to_receive_a_specific_project.yml +0 -0
  56. data/spec/cassettes/{Redbooth_Request_Collection → RedboothRuby_Request_Collection}/_all/.yml +0 -0
  57. data/spec/cassettes/{Redbooth_Request_Collection → RedboothRuby_Request_Collection}/_count/.yml +0 -0
  58. data/spec/cassettes/{Redbooth_Request_Collection → RedboothRuby_Request_Collection}/_current_page/.yml +0 -0
  59. data/spec/cassettes/{Redbooth_Request_Collection → RedboothRuby_Request_Collection}/_current_page/where_endpoint_is_not_paginated/.yml +0 -0
  60. data/spec/cassettes/{Redbooth_Request_Collection → RedboothRuby_Request_Collection}/_initialize/.yml +0 -0
  61. data/spec/cassettes/{Redbooth_Request_Collection → RedboothRuby_Request_Collection}/_next_page/.yml +0 -0
  62. data/spec/cassettes/{Redbooth_Request_Collection → RedboothRuby_Request_Collection}/_next_page/where_endpoint_is_not_paginated/.yml +0 -0
  63. data/spec/cassettes/{Redbooth_Request_Collection → RedboothRuby_Request_Collection}/_next_page/where_is_the_last_page/.yml +0 -0
  64. data/spec/cassettes/{Redbooth_Request_Collection → RedboothRuby_Request_Collection}/_per_page/.yml +0 -0
  65. data/spec/cassettes/{Redbooth_Request_Collection → RedboothRuby_Request_Collection}/_per_page/where_endpoint_is_not_paginated/.yml +0 -0
  66. data/spec/cassettes/{Redbooth_Request_Collection → RedboothRuby_Request_Collection}/_prev_page/.yml +0 -0
  67. data/spec/cassettes/{Redbooth_Request_Collection → RedboothRuby_Request_Collection}/_prev_page/where_endpoint_is_not_paginated/.yml +0 -0
  68. data/spec/cassettes/{Redbooth_Request_Collection → RedboothRuby_Request_Collection}/_prev_page/where_is_the_first_page/.yml +0 -0
  69. data/spec/cassettes/{Redbooth_Request_Collection → RedboothRuby_Request_Collection}/_total_pages/.yml +0 -0
  70. data/spec/cassettes/{Redbooth_Request_Collection → RedboothRuby_Request_Collection}/_total_pages/where_endpoint_is_not_paginated/.yml +0 -0
  71. data/spec/cassettes/{Redbooth_Task → RedboothRuby_Task}/_create/.yml +0 -0
  72. data/spec/cassettes/{Redbooth_Task → RedboothRuby_Task}/_create/makes_a_new_POST_request_using_the_correct_API_endpoint_to_create_a_specific_task.yml +0 -0
  73. data/spec/cassettes/{Redbooth_Task → RedboothRuby_Task}/_delete/makes_a_new_DELETE_request_using_the_correct_API_endpoint_to_delete_a_specific_task.yml +0 -0
  74. data/spec/cassettes/{Redbooth_Task → RedboothRuby_Task}/_index/.yml +0 -0
  75. data/spec/cassettes/{Redbooth_Task → RedboothRuby_Task}/_index/makes_a_new_PUT_request_using_the_correct_API_endpoint_to_receive_a_specific_task.yml +0 -0
  76. data/spec/cassettes/{Redbooth_Task → RedboothRuby_Task}/_initialize/.yml +0 -0
  77. data/spec/cassettes/{Redbooth_Task → RedboothRuby_Task}/_show/makes_a_new_GET_request_using_the_correct_API_endpoint_to_receive_a_specific_task.yml +0 -0
  78. data/spec/cassettes/{Redbooth_Task → RedboothRuby_Task}/_show/returns_a_task_with_the_correct_assigned_id.yml +0 -0
  79. data/spec/cassettes/{Redbooth_Task → RedboothRuby_Task}/_show/returns_a_task_with_the_correct_id.yml +0 -0
  80. data/spec/cassettes/{Redbooth_Task → RedboothRuby_Task}/_show/returns_a_task_with_the_correct_name.yml +0 -0
  81. data/spec/cassettes/{Redbooth_Task → RedboothRuby_Task}/_show/returns_a_task_with_the_correct_project_id.yml +0 -0
  82. data/spec/cassettes/{Redbooth_Task → RedboothRuby_Task}/_update/.yml +0 -0
  83. data/spec/cassettes/{Redbooth_Task → RedboothRuby_Task}/_update/makes_a_new_PUT_request_using_the_correct_API_endpoint_to_receive_a_specific_task.yml +0 -0
  84. data/spec/cassettes/{Redbooth_User → RedboothRuby_User}/_create/.yml +0 -0
  85. data/spec/cassettes/{Redbooth_User → RedboothRuby_User}/_create/makes_a_new_POST_request_using_the_correct_API_endpoint_to_create_a_specific_task.yml +0 -0
  86. data/spec/cassettes/{Redbooth_User → RedboothRuby_User}/_create/makes_a_new_PUT_request_using_the_correct_API_endpoint_to_receive_a_specific_task.yml +0 -0
  87. data/spec/cassettes/{Redbooth_User → RedboothRuby_User}/_create/name/.yml +0 -0
  88. data/spec/cassettes/{Redbooth_User → RedboothRuby_User}/_create/project_id/.yml +0 -0
  89. data/spec/cassettes/{Redbooth_User → RedboothRuby_User}/_create/task_list_id/.yml +0 -0
  90. data/spec/cassettes/{Redbooth_User → RedboothRuby_User}/_delete/makes_a_new_DELETE_request_using_the_correct_API_endpoint_to_delete_a_specific_task.yml +0 -0
  91. data/spec/cassettes/{Redbooth_User → RedboothRuby_User}/_index/.yml +0 -0
  92. data/spec/cassettes/{Redbooth_User → RedboothRuby_User}/_index/class/.yml +0 -0
  93. data/spec/cassettes/{Redbooth_User → RedboothRuby_User}/_index/makes_a_new_PUT_request_using_the_correct_API_endpoint_to_receive_a_specific_task.yml +0 -0
  94. data/spec/cassettes/{Redbooth_User → RedboothRuby_User}/_initialize/.yml +0 -0
  95. data/spec/cassettes/{Redbooth_User → RedboothRuby_User}/_initialize/assigned_id/.yml +0 -0
  96. data/spec/cassettes/{Redbooth_User → RedboothRuby_User}/_initialize/description/.yml +0 -0
  97. data/spec/cassettes/{Redbooth_User → RedboothRuby_User}/_initialize/due_on/.yml +0 -0
  98. data/spec/cassettes/{Redbooth_User → RedboothRuby_User}/_initialize/id/.yml +0 -0
  99. data/spec/cassettes/{Redbooth_User → RedboothRuby_User}/_initialize/initializes_all_attributes_correctly.yml +0 -0
  100. data/spec/cassettes/{Redbooth_User → RedboothRuby_User}/_initialize/name/.yml +0 -0
  101. data/spec/cassettes/{Redbooth_User → RedboothRuby_User}/_initialize/project_id/.yml +0 -0
  102. data/spec/cassettes/{Redbooth_User → RedboothRuby_User}/_show/.yml +0 -0
  103. data/spec/cassettes/{Redbooth_User → RedboothRuby_User}/_show/makes_a_new_GET_request_using_the_correct_API_endpoint_to_receive_a_specific_task.yml +0 -0
  104. data/spec/cassettes/{Redbooth_User → RedboothRuby_User}/_show/makes_a_new_GET_request_using_the_correct_API_endpoint_to_receive_a_specific_user.yml +0 -0
  105. data/spec/cassettes/{Redbooth_User → RedboothRuby_User}/_show/returns_a_task_with_the_correct_assigned_id.yml +0 -0
  106. data/spec/cassettes/{Redbooth_User → RedboothRuby_User}/_show/returns_a_task_with_the_correct_id.yml +0 -0
  107. data/spec/cassettes/{Redbooth_User → RedboothRuby_User}/_show/returns_a_task_with_the_correct_name.yml +0 -0
  108. data/spec/cassettes/{Redbooth_User → RedboothRuby_User}/_show/returns_a_task_with_the_correct_project_id.yml +0 -0
  109. data/spec/cassettes/{Redbooth_User → RedboothRuby_User}/_show/returns_a_user_with_the_correct_email.yml +0 -0
  110. data/spec/cassettes/{Redbooth_User → RedboothRuby_User}/_show/returns_a_user_with_the_correct_first_name.yml +0 -0
  111. data/spec/cassettes/{Redbooth_User → RedboothRuby_User}/_show/returns_a_user_with_the_correct_id.yml +0 -0
  112. data/spec/cassettes/{Redbooth_User → RedboothRuby_User}/_show/returns_a_user_with_the_correct_last_name.yml +0 -0
  113. data/spec/cassettes/{Redbooth_User → RedboothRuby_User}/_update/.yml +0 -0
  114. data/spec/cassettes/{Redbooth_User → RedboothRuby_User}/_update/id/.yml +0 -0
  115. data/spec/cassettes/{Redbooth_User → RedboothRuby_User}/_update/makes_a_new_PUT_request_using_the_correct_API_endpoint_to_receive_a_specific_task.yml +0 -0
  116. data/spec/cassettes/{Redbooth_User → RedboothRuby_User}/_update/name/.yml +0 -0
  117. data/spec/{redbooth → redbooth-ruby}/base_spec.rb +2 -2
  118. data/spec/{redbooth → redbooth-ruby}/client_spec.rb +11 -11
  119. data/spec/redbooth-ruby/conversation_spec.rb +83 -0
  120. data/spec/{redbooth → redbooth-ruby}/me_spec.rb +4 -4
  121. data/spec/redbooth-ruby/membership_spec.rb +85 -0
  122. data/spec/{redbooth → redbooth-ruby}/organization_spec.rb +8 -8
  123. data/spec/{redbooth → redbooth-ruby}/person_spec.rb +7 -7
  124. data/spec/{redbooth → redbooth-ruby}/project_spec.rb +8 -8
  125. data/spec/{redbooth → redbooth-ruby}/request/base_spec.rb +9 -9
  126. data/spec/{redbooth → redbooth-ruby}/request/collection_spec.rb +7 -7
  127. data/spec/{redbooth → redbooth-ruby}/request/connection_spec.rb +10 -10
  128. data/spec/{redbooth → redbooth-ruby}/request/info_spec.rb +4 -4
  129. data/spec/{redbooth → redbooth-ruby}/request/response_spec.rb +3 -3
  130. data/spec/{redbooth → redbooth-ruby}/request/validator_spec.rb +9 -9
  131. data/spec/{redbooth → redbooth-ruby}/task_spec.rb +12 -12
  132. data/spec/{redbooth → redbooth-ruby}/user_spec.rb +4 -4
  133. data/spec/redbooth_spec.rb +12 -12
  134. data/spec/shared/authentication_context.rb +3 -3
  135. data/spec/spec_helper.rb +5 -1
  136. metadata +264 -222
@@ -0,0 +1,83 @@
1
+ require "spec_helper"
2
+
3
+ describe RedboothRuby::Conversation, vcr: 'conversations' do
4
+ include_context 'authentication'
5
+
6
+ let(:create_params) do
7
+ { project_id: 2,
8
+ name: 'new created conversation' }
9
+ end
10
+ let(:new_record) { client.conversation(:create, create_params) }
11
+ let(:endpoint) { 'conversations' }
12
+ let(:conversation) do
13
+ client.conversation(:show, id: 1)
14
+ end
15
+
16
+ describe "#initialize" do
17
+ subject { conversation }
18
+
19
+ it { expect(subject.id).to eql 1 }
20
+ it { expect(subject.name).to eql 'Project Welcome' }
21
+ it { expect(subject.project_id).to eql 2 }
22
+ it { expect(subject.user_id).to eql 1 }
23
+ it { expect(subject.is_private).to eql false }
24
+ end
25
+
26
+ describe ".show" do
27
+ subject { conversation }
28
+
29
+ it "makes a new GET request using the correct API endpoint to receive a specific conversation" do
30
+ expect(RedboothRuby).to receive(:request).with(:get, nil, "#{endpoint}/1", {}, { session: session }).and_call_original
31
+ subject
32
+ end
33
+
34
+ it { expect(subject.id).to eql 1 }
35
+ it { expect(subject.name).to eql 'Project Welcome' }
36
+ it { expect(subject.project_id).to eql 2 }
37
+ end
38
+
39
+ describe ".update" do
40
+ subject { client.conversation(:update, id: 2, name: 'new test name') }
41
+
42
+ it "makes a new PUT request using the correct API endpoint to receive a specific conversation" do
43
+ expect(RedboothRuby).to receive(:request).with(:put, nil, "#{endpoint}/2", { name: 'new test name' }, { session: session }).and_call_original
44
+ subject
45
+ end
46
+
47
+ it { expect(subject.name).to eql 'new test name' }
48
+ it { expect(subject.id).to eql 2 }
49
+ end
50
+
51
+ describe ".create" do
52
+ subject { new_record }
53
+
54
+ it "makes a new POST request using the correct API endpoint to create a specific conversation" do
55
+ expect(RedboothRuby).to receive(:request).with(:post, nil, endpoint, create_params, { session: session }).and_call_original
56
+ subject
57
+ end
58
+
59
+ it { expect(subject.name).to eql 'new created conversation' }
60
+ it { expect(subject.project_id).to eql 2 }
61
+ it { expect(subject.user_id).to eql 1 }
62
+ end
63
+
64
+ describe ".delete" do
65
+ subject { client.conversation(:delete, id: new_record.id) }
66
+
67
+ it "makes a new DELETE request using the correct API endpoint to delete a specific conversation" do
68
+ expect(RedboothRuby).to receive(:request).with(:delete, nil, "#{endpoint}/#{new_record.id}", {}, { session: session }).and_call_original
69
+ subject
70
+ end
71
+ end
72
+
73
+ describe ".index" do
74
+ subject { client.conversation(:index) }
75
+
76
+ it "makes a new GET request using the correct API endpoint to receive conversations collection" do
77
+ expect(RedboothRuby).to receive(:request).with(:get, nil, endpoint, {}, { session: session }).and_call_original
78
+ subject
79
+ end
80
+
81
+ it { expect(subject.class).to eql RedboothRuby::Request::Collection }
82
+ end
83
+ end
@@ -1,6 +1,6 @@
1
1
  require "spec_helper"
2
2
 
3
- describe Redbooth::Me, vcr: 'me' do
3
+ describe RedboothRuby::Me, vcr: 'me' do
4
4
  include_context 'authentication'
5
5
  let(:me) { client.me(:show) }
6
6
  let(:response) { double(:response, data: {})}
@@ -18,7 +18,7 @@ describe Redbooth::Me, vcr: 'me' do
18
18
  subject { me }
19
19
 
20
20
  it 'makes a new GET request using the correct API endpoint to receive a specific user' do
21
- expect(Redbooth).to receive(:request).with(:get, nil, 'me', {}, { session: session }).and_call_original
21
+ expect(RedboothRuby).to receive(:request).with(:get, nil, 'me', {}, { session: session }).and_call_original
22
22
  subject
23
23
  end
24
24
 
@@ -33,7 +33,7 @@ describe Redbooth::Me, vcr: 'me' do
33
33
  subject { client.me(:update, update_attributes) }
34
34
 
35
35
  it 'makes a new PUT request using the correct API endpoint' do
36
- expect(Redbooth).to receive(:request).with(:put, nil, 'me', update_attributes, { session: session }).and_return(response)
36
+ expect(RedboothRuby).to receive(:request).with(:put, nil, 'me', update_attributes, { session: session }).and_return(response)
37
37
  subject
38
38
  end
39
39
 
@@ -48,7 +48,7 @@ describe Redbooth::Me, vcr: 'me' do
48
48
  subject { client.me(:delete) }
49
49
 
50
50
  it 'makes a new DELETE request using the correct API endpoint' do
51
- expect(Redbooth).to receive(:request).with(:delete, nil, 'me', {}, { session: session })
51
+ expect(RedboothRuby).to receive(:request).with(:delete, nil, 'me', {}, { session: session })
52
52
 
53
53
  subject
54
54
  end
@@ -0,0 +1,85 @@
1
+ require "spec_helper"
2
+
3
+ describe RedboothRuby::Membership, vcr: 'membership' do
4
+ include_context 'authentication'
5
+
6
+ let(:create_params) do
7
+ { organization_id: 1,
8
+ user_id: 3,
9
+ role: 'participant' }
10
+ end
11
+ let(:endpoint_name) { 'memberships' }
12
+ let(:new_record) { client.membership(:create, create_params.merge(session: session)) }
13
+ let(:membership) do
14
+ client.membership(:show, id: 1)
15
+ end
16
+
17
+ describe "#initialize" do
18
+ subject { membership }
19
+
20
+ it { expect(subject.id).to eql 1 }
21
+ it { expect(subject.user_id).to eql 1 }
22
+ it { expect(subject.role).to eql 'admin' }
23
+ end
24
+
25
+ describe ".show" do
26
+ subject { membership }
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
30
+ subject
31
+ end
32
+
33
+ it { expect(subject.id).to eql 1 }
34
+ it { expect(subject.user_id).to eql 1 }
35
+ it { expect(subject.role).to eql 'admin' }
36
+ end
37
+
38
+ describe ".update" do
39
+ subject { client.membership(:update, id: 6, role: 'admin') }
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
43
+ subject
44
+ end
45
+
46
+ it { expect(subject.role).to eql 'admin' }
47
+ it { expect(subject.id).to eql 6 }
48
+ end
49
+
50
+ describe ".create" do
51
+ subject { new_record }
52
+ let(:response) { double(:response, data: {} )}
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)
56
+ subject
57
+ end
58
+
59
+ context 'integration' do
60
+ after { client.membership(:delete, id: subject.id) }
61
+
62
+ it { expect(subject.user_id).to eql 3 }
63
+ end
64
+ end
65
+
66
+ describe ".delete" do
67
+ subject { client.membership(:delete, id: new_record.id) }
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
71
+ subject
72
+ end
73
+ end
74
+
75
+ describe ".index" do
76
+ subject { client.membership(:index) }
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
80
+ subject
81
+ end
82
+
83
+ it { expect(subject.class).to eql RedboothRuby::Request::Collection }
84
+ end
85
+ end
@@ -1,6 +1,6 @@
1
1
  require "spec_helper"
2
2
 
3
- describe Redbooth::Organization, vcr: 'organization' do
3
+ describe RedboothRuby::Organization, vcr: 'organization' do
4
4
  include_context 'authentication'
5
5
 
6
6
  let(:create_organization_params) do
@@ -24,7 +24,7 @@ describe Redbooth::Organization, vcr: 'organization' do
24
24
  subject { organization }
25
25
 
26
26
  it "makes a new GET request using the correct API endpoint to receive a specific organization" do
27
- expect(Redbooth).to receive(:request).with(:get, nil, "organizations/1", {}, { session: session }).and_call_original
27
+ expect(RedboothRuby).to receive(:request).with(:get, nil, "organizations/1", {}, { session: session }).and_call_original
28
28
  subject
29
29
  end
30
30
 
@@ -38,7 +38,7 @@ describe Redbooth::Organization, vcr: 'organization' do
38
38
  subject { client.organization(:update, id: 2, name: 'new test name') }
39
39
 
40
40
  it "makes a new PUT request using the correct API endpoint to receive a specific organization" do
41
- expect(Redbooth).to receive(:request).with(:put, nil, "organizations/2", { name: 'new test name' }, { session: session }).and_call_original
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
 
@@ -50,7 +50,7 @@ describe Redbooth::Organization, vcr: 'organization' do
50
50
  subject { new_organization }
51
51
 
52
52
  it "makes a new POST request using the correct API endpoint to create a specific organization" do
53
- expect(Redbooth).to receive(:request).with(:post, nil, "organizations", create_organization_params, { session: session }).and_call_original
53
+ expect(RedboothRuby).to receive(:request).with(:post, nil, "organizations", create_organization_params, { session: session }).and_call_original
54
54
  subject
55
55
  end
56
56
 
@@ -59,10 +59,10 @@ describe Redbooth::Organization, vcr: 'organization' do
59
59
 
60
60
  describe ".delete" do
61
61
  subject { client.organization(:delete, id: new_organization.id) }
62
- before { allow_any_instance_of(Redbooth::Client).to receive(:sleep) }
62
+ before { allow_any_instance_of(RedboothRuby::Client).to receive(:sleep) }
63
63
 
64
64
  it "makes a new DELETE request using the correct API endpoint to delete a specific organization" do
65
- expect(Redbooth).to receive(:request).with(:delete, nil, "organizations/#{new_organization.id}", {}, { session: session }).twice.and_call_original
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
@@ -71,10 +71,10 @@ describe Redbooth::Organization, vcr: 'organization' do
71
71
  subject { client.organization(:index) }
72
72
 
73
73
  it "makes a new PUT request using the correct API endpoint to receive a specific organization" do
74
- expect(Redbooth).to receive(:request).with(:get, nil, "organizations", {}, { session: session }).and_call_original
74
+ expect(RedboothRuby).to receive(:request).with(:get, nil, "organizations", {}, { session: session }).and_call_original
75
75
  subject
76
76
  end
77
77
 
78
- it { expect(subject.class).to eql Redbooth::Request::Collection }
78
+ it { expect(subject.class).to eql RedboothRuby::Request::Collection }
79
79
  end
80
80
  end
@@ -1,6 +1,6 @@
1
1
  require "spec_helper"
2
2
 
3
- describe Redbooth::Person, vcr: 'person' do
3
+ describe RedboothRuby::Person, vcr: 'person' do
4
4
  include_context 'authentication'
5
5
 
6
6
  let(:create_params) do
@@ -26,7 +26,7 @@ describe Redbooth::Person, vcr: 'person' do
26
26
  subject { person }
27
27
 
28
28
  it "makes a new GET request using the correct API endpoint to receive a specific person" do
29
- expect(Redbooth).to receive(:request).with(:get, nil, "#{endpoint_name}/1", {}, { session: session }).and_call_original
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
 
@@ -39,7 +39,7 @@ describe Redbooth::Person, vcr: 'person' do
39
39
  subject { client.person(:update, id: 6, role: 'admin') }
40
40
 
41
41
  it "makes a new PUT request using the correct API endpoint to receive a specific person" do
42
- expect(Redbooth).to receive(:request).with(:put, nil, "#{endpoint_name}/6", { role: 'admin' }, { session: session }).and_call_original
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
 
@@ -52,7 +52,7 @@ describe Redbooth::Person, vcr: 'person' do
52
52
  let(:response) { double(:response, data: {} )}
53
53
 
54
54
  it "makes a new POST request using the correct API endpoint to create a specific person" do
55
- expect(Redbooth).to receive(:request).with(:post, nil, "#{endpoint_name}", create_params, { session: session }).and_return(response)
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
 
@@ -67,7 +67,7 @@ describe Redbooth::Person, vcr: 'person' do
67
67
  subject { client.person(:delete, id: new_person.id) }
68
68
 
69
69
  it "makes a new DELETE request using the correct API endpoint to delete a specific person" do
70
- expect(Redbooth).to receive(:request).with(:delete, nil, "#{endpoint_name}/#{new_person.id}", {}, { session: session }).and_call_original
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
@@ -76,10 +76,10 @@ describe Redbooth::Person, vcr: 'person' do
76
76
  subject { client.person(:index) }
77
77
 
78
78
  it "makes a new PUT request using the correct API endpoint to receive a specific person" do
79
- expect(Redbooth).to receive(:request).with(:get, nil, "#{endpoint_name}", {}, { session: session }).and_call_original
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
- it { expect(subject.class).to eql Redbooth::Request::Collection }
83
+ it { expect(subject.class).to eql RedboothRuby::Request::Collection }
84
84
  end
85
85
  end
@@ -1,6 +1,6 @@
1
1
  require "spec_helper"
2
2
 
3
- describe Redbooth::Project, vcr: 'project' do
3
+ describe RedboothRuby::Project, vcr: 'project' do
4
4
  include_context 'authentication'
5
5
 
6
6
  let(:create_params) do
@@ -25,7 +25,7 @@ describe Redbooth::Project, vcr: 'project' do
25
25
  subject { project }
26
26
 
27
27
  it "makes a new GET request using the correct API endpoint to receive a specific project" do
28
- expect(Redbooth).to receive(:request).with(:get, nil, "#{endpoint_name}/1", {}, { session: session }).and_call_original
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
 
@@ -38,7 +38,7 @@ describe Redbooth::Project, vcr: 'project' do
38
38
  subject { client.project(:update, id: 2, name: 'new test name') }
39
39
 
40
40
  it "makes a new PUT request using the correct API endpoint to receive a specific project" do
41
- expect(Redbooth).to receive(:request).with(:put, nil, "#{endpoint_name}/2", { name: 'new test name' }, { session: session }).and_call_original
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
 
@@ -50,7 +50,7 @@ describe Redbooth::Project, vcr: 'project' do
50
50
  subject { new_project }
51
51
 
52
52
  it "makes a new POST request using the correct API endpoint to create a specific project" do
53
- expect(Redbooth).to receive(:request).with(:post, nil, "#{endpoint_name}", create_params, { session: session }).and_call_original
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
 
@@ -59,10 +59,10 @@ describe Redbooth::Project, vcr: 'project' do
59
59
 
60
60
  describe ".delete" do
61
61
  subject { client.project(:delete, id: new_project.id) }
62
- before { allow_any_instance_of(Redbooth::Client).to receive(:sleep) }
62
+ before { allow_any_instance_of(RedboothRuby::Client).to receive(:sleep) }
63
63
 
64
64
  it "makes a new DELETE request using the correct API endpoint to delete a specific project" do
65
- expect(Redbooth).to receive(:request).with(:delete, nil, "#{endpoint_name}/#{new_project.id}", {}, { session: session }).at_least(:twice).and_call_original
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
@@ -71,10 +71,10 @@ describe Redbooth::Project, vcr: 'project' do
71
71
  subject { client.project(:index) }
72
72
 
73
73
  it "makes a new PUT request using the correct API endpoint to receive a specific project" do
74
- expect(Redbooth).to receive(:request).with(:get, nil, "#{endpoint_name}", {}, { session: session }).and_call_original
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
- it { expect(subject.class).to eql Redbooth::Request::Collection }
78
+ it { expect(subject.class).to eql RedboothRuby::Request::Collection }
79
79
  end
80
80
  end
@@ -1,18 +1,18 @@
1
1
  require "spec_helper"
2
2
 
3
- describe Redbooth::Request::Base do
3
+ describe RedboothRuby::Request::Base do
4
4
  let(:consumer_key) { '_your_consumen_key_' }
5
5
  let(:consumer_secret) { '_your_consumen_secret_' }
6
6
  let(:info) { double(:info, session: session ) }
7
7
  let(:session) { double(:session, valid?: true ) }
8
- let(:request_base) { Redbooth::Request::Base.new(info) }
8
+ let(:request_base) { RedboothRuby::Request::Base.new(info) }
9
9
  let(:connection) { double(:connection) }
10
10
  let(:validator) { double(:validator) }
11
11
 
12
12
  before :each do
13
- allow(Redbooth::Request::Connection).to receive(:new).and_return(connection)
14
- allow(Redbooth::Request::Validator).to receive(:new).and_return(validator)
15
- Redbooth.config do |configuration|
13
+ allow(RedboothRuby::Request::Connection).to receive(:new).and_return(connection)
14
+ allow(RedboothRuby::Request::Validator).to receive(:new).and_return(validator)
15
+ RedboothRuby.config do |configuration|
16
16
  configuration[:consumer_key] = consumer_key
17
17
  configuration[:consumer_secret] = consumer_secret
18
18
  end
@@ -21,22 +21,22 @@ describe Redbooth::Request::Base do
21
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
- expect{request_base.perform}.to raise_error{ Redbooth::AuthenticationError }
24
+ expect{request_base.perform}.to raise_error{ RedboothRuby::AuthenticationError }
25
25
  end
26
26
  it "performs an https request" do
27
- allow_any_instance_of(Redbooth::Request::Base).to receive(:valid?).and_return(true)
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)
30
30
  expect(connection).to receive(:request)
31
31
  expect(validator).to receive(:validated_response_for)
32
32
 
33
- Redbooth::Request::Base.new(nil).perform
33
+ RedboothRuby::Request::Base.new(nil).perform
34
34
  end
35
35
  end
36
36
 
37
37
  describe "#valid?" do
38
38
  it 'is not valid if no info object given' do
39
- expect(Redbooth::Request::Base.new(nil)).to_not be_valid
39
+ expect(RedboothRuby::Request::Base.new(nil)).to_not be_valid
40
40
  end
41
41
  it 'is not valid if there is no session in info object' do
42
42
  allow(info).to receive(:session).and_return(nil)
@@ -1,25 +1,25 @@
1
1
  require "spec_helper"
2
2
 
3
- describe Redbooth::Request::Collection, vcr: 'collection' do
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
7
  describe "#initialize" do
8
8
  subject { collection }
9
9
 
10
- it { should be_a Redbooth::Request::Collection }
11
- it { expect(subject.response).to be_a(Redbooth::Request::Response) }
10
+ it { should be_a RedboothRuby::Request::Collection }
11
+ it { expect(subject.response).to be_a(RedboothRuby::Request::Response) }
12
12
  it { expect(subject.params).to be_a(Hash) }
13
13
  it { expect(subject.method).to eql(:index) }
14
14
  it { expect(subject.session).to eql(client.session) }
15
- it { expect(subject.resource).to eql(Redbooth::Task) }
15
+ it { expect(subject.resource).to eql(RedboothRuby::Task) }
16
16
  end
17
17
 
18
18
  describe '#all' do
19
19
  subject { collection.all }
20
20
 
21
21
  it { should be_a Array }
22
- it { expect(subject.first).to be_a(Redbooth::Task) }
22
+ it { expect(subject.first).to be_a(RedboothRuby::Task) }
23
23
  end
24
24
 
25
25
  describe '#total_pages' do
@@ -67,7 +67,7 @@ describe Redbooth::Request::Collection, vcr: 'collection' do
67
67
  describe '#next_page' do
68
68
  subject { collection.next_page }
69
69
 
70
- it { should be_a Redbooth::Request::Collection }
70
+ it { should be_a RedboothRuby::Request::Collection }
71
71
 
72
72
  context 'where endpoint is not paginated' do
73
73
  before { collection.response.headers.delete('PaginationCurrentPage') }
@@ -86,7 +86,7 @@ describe Redbooth::Request::Collection, vcr: 'collection' do
86
86
  before { collection.response.headers['PaginationCurrentPage'] = 4 }
87
87
  subject { collection.prev_page }
88
88
 
89
- it { should be_a Redbooth::Request::Collection }
89
+ it { should be_a RedboothRuby::Request::Collection }
90
90
 
91
91
  context 'where endpoint is not paginated' do
92
92
  before { collection.response.headers.delete('PaginationCurrentPage') }