edools-api 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,33 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
+
3
+ describe Edools::Core::Enrollment, :vcr do
4
+ xit 'finds the enrollment' do
5
+ enrollment = Edools::Core::Enrollment.find(1249)
6
+
7
+ expect(enrollment.id).to eq 1249
8
+ end
9
+
10
+ xit 'finds all enrollment' do
11
+ enrollments = Edools::Core::Enrollment.all
12
+
13
+ expect(enrollments.count).to eq 5
14
+ end
15
+
16
+ xit 'update the enrollment' do
17
+ enrollment = Edools::Core::Enrollment.find(1249)
18
+ enrollment.phone = Time.now.to_i.to_s
19
+
20
+ expect(enrollment.save).to be_true
21
+ end
22
+
23
+ xit 'create the enrollment' do
24
+ enrollment = Edools::Core::Enrollment.new()
25
+
26
+ expect(enrollment.save).to be_true
27
+ end
28
+
29
+ xit 'destroy the enrollment' do
30
+ enrollment = Edools::Core::Enrollment.find(1249)
31
+ expect(enrollment.destroy).to be_true
32
+ end
33
+ end
@@ -0,0 +1,33 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
+
3
+ describe Edools::Core::Organization, :vcr do
4
+ xit 'finds the organization' do
5
+ organization = Edools::Core::Organization.find(1249)
6
+
7
+ expect(organization.id).to eq 1249
8
+ end
9
+
10
+ xit 'finds all organization' do
11
+ organizations = Edools::Core::Organization.all
12
+
13
+ expect(organizations.count).to eq 5
14
+ end
15
+
16
+ xit 'update the organization' do
17
+ organization = Edools::Core::Organization.find(1249)
18
+ organization.phone = Time.now.to_i.to_s
19
+
20
+ expect(organization.save).to be_true
21
+ end
22
+
23
+ xit 'create the organization' do
24
+ organization = Edools::Core::Organization.new()
25
+
26
+ expect(organization.save).to be_true
27
+ end
28
+
29
+ xit 'destroy the organization' do
30
+ organization = Edools::Core::Organization.find(1249)
31
+ expect(organization.destroy).to be_true
32
+ end
33
+ end
@@ -0,0 +1,33 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
+
3
+ describe Edools::Core::Registration, :vcr do
4
+ xit 'finds the registration' do
5
+ registration = Edools::Core::Registration.find(1249)
6
+
7
+ expect(registration.id).to eq 1249
8
+ end
9
+
10
+ xit 'finds all registration' do
11
+ registrations = Edools::Core::Registration.all
12
+
13
+ expect(registrations.count).to eq 5
14
+ end
15
+
16
+ xit 'update the registration' do
17
+ registration = Edools::Core::Registration.find(1249)
18
+ registration.phone = Time.now.to_i.to_s
19
+
20
+ expect(registration.save).to be_true
21
+ end
22
+
23
+ xit 'create the registration' do
24
+ registration = Edools::Core::Registration.new()
25
+
26
+ expect(registration.save).to be_true
27
+ end
28
+
29
+ xit 'destroy the registration' do
30
+ registration = Edools::Core::Registration.find(1249)
31
+ expect(registration.destroy).to be_true
32
+ end
33
+ end
@@ -0,0 +1,33 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
+
3
+ describe Edools::Core::SchoolProduct, :vcr do
4
+ xit 'finds the school product' do
5
+ schoolproduct = Edools::Core::SchoolProduct.find(1249)
6
+
7
+ expect(schoolproduct.id).to eq 1249
8
+ end
9
+
10
+ xit 'finds all school product' do
11
+ schoolproducts = Edools::Core::SchoolProduct.all
12
+
13
+ expect(schoolproducts.count).to eq 5
14
+ end
15
+
16
+ xit 'update the school product' do
17
+ schoolproduct = Edools::Core::SchoolProduct.find(1249)
18
+ schoolproduct.phone = Time.now.to_i.to_s
19
+
20
+ expect(schoolproduct.save).to be_true
21
+ end
22
+
23
+ xit 'create the school product' do
24
+ schoolproduct = Edools::Core::SchoolProduct.new()
25
+
26
+ expect(schoolproduct.save).to be_true
27
+ end
28
+
29
+ xit 'destroy the school product' do
30
+ schoolproduct = Edools::Core::Schoolproduct.find(1249)
31
+ expect(schoolproduct.destroy).to be_true
32
+ end
33
+ end
@@ -0,0 +1,33 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
+
3
+ describe Edools::Core::School, :vcr do
4
+ xit 'finds the school' do
5
+ school = Edools::Core::School.find(1249)
6
+
7
+ expect(school.id).to eq 1249
8
+ end
9
+
10
+ xit 'finds all school' do
11
+ schools = Edools::Core::School.all
12
+
13
+ expect(schools.count).to eq 5
14
+ end
15
+
16
+ xit 'update the school' do
17
+ school = Edools::Core::School.find(1249)
18
+ school.phone = Time.now.to_i.to_s
19
+
20
+ expect(school.save).to be_true
21
+ end
22
+
23
+ xit 'create the school' do
24
+ school = Edools::Core::School.new()
25
+
26
+ expect(school.save).to be_true
27
+ end
28
+
29
+ xit 'destroy the school' do
30
+ school = Edools::Core::School.find(1249)
31
+ expect(school.destroy).to be_true
32
+ end
33
+ end
@@ -0,0 +1,32 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
+
3
+ describe Edools::Core::Student, :vcr do
4
+ it 'create the student' do
5
+ student = Edools::Core::Student.new(first_name: 'Teste', email: 'teste6@edools.com', password: '123456', password_confirmation: '123456')
6
+ expect(student.save).to eq true
7
+ end
8
+
9
+ it 'finds the student' do
10
+ student = Edools::Core::Student.find(1671)
11
+ expect(student.id).to eq 1671
12
+ expect(student.first_name).to eq 'Teste'
13
+ end
14
+
15
+ it 'finds all student' do
16
+ students = Edools::Core::Student.all
17
+ expect(students.count).to eq 10
18
+ expect(students.select { |s| s.id == 1671 }.first.first_name).to eq 'Teste'
19
+ end
20
+
21
+ it 'update the student' do
22
+ student = Edools::Core::Student.find(1671)
23
+ student.phone = "1406638122"
24
+ expect(student.save).to eq true
25
+ expect(Edools::Core::Student.find(1671).phone).to eq student.phone
26
+ end
27
+
28
+ it 'destroy the student' do
29
+ student = Edools::Core::Student.find(1671)
30
+ expect(student.destroy.code).to eq "204"
31
+ end
32
+ end
@@ -0,0 +1,65 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://core.edools.com/students.json
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"user":{"first_name":"Teste","email":"teste6@edools.com","password":"123456","password_confirmation":"123456"}}'
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ Authorization:
13
+ - Token token=84cc0400cd52f62f2e12309b502889ab:2fee1e06d56ab6394ab9acd4c6a8c62f
14
+ Accept:
15
+ - application/vnd.edools.core.v1+json
16
+ Accept-Encoding:
17
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
+ User-Agent:
19
+ - Ruby
20
+ response:
21
+ status:
22
+ code: 201
23
+ message: Created
24
+ headers:
25
+ Cache-Control:
26
+ - max-age=0, private, must-revalidate
27
+ Content-Security-Policy-Report-Only:
28
+ - default-src https://* 'self'; connect-src https://* 'self'; font-src https://*
29
+ 'self'; frame-src https://* 'self'; img-src https://* 'self' data:; media-src
30
+ https://* 'self'; object-src https://* 'self'; script-src https://* 'self';
31
+ style-src https://* 'self'; report-uri https://core.edools.com/uri-directive;
32
+ Content-Type:
33
+ - application/json; charset=utf-8
34
+ Date:
35
+ - Tue, 29 Jul 2014 12:32:34 GMT
36
+ Etag:
37
+ - '"a0693be855489080c429aabd6aa7aed3"'
38
+ Location:
39
+ - https://core.edools.com/students/1671
40
+ Server:
41
+ - nginx/1.4.7
42
+ Status:
43
+ - 201 Created
44
+ Strict-Transport-Security:
45
+ - max-age=631152000; includeSubdomains
46
+ X-Content-Type-Options:
47
+ - nosniff
48
+ X-Frame-Options:
49
+ - DENY
50
+ X-Request-Id:
51
+ - 1aee233b-b687-4500-a831-0718135741b4
52
+ X-Runtime:
53
+ - '1.460170'
54
+ X-Xss-Protection:
55
+ - 1; mode=block
56
+ Content-Length:
57
+ - '379'
58
+ Connection:
59
+ - keep-alive
60
+ body:
61
+ encoding: UTF-8
62
+ string: '{"id":1671,"first_name":"Teste","last_name":null,"email":"teste6@edools.com","cpf":null,"phone":null,"skype":null,"twitter":null,"facebook":null,"company_name":null,"company_position":null,"born_at":null,"biography":null,"cover_image_url":"https://cdn.edools.com/assets/images/users/default.jpeg","credentials":"c67a828ba0843c3c5475cab0fa68121d:791c868df4f753ac761fe56674b756d4"}'
63
+ http_version:
64
+ recorded_at: Tue, 29 Jul 2014 12:32:34 GMT
65
+ recorded_with: VCR 2.9.2
@@ -0,0 +1,113 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://core.edools.com/students/1671.json
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - application/vnd.edools.core.v1+json
12
+ Authorization:
13
+ - Token token=84cc0400cd52f62f2e12309b502889ab:2fee1e06d56ab6394ab9acd4c6a8c62f
14
+ Accept-Encoding:
15
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
+ User-Agent:
17
+ - Ruby
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Cache-Control:
24
+ - max-age=0, private, must-revalidate
25
+ Content-Security-Policy-Report-Only:
26
+ - default-src https://* 'self'; connect-src https://* 'self'; font-src https://*
27
+ 'self'; frame-src https://* 'self'; img-src https://* 'self' data:; media-src
28
+ https://* 'self'; object-src https://* 'self'; script-src https://* 'self';
29
+ style-src https://* 'self'; report-uri https://core.edools.com/uri-directive;
30
+ Content-Type:
31
+ - application/json; charset=utf-8
32
+ Date:
33
+ - Tue, 29 Jul 2014 12:51:12 GMT
34
+ Etag:
35
+ - '"b349c5a68c4741042b54d6f6b46361c8"'
36
+ Server:
37
+ - nginx/1.4.7
38
+ Status:
39
+ - 200 OK
40
+ Strict-Transport-Security:
41
+ - max-age=631152000; includeSubdomains
42
+ X-Content-Type-Options:
43
+ - nosniff
44
+ X-Frame-Options:
45
+ - DENY
46
+ X-Request-Id:
47
+ - cb9ec11e-d98a-4d5d-b327-5a5626fb5bb1
48
+ X-Runtime:
49
+ - '0.458293'
50
+ X-Xss-Protection:
51
+ - 1; mode=block
52
+ Content-Length:
53
+ - '435'
54
+ Connection:
55
+ - keep-alive
56
+ body:
57
+ encoding: UTF-8
58
+ string: '{"id":1671,"first_name":"Teste","last_name":null,"email":"teste6@edools.com","cpf":null,"phone":"1406638122","skype":null,"twitter":null,"facebook":null,"company_name":null,"company_position":null,"born_at":null,"biography":null,"cover_image_url":"https://cdn.edools.com/assets/images/users/default.jpeg","invitation_token":null,"registrations":[{"id":503,"code":"20140729123233878","school_id":224,"status":"Trial","enrollments":[]}]}'
59
+ http_version:
60
+ recorded_at: Tue, 29 Jul 2014 12:51:12 GMT
61
+ - request:
62
+ method: delete
63
+ uri: https://core.edools.com/students/1671.json
64
+ body:
65
+ encoding: US-ASCII
66
+ string: ''
67
+ headers:
68
+ Accept:
69
+ - application/vnd.edools.core.v1+json
70
+ Authorization:
71
+ - Token token=84cc0400cd52f62f2e12309b502889ab:2fee1e06d56ab6394ab9acd4c6a8c62f
72
+ Accept-Encoding:
73
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
74
+ User-Agent:
75
+ - Ruby
76
+ response:
77
+ status:
78
+ code: 204
79
+ message: No Content
80
+ headers:
81
+ Cache-Control:
82
+ - no-cache
83
+ Content-Security-Policy-Report-Only:
84
+ - default-src https://* 'self'; connect-src https://* 'self'; font-src https://*
85
+ 'self'; frame-src https://* 'self'; img-src https://* 'self' data:; media-src
86
+ https://* 'self'; object-src https://* 'self'; script-src https://* 'self';
87
+ style-src https://* 'self'; report-uri https://core.edools.com/uri-directive;
88
+ Date:
89
+ - Tue, 29 Jul 2014 12:51:13 GMT
90
+ Server:
91
+ - nginx/1.4.7
92
+ Status:
93
+ - 204 No Content
94
+ Strict-Transport-Security:
95
+ - max-age=631152000; includeSubdomains
96
+ X-Content-Type-Options:
97
+ - nosniff
98
+ X-Frame-Options:
99
+ - DENY
100
+ X-Request-Id:
101
+ - 874f1da3-1234-4c65-ab41-81e4dd9aa0f9
102
+ X-Runtime:
103
+ - '0.494678'
104
+ X-Xss-Protection:
105
+ - 1; mode=block
106
+ Connection:
107
+ - keep-alive
108
+ body:
109
+ encoding: UTF-8
110
+ string: ''
111
+ http_version:
112
+ recorded_at: Tue, 29 Jul 2014 12:51:13 GMT
113
+ recorded_with: VCR 2.9.2
@@ -0,0 +1,63 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://core.edools.com/students.json
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - application/vnd.edools.core.v1+json
12
+ Authorization:
13
+ - Token token=84cc0400cd52f62f2e12309b502889ab:2fee1e06d56ab6394ab9acd4c6a8c62f
14
+ Accept-Encoding:
15
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
+ User-Agent:
17
+ - Ruby
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Cache-Control:
24
+ - max-age=0, private, must-revalidate
25
+ Content-Security-Policy-Report-Only:
26
+ - default-src https://* 'self'; connect-src https://* 'self'; font-src https://*
27
+ 'self'; frame-src https://* 'self'; img-src https://* 'self' data:; media-src
28
+ https://* 'self'; object-src https://* 'self'; script-src https://* 'self';
29
+ style-src https://* 'self'; report-uri https://core.edools.com/uri-directive;
30
+ Content-Type:
31
+ - application/json; charset=utf-8
32
+ Date:
33
+ - Tue, 29 Jul 2014 12:38:40 GMT
34
+ Etag:
35
+ - '"a589be13508d6857aa09f014b0e8f677"'
36
+ Server:
37
+ - nginx/1.4.7
38
+ Status:
39
+ - 200 OK
40
+ Strict-Transport-Security:
41
+ - max-age=631152000; includeSubdomains
42
+ X-Content-Type-Options:
43
+ - nosniff
44
+ X-Frame-Options:
45
+ - DENY
46
+ X-Request-Id:
47
+ - 112ad436-66ee-4eed-a126-2708fe3f2d8c
48
+ X-Runtime:
49
+ - '0.593398'
50
+ X-Xss-Protection:
51
+ - 1; mode=block
52
+ Content-Length:
53
+ - '4678'
54
+ Connection:
55
+ - keep-alive
56
+ body:
57
+ encoding: UTF-8
58
+ string: '{"students":[{"id":1024,"first_name":"Denise","last_name":"Steiner","email":"denisesteiner@mail.com","cpf":null,"phone":null,"skype":null,"twitter":null,"facebook":null,"company_name":null,"company_position":null,"born_at":null,"biography":null,"cover_image_url":"http://infinite-woodland-5276.herokuapp.com/assets/demo/avatars/5.jpg","invitation_token":null,"registrations":[{"id":72,"code":"20140625164249158","school_id":224,"status":"Trial","enrollments":[{"id":1035,"unlimited":true,"available_until":null,"school_class":{"id":151,"code":null,"school_product":{"id":156,"title":"New
59
+ course"}}},{"id":1033,"unlimited":true,"available_until":null,"school_class":{"id":151,"code":null,"school_product":{"id":156,"title":"New
60
+ course"}}}]}]},{"id":1023,"first_name":"Denise","last_name":"Steiner","email":"denisesteiner@email.com","cpf":null,"phone":null,"skype":null,"twitter":null,"facebook":null,"company_name":null,"company_position":null,"born_at":null,"biography":null,"cover_image_url":"https://cdn.edools.com/assets/images/users/default.jpeg","invitation_token":null,"registrations":[{"id":71,"code":"20140625163503552","school_id":224,"status":"Trial","enrollments":[]}]},{"id":1628,"first_name":"Vinicius","last_name":null,"email":"vinicius@edools.com","cpf":null,"phone":null,"skype":null,"twitter":null,"facebook":null,"company_name":null,"company_position":null,"born_at":null,"biography":null,"cover_image_url":"https://cdn.edools.com/assets/images/users/default.jpeg","invitation_token":null,"registrations":[{"id":486,"code":"20140722122412235","school_id":224,"status":"Ativo","enrollments":[]}]},{"id":1246,"first_name":"Diogo","last_name":"","email":"diogo.beda@gmail.com","cpf":null,"phone":null,"skype":null,"twitter":null,"facebook":null,"company_name":null,"company_position":null,"born_at":null,"biography":null,"cover_image_url":"https://cdn.edools.com/assets/images/users/default.jpeg","invitation_token":null,"registrations":[{"id":133,"code":"20140717200254378","school_id":224,"status":"Trial","enrollments":[]}]},{"id":1636,"first_name":"Teste","last_name":null,"email":"teste123@edools.com","cpf":null,"phone":null,"skype":null,"twitter":null,"facebook":null,"company_name":null,"company_position":null,"born_at":null,"biography":null,"cover_image_url":"https://cdn.edools.com/assets/images/users/default.jpeg","invitation_token":null,"registrations":[{"id":495,"code":"20140725190116088","school_id":224,"status":"Trial","enrollments":[]}]},{"id":1637,"first_name":"Teste","last_name":null,"email":"teste1@edools.com","cpf":null,"phone":null,"skype":null,"twitter":null,"facebook":null,"company_name":null,"company_position":null,"born_at":null,"biography":null,"cover_image_url":"https://cdn.edools.com/assets/images/users/default.jpeg","invitation_token":null,"registrations":[{"id":496,"code":"20140725202653238","school_id":224,"status":"Trial","enrollments":[]}]},{"id":1671,"first_name":"Teste","last_name":null,"email":"teste6@edools.com","cpf":null,"phone":null,"skype":null,"twitter":null,"facebook":null,"company_name":null,"company_position":null,"born_at":null,"biography":null,"cover_image_url":"https://cdn.edools.com/assets/images/users/default.jpeg","invitation_token":null,"registrations":[{"id":503,"code":"20140729123233878","school_id":224,"status":"Trial","enrollments":[]}]},{"id":1658,"first_name":"Teste","last_name":null,"email":"teste2@edools.com","cpf":null,"phone":null,"skype":null,"twitter":null,"facebook":null,"company_name":null,"company_position":null,"born_at":null,"biography":null,"cover_image_url":"https://cdn.edools.com/assets/images/users/default.jpeg","invitation_token":null,"registrations":[{"id":498,"code":"20140728175322950","school_id":224,"status":"Trial","enrollments":[]}]},{"id":1668,"first_name":"Teste","last_name":null,"email":"teste3@edools.com","cpf":null,"phone":null,"skype":null,"twitter":null,"facebook":null,"company_name":null,"company_position":null,"born_at":null,"biography":null,"cover_image_url":"https://cdn.edools.com/assets/images/users/default.jpeg","invitation_token":null,"registrations":[{"id":500,"code":"20140729041857904","school_id":224,"status":"Trial","enrollments":[]}]},{"id":1669,"first_name":"Teste","last_name":null,"email":"teste4@edools.com","cpf":null,"phone":null,"skype":null,"twitter":null,"facebook":null,"company_name":null,"company_position":null,"born_at":null,"biography":null,"cover_image_url":"https://cdn.edools.com/assets/images/users/default.jpeg","invitation_token":null,"registrations":[{"id":501,"code":"20140729042807382","school_id":224,"status":"Trial","enrollments":[]}]}],"current_page":1,"per_page":10,"total_pages":2,"total_count":12}'
61
+ http_version:
62
+ recorded_at: Tue, 29 Jul 2014 12:38:40 GMT
63
+ recorded_with: VCR 2.9.2