edools-api 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ec3987dbcd817312de6fb0872e82114c77e34da4
4
- data.tar.gz: 9985faee320f857981b82f9d3df6709ee7a6678a
3
+ metadata.gz: 86903257522deff62669c3371ed6fdef3bb9a265
4
+ data.tar.gz: 7867db26712ffba5489941d23d0b1c9d17597bbb
5
5
  SHA512:
6
- metadata.gz: 5090dad5f1c8d72d9ab8c483089b434d6894c94d6cad8fa8952644d311780d308ce563382dfedd23ed2735af14b79874c729018694efba07250fc3c3e12c9b91
7
- data.tar.gz: e7c3117765906ffebf26a813642c97af263af35d5f3e47f968d04d0d46b0bcc1a262a15d4eee3b39d3f3f32ed0f6041f4185da0e6ec79c4e71d91bbd4e2d9709
6
+ metadata.gz: 294899fbc52a73f6f76b70039796b187e574ac5b39bcbf541af84c41e8d83e01c68da92e149991081accb39fc1fd82faabd6dcce06bad120ea5fa2c32b331571
7
+ data.tar.gz: 7bff5c7ba5df04db7fb45b9fff0334818a2419d026e6a91b03c27eb6b8d6da196a3deb97d0a7b4d42aa1993f2a14c5529a7ff57613c1f56af7627f1245770827
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.4.0
data/edools-api.gemspec CHANGED
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: edools-api 0.3.0 ruby lib
5
+ # stub: edools-api 0.4.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "edools-api"
9
- s.version = "0.3.0"
9
+ s.version = "0.4.0"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Vinicius Kastrup"]
14
- s.date = "2014-08-11"
14
+ s.date = "2014-09-04"
15
15
  s.description = "\n With this gem you'll be able to access and manipulate all the data of your School or Organization\n hosted at Edools.\n "
16
16
  s.email = "viniciusmkm@gmail.com"
