edools-api 0.2.0 → 0.3.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.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/edools-api.gemspec +6 -3
- data/lib/edools/core.rb +1 -0
- data/lib/edools/core/api_key.rb +18 -0
- data/spec/edools/core/api_key_spec.rb +11 -0
- data/spec/edools/core/base_spec.rb +1 -1
- data/spec/fixtures/vcr_cassettes/Edools_Core_ApiKey/finds_the_api_key.yml +61 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec3987dbcd817312de6fb0872e82114c77e34da4
|
4
|
+
data.tar.gz: 9985faee320f857981b82f9d3df6709ee7a6678a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5090dad5f1c8d72d9ab8c483089b434d6894c94d6cad8fa8952644d311780d308ce563382dfedd23ed2735af14b79874c729018694efba07250fc3c3e12c9b91
|
7
|
+
data.tar.gz: e7c3117765906ffebf26a813642c97af263af35d5f3e47f968d04d0d46b0bcc1a262a15d4eee3b39d3f3f32ed0f6041f4185da0e6ec79c4e71d91bbd4e2d9709
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.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.
|
5
|
+
# stub: edools-api 0.3.0 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "edools-api"
|
9
|
-
s.version = "0.
|
9
|
+
s.version = "0.3.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-
|
14
|
+
s.date = "2014-08-11"
|
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 = [
|
@@ -31,6 +31,7 @@ Gem::Specification.new do |s|
|
|
31
31
|
"lib/edools.rb",
|
32
32
|
"lib/edools/config.rb",
|
33
33
|
"lib/edools/core.rb",
|
34
|
+
"lib/edools/core/api_key.rb",
|
34
35
|
"lib/edools/core/base.rb",
|
35
36
|
"lib/edools/core/enrollment.rb",
|
36
37
|
"lib/edools/core/organization.rb",
|
@@ -41,6 +42,7 @@ Gem::Specification.new do |s|
|
|
41
42
|
"lib/edools/core/school_product.rb",
|
42
43
|
"lib/edools/core/student.rb",
|
43
44
|
"lib/edools/initialization.rb",
|
45
|
+
"spec/edools/core/api_key_spec.rb",
|
44
46
|
"spec/edools/core/base_spec.rb",
|
45
47
|
"spec/edools/core/enrollment_spec.rb",
|
46
48
|
"spec/edools/core/organization_spec.rb",
|
@@ -49,6 +51,7 @@ Gem::Specification.new do |s|
|
|
49
51
|
"spec/edools/core/school_product_spec.rb",
|
50
52
|
"spec/edools/core/school_spec.rb",
|
51
53
|
"spec/edools/core/student_spec.rb",
|
54
|
+
"spec/fixtures/vcr_cassettes/Edools_Core_ApiKey/finds_the_api_key.yml",
|
52
55
|
"spec/fixtures/vcr_cassettes/Edools_Core_Enrollment/create_the_enrollment.yml",
|
53
56
|
"spec/fixtures/vcr_cassettes/Edools_Core_Enrollment/finds_all_enrollment.yml",
|
54
57
|
"spec/fixtures/vcr_cassettes/Edools_Core_Enrollment/finds_the_enrollment.yml",
|
data/lib/edools/core.rb
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'edools/core/base'
|
2
|
+
|
3
|
+
module Edools
|
4
|
+
module Core
|
5
|
+
class ApiKey < Edools::Core::Base
|
6
|
+
def self.element_path(id, prefix_options = {}, query_options = nil)
|
7
|
+
super
|
8
|
+
secret, token = extract_credentials(id)
|
9
|
+
"/api_keys/#{token}/#{secret}.#{format.extension}#{query_string(query_options)}"
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.extract_credentials(credentials)
|
13
|
+
keys = credentials.split(":")
|
14
|
+
[keys.first, keys.last]
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
2
|
+
|
3
|
+
describe Edools::Core::ApiKey, :vcr do
|
4
|
+
it 'finds the api key' do
|
5
|
+
api_key = Edools::Core::ApiKey.find("secret:token")
|
6
|
+
|
7
|
+
expect(api_key.token).to eq "token"
|
8
|
+
expect(api_key.secret).to eq "secret"
|
9
|
+
expect(api_key.permissions.count).to eq 1
|
10
|
+
end
|
11
|
+
end
|
@@ -3,7 +3,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
|
3
3
|
describe Edools::Core::Base do
|
4
4
|
describe 'location' do
|
5
5
|
it 'sets site to edools core api url' do
|
6
|
-
expect(Edools::Core::Base.site.to_s).to eq 'https://core.edools.com'
|
6
|
+
expect(Edools::Core::Base.site.to_s).to eq 'https://core.edools.com/'
|
7
7
|
end
|
8
8
|
end
|
9
9
|
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://core.edools.com/api_keys/token/secret.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
|
+
- Mon, 11 Aug 2014 21:19:57 GMT
|
34
|
+
Etag:
|
35
|
+
- '"e3ae2bc44f055230c839a5ca0a61ec36"'
|
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
|
+
- 0aef545b-584f-4167-9313-85e3b97288fd
|
48
|
+
X-Runtime:
|
49
|
+
- '0.075516'
|
50
|
+
X-Xss-Protection:
|
51
|
+
- 1; mode=block
|
52
|
+
Content-Length:
|
53
|
+
- '237'
|
54
|
+
Connection:
|
55
|
+
- keep-alive
|
56
|
+
body:
|
57
|
+
encoding: UTF-8
|
58
|
+
string: '{"token":"token","secret":"secret","realm":{"id":null,"type":null},"permissions":[{"id":8070,"key":"api_key","can_create":false,"can_read":true,"can_update":false,"can_delete":false}]}'
|
59
|
+
http_version:
|
60
|
+
recorded_at: Mon, 11 Aug 2014 21:19:58 GMT
|
61
|
+
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.
|
4
|
+
version: 0.3.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-
|
11
|
+
date: 2014-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activeresource
|
@@ -171,6 +171,7 @@ files:
|
|
171
171
|
- lib/edools.rb
|
172
172
|
- lib/edools/config.rb
|
173
173
|
- lib/edools/core.rb
|
174
|
+
- lib/edools/core/api_key.rb
|
174
175
|
- lib/edools/core/base.rb
|
175
176
|
- lib/edools/core/enrollment.rb
|
176
177
|
- lib/edools/core/organization.rb
|
@@ -181,6 +182,7 @@ files:
|
|
181
182
|
- lib/edools/core/school_product.rb
|
182
183
|
- lib/edools/core/student.rb
|
183
184
|
- lib/edools/initialization.rb
|
185
|
+
- spec/edools/core/api_key_spec.rb
|
184
186
|
- spec/edools/core/base_spec.rb
|
185
187
|
- spec/edools/core/enrollment_spec.rb
|
186
188
|
- spec/edools/core/organization_spec.rb
|
@@ -189,6 +191,7 @@ files:
|
|
189
191
|
- spec/edools/core/school_product_spec.rb
|
190
192
|
- spec/edools/core/school_spec.rb
|
191
193
|
- spec/edools/core/student_spec.rb
|
194
|
+
- spec/fixtures/vcr_cassettes/Edools_Core_ApiKey/finds_the_api_key.yml
|
192
195
|
- spec/fixtures/vcr_cassettes/Edools_Core_Enrollment/create_the_enrollment.yml
|
193
196
|
- spec/fixtures/vcr_cassettes/Edools_Core_Enrollment/finds_all_enrollment.yml
|
194
197
|
- spec/fixtures/vcr_cassettes/Edools_Core_Enrollment/finds_the_enrollment.yml
|