17
17
  s.extra_rdoc_files = [
@@ -40,6 +40,7 @@ Gem::Specification.new do |s|
40
40
  "lib/edools/core/school.rb",
41
41
  "lib/edools/core/school_class.rb",
42
42
  "lib/edools/core/school_product.rb",
43
+ "lib/edools/core/session.rb",
43
44
  "lib/edools/core/student.rb",
44
45
  "lib/edools/initialization.rb",
45
46
  "spec/edools/core/api_key_spec.rb",
@@ -50,6 +51,7 @@ Gem::Specification.new do |s|
50
51
  "spec/edools/core/school_class_spec.rb",
51
52
  "spec/edools/core/school_product_spec.rb",
52
53
  "spec/edools/core/school_spec.rb",
54
+ "spec/edools/core/session_spec.rb",
53
55
  "spec/edools/core/student_spec.rb",
54
56
  "spec/fixtures/vcr_cassettes/Edools_Core_ApiKey/finds_the_api_key.yml",
55
57
  "spec/fixtures/vcr_cassettes/Edools_Core_Enrollment/create_the_enrollment.yml",
@@ -70,6 +72,7 @@ Gem::Specification.new do |s|
70
72
  "spec/fixtures/vcr_cassettes/Edools_Core_SchoolProduct/finds_all_school_product.yml",
71
73
  "spec/fixtures/vcr_cassettes/Edools_Core_SchoolProduct/finds_the_school_product.yml",
72
74
  "spec/fixtures/vcr_cassettes/Edools_Core_SchoolProduct/update_the_school_product.yml",
75
+ "spec/fixtures/vcr_cassettes/Edools_Core_Session/create_the_session.yml",
73
76
  "spec/fixtures/vcr_cassettes/Edools_Core_Student/create_the_student.yml",
74
77
  "spec/fixtures/vcr_cassettes/Edools_Core_Student/destroy_the_student.yml",
75
78
  "spec/fixtures/vcr_cassettes/Edools_Core_Student/finds_all_student.yml",
data/lib/edools/core.rb CHANGED
@@ -6,4 +6,5 @@ require 'edools/core/registration'
6
6
  require 'edools/core/school'
7
7
  require 'edools/core/school_class'
8
8
  require 'edools/core/school_product'
9
+ require 'edools/core/session'
9
10
  require 'edools/core/student'
@@ -0,0 +1,18 @@
1
+ require 'edools/core/base'
2
+ require 'edools/core/paginated_collection'
3
+
4
+ module Edools
5
+ module Core
6
+ class Session < Edools::Core::Base
7
+
8
+ self.include_root_in_json = false
9
+
10
+ # used for create the session
11
+ def self.collection_path(prefix_options = {}, query_options = nil)
12
+ super
13
+ "/users/sign_in.#{format.extension}#{query_string(query_options)}"
14
+ end
15
+
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,13 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
+
3
+ describe Edools::Core::Session, :vcr do
4
+ let(:student) { Edools::Core::Student.find(1023) }
5
+ let(:session) { Edools::Core::Session.new(user: { email: student.email, password: 'edools1234' }, realm: { id: 224, type: 'School' }) }
6
+
7
+ it 'create the session' do
8
+ expect(session.save).to eq true
9
+ expect(session.credentials).to_not eq nil
10
+ end
11
+
12
+ it 'destroy the session' # is done destroying the api key created on session creation
13
+ end
@@ -0,0 +1,123 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://core.edools.com/students/1023.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/vnd.edools.core.v1+json; charset=utf-8
32
+ Date:
33
+ - Thu, 04 Sep 2014 19:04:34 GMT
34
+ Etag:
35
+ - '"7d2bf5606fd1ea38f789f37033b7659f"'
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
+ - 0a2a36cd-99b5-4ce4-8cd2-9f57f5890adf
48
+ X-Runtime:
49
+ - '0.019786'
50
+ X-Xss-Protection:
51
+ - 1; mode=block
52
+ Content-Length:
53
+ - '438'
54
+ Connection:
55
+ - keep-alive
56
+ body:
57
+ encoding: UTF-8
58
+ string: '{"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":[]}]}'
59
+ http_version:
60
+ recorded_at: Thu, 04 Sep 2014 19:04:34 GMT
61
+ - request:
62
+ method: post
63
+ uri: https://core.edools.com/users/sign_in.json
64
+ body:
65
+ encoding: UTF-8
66
+ string: '{"user":{"email":"denisesteiner@email.com","password":"edools1234"},"realm":{"id":224,"type":"School"}}'
67
+ headers:
68
+ Content-Type:
69
+ - application/json
70
+ Authorization:
71
+ - Token token=84cc0400cd52f62f2e12309b502889ab:2fee1e06d56ab6394ab9acd4c6a8c62f
72
+ Accept:
73
+ - application/vnd.edools.core.v1+json
74
+ Accept-Encoding:
75
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
76
+ User-Agent:
77
+ - Ruby
78
+ response:
79
+ status:
80
+ code: 200
81
+ message: OK
82
+ headers:
83
+ Cache-Control:
84
+ - max-age=0, private, must-revalidate
85
+ Content-Security-Policy-Report-Only:
86
+ - default-src https://* 'self'; connect-src https://* 'self'; font-src https://*
87
+ 'self'; frame-src https://* 'self'; img-src https://* 'self' data:; media-src
88
+ https://* 'self'; object-src https://* 'self'; script-src https://* 'self';
89
+ style-src https://* 'self'; report-uri https://core.edools.com/uri-directive;
90
+ Content-Type:
91
+ - application/vnd.edools.core.v1+json; charset=utf-8
92
+ Date:
93
+ - Thu, 04 Sep 2014 19:04:35 GMT
94
+ Etag:
95
+ - '"fcf908064241e2c2e85a9884bb1c118e"'
96
+ Location:
97
+ - "/"
98
+ Server:
99
+ - nginx/1.4.7
100
+ Status:
101
+ - 200 OK
102
+ Strict-Transport-Security:
103
+ - max-age=631152000; includeSubdomains
104
+ X-Content-Type-Options:
105
+ - nosniff
106
+ X-Frame-Options:
107
+ - DENY
108
+ X-Request-Id:
109
+ - 9a2a5ed8-476f-4e99-ba8b-88b297e0ec7c
110
+ X-Runtime:
111
+ - '0.344213'
112
+ X-Xss-Protection:
113
+ - 1; mode=block
114
+ Content-Length:
115
+ - '7097'
116
+ Connection:
117
+ - keep-alive
118
+ body:
119
+ encoding: UTF-8
120
+ string: '{"id":1023,"type":"Student","first_name":"Denise","last_name":"Steiner","email":"denisesteiner@email.com","cover_image_url":"https://cdn.edools.com/assets/images/users/default.jpeg","credentials":"ff0a3080d384f0be15e82f8d4bfbef76:a91ec336e113b6bace5cafd5e46ff91f","permissions":[{"key":"extra_content","can_create":false,"can_read":true,"can_update":false,"can_delete":false},{"key":"collaborative_comment","can_create":true,"can_read":true,"can_update":false,"can_delete":false},{"key":"exam_answer","can_create":true,"can_read":true,"can_update":false,"can_delete":false},{"key":"activity","can_create":false,"can_read":true,"can_update":false,"can_delete":false},{"key":"wallet","can_create":false,"can_read":true,"can_update":true,"can_delete":false},{"key":"wallet_credits_payment","can_create":true,"can_read":true,"can_update":false,"can_delete":false},{"key":"transaction","can_create":true,"can_read":true,"can_update":false,"can_delete":false},{"key":"subscription","can_create":true,"can_read":true,"can_update":true,"can_delete":false},{"key":"product","can_create":false,"can_read":true,"can_update":false,"can_delete":false},{"key":"online_debit_payment","can_create":true,"can_read":true,"can_update":false,"can_delete":false},{"key":"manual_payment","can_create":false,"can_read":true,"can_update":false,"can_delete":false},{"key":"invoice","can_create":true,"can_read":true,"can_update":false,"can_delete":false},{"key":"credit_card_payment","can_create":true,"can_read":true,"can_update":false,"can_delete":false},{"key":"coupon_token","can_create":false,"can_read":true,"can_update":true,"can_delete":false},{"key":"coupon","can_create":false,"can_read":true,"can_update":false,"can_delete":false},{"key":"boleto_payment","can_create":true,"can_read":true,"can_update":false,"can_delete":false},{"key":"customer","can_create":true,"can_read":true,"can_update":true,"can_delete":true},{"key":"payment","can_create":true,"can_read":true,"can_update":true,"can_delete":true},{"key":"item","can_create":true,"can_read":true,"can_update":true,"can_delete":true},{"key":"order","can_create":true,"can_read":true,"can_update":true,"can_delete":true},{"key":"video_slide_sync","can_create":false,"can_read":true,"can_update":false,"can_delete":false},{"key":"video_slide","can_create":false,"can_read":true,"can_update":false,"can_delete":false},{"key":"video","can_create":false,"can_read":true,"can_update":false,"can_delete":false},{"key":"user","can_create":false,"can_read":true,"can_update":false,"can_delete":false},{"key":"text","can_create":false,"can_read":true,"can_update":false,"can_delete":false},{"key":"student","can_create":false,"can_read":true,"can_update":true,"can_delete":false},{"key":"slide","can_create":false,"can_read":true,"can_update":false,"can_delete":false},{"key":"scorm_package","can_create":false,"can_read":true,"can_update":false,"can_delete":false},{"key":"school_product_topic","can_create":false,"can_read":true,"can_update":false,"can_delete":false},{"key":"school_product","can_create":false,"can_read":true,"can_update":false,"can_delete":false},{"key":"school_class","can_create":false,"can_read":true,"can_update":false,"can_delete":false},{"key":"school","can_create":false,"can_read":true,"can_update":false,"can_delete":false},{"key":"role","can_create":false,"can_read":true,"can_update":false,"can_delete":false},{"key":"review","can_create":true,"can_read":true,"can_update":true,"can_delete":true},{"key":"registration","can_create":false,"can_read":true,"can_update":false,"can_delete":false},{"key":"permission","can_create":false,"can_read":true,"can_update":false,"can_delete":false},{"key":"organization","can_create":false,"can_read":true,"can_update":false,"can_delete":false},{"key":"notification","can_create":true,"can_read":true,"can_update":false,"can_delete":true},{"key":"multiple_choice_option","can_create":false,"can_read":true,"can_update":false,"can_delete":false},{"key":"multiple_choice_exam_question","can_create":false,"can_read":true,"can_update":false,"can_delete":false},{"key":"message","can_create":true,"can_read":true,"can_update":true,"can_delete":true},{"key":"media","can_create":false,"can_read":true,"can_update":false,"can_delete":false},{"key":"live_stream","can_create":false,"can_read":true,"can_update":false,"can_delete":false},{"key":"library_tag","can_create":false,"can_read":false,"can_update":false,"can_delete":false},{"key":"library_resource","can_create":false,"can_read":true,"can_update":false,"can_delete":false},{"key":"library","can_create":false,"can_read":false,"can_update":false,"can_delete":false},{"key":"lesson_progress","can_create":true,"can_read":true,"can_update":true,"can_delete":false},{"key":"lesson","can_create":false,"can_read":true,"can_update":false,"can_delete":false},{"key":"image","can_create":false,"can_read":true,"can_update":false,"can_delete":false},{"key":"html","can_create":false,"can_read":true,"can_update":false,"can_delete":false},{"key":"forum_section","can_create":false,"can_read":true,"can_update":false,"can_delete":false},{"key":"forum_question","can_create":true,"can_read":true,"can_update":true,"can_delete":true},{"key":"forum_answer","can_create":true,"can_read":true,"can_update":true,"can_delete":true},{"key":"forum","can_create":false,"can_read":true,"can_update":false,"can_delete":false},{"key":"exam_question_answer","can_create":true,"can_read":true,"can_update":false,"can_delete":false},{"key":"exam_question","can_create":false,"can_read":true,"can_update":false,"can_delete":false},{"key":"exam_lesson","can_create":false,"can_read":true,"can_update":false,"can_delete":false},{"key":"enrollment","can_create":false,"can_read":true,"can_update":true,"can_delete":false},{"key":"document","can_create":false,"can_read":true,"can_update":false,"can_delete":false},{"key":"discursive_exam_question","can_create":false,"can_read":true,"can_update":false,"can_delete":false},{"key":"discipline","can_create":false,"can_read":true,"can_update":false,"can_delete":false},{"key":"course_module","can_create":false,"can_read":true,"can_update":false,"can_delete":false},{"key":"course_content","can_create":false,"can_read":true,"can_update":false,"can_delete":false},{"key":"course","can_create":false,"can_read":true,"can_update":false,"can_delete":false},{"key":"content_lesson","can_create":false,"can_read":true,"can_update":false,"can_delete":false},{"key":"collaborator","can_create":false,"can_read":true,"can_update":false,"can_delete":false},{"key":"class_teacher","can_create":false,"can_read":true,"can_update":false,"can_delete":false},{"key":"category","can_create":false,"can_read":true,"can_update":false,"can_delete":false},{"key":"audio","can_create":false,"can_read":true,"can_update":false,"can_delete":false},{"key":"associative_option","can_create":false,"can_read":true,"can_update":false,"can_delete":false},{"key":"associative_exam_question","can_create":false,"can_read":true,"can_update":false,"can_delete":false},{"key":"address","can_create":true,"can_read":true,"can_update":true,"can_delete":true}]}'
121
+ http_version:
122
+ recorded_at: Thu, 04 Sep 2014 19:04:35 GMT
123
+ recorded_with: VCR 2.9.2
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: edools-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vinicius Kastrup
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-11 00:00:00.000000000 Z
11
+ date: 2014-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activeresource
@@ -180,6 +180,7 @@ files:
180
180
  - lib/edools/core/school.rb
181
181
  - lib/edools/core/school_class.rb
182
182
  - lib/edools/core/school_product.rb
183
+ - lib/edools/core/session.rb
183
184
  - lib/edools/core/student.rb
184
185
  - lib/edools/initialization.rb
185
186
  - spec/edools/core/api_key_spec.rb
@@ -190,6 +191,7 @@ files:
190
191
  - spec/edools/core/school_class_spec.rb
191
192
  - spec/edools/core/school_product_spec.rb
192
193
  - spec/edools/core/school_spec.rb
194
+ - spec/edools/core/session_spec.rb
193
195
  - spec/edools/core/student_spec.rb
194
196
  - spec/fixtures/vcr_cassettes/Edools_Core_ApiKey/finds_the_api_key.yml
195
197
  - spec/fixtures/vcr_cassettes/Edools_Core_Enrollment/create_the_enrollment.yml
@@ -210,6 +212,7 @@ files:
210
212
  - spec/fixtures/vcr_cassettes/Edools_Core_SchoolProduct/finds_all_school_product.yml
211
213
  - spec/fixtures/vcr_cassettes/Edools_Core_SchoolProduct/finds_the_school_product.yml
212
214
  - spec/fixtures/vcr_cassettes/Edools_Core_SchoolProduct/update_the_school_product.yml
215
+ - spec/fixtures/vcr_cassettes/Edools_Core_Session/create_the_session.yml
213
216
  - spec/fixtures/vcr_cassettes/Edools_Core_Student/create_the_student.yml
214
217
  - spec/fixtures/vcr_cassettes/Edools_Core_Student/destroy_the_student.yml
215
218
  - spec/fixtures/vcr_cassettes/Edools_Core_Student/finds_all_student.yml