edools-api 0.6.0 → 0.7.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: 7fa55fee4b82476f64aab7826bcae137d6f37ec9
4
- data.tar.gz: 813226a49d621170dcf4ca2abcd60db7d36086d2
3
+ metadata.gz: b26e3bee4f51749bb941f108552e3207701db4ce
4
+ data.tar.gz: 993d345460a3aac7c2b17a9412db73d34e10bd7f
5
5
  SHA512:
6
- metadata.gz: 68e6014ed080938e31d380799e132c2acc8ea23dcd8668e33504dbd1e0f6e5b0cea28dc6c068a498fd9aca5fe9e04fdfd3fbc689ef064967401bc6cd402cb421
7
- data.tar.gz: 464cfa8f034ffa4a31d7f7df3ba8697b7b8caab9a7239d875aa9ebb84888d577a80d0e38d811af7d1b1734bb2470269039e22ede498e7444a10bf3df4ee3bcec
6
+ metadata.gz: 30d03ea523cc5f95f591c8c183a2341d2f6d75559bde6d8769a771052c517bc76ff3534adfbbc0e9dd8ede3bf925ca62552e5ca7da2c2e595d407722bc5013ae
7
+ data.tar.gz: 2c57f61bd8f045b1336217ece282936b6c7d3668ef8ea512c009b55138bd0ba734e5647ee58cf59f1e2b18da6bdd0bccf7185b17a1d14e0e665c66b8a9b43504
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.0
1
+ 0.7.0
@@ -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.6.0 ruby lib
5
+ # stub: edools-api 0.7.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "edools-api"
9
- s.version = "0.6.0"
9
+ s.version = "0.7.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 = "2015-07-08"
14
+ s.date = "2015-07-09"
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 = [
@@ -32,6 +32,7 @@ Gem::Specification.new do |s|
32
32
  "lib/edools/base.rb",
33
33
  "lib/edools/config.rb",
34
34
  "lib/edools/core.rb",
35
+ "lib/edools/core/address.rb",
35
36
  "lib/edools/core/api_key.rb",
36
37
  "lib/edools/core/base.rb",
37
38
  "lib/edools/core/category.rb",
@@ -53,6 +54,7 @@ Gem::Specification.new do |s|
53
54
  "lib/edools/ecommerce/product.rb",
54
55
  "lib/edools/initialization.rb",
55
56
  "lib/edools/paginated_collection.rb",
57
+ "spec/edools/core/address_spec.rb",
56
58
  "spec/edools/core/api_key_spec.rb",
57
59
  "spec/edools/core/base_spec.rb",
58
60
  "spec/edools/core/category_spec.rb",
@@ -71,6 +73,10 @@ Gem::Specification.new do |s|
71
73
  "spec/edools/core/student_spec.rb",
72
74
  "spec/edools/ecommerce/base_spec.rb",
73
75
  "spec/edools/ecommerce/product_spec.rb",
76
+ "spec/fixtures/vcr_cassettes/Edools_Core_Address/create_the_address.yml",
77
+ "spec/fixtures/vcr_cassettes/Edools_Core_Address/destroy_the_address.yml",
78
+ "spec/fixtures/vcr_cassettes/Edools_Core_Address/finds_the_address.yml",
79
+ "spec/fixtures/vcr_cassettes/Edools_Core_Address/update_the_address.yml",
74
80
  "spec/fixtures/vcr_cassettes/Edools_Core_ApiKey/finds_the_api_key.yml",
75
81
  "spec/fixtures/vcr_cassettes/Edools_Core_Category/create_the_category.yml",
76
82
  "spec/fixtures/vcr_cassettes/Edools_Core_Category/destroy_the_category.yml",
@@ -1,4 +1,5 @@
1
1
  require 'edools/core/base'
2
+ require 'edools/core/address'
2
3
  require 'edools/core/api_key'
3
4
  require 'edools/core/category'
4
5
  require 'edools/core/course'
@@ -0,0 +1,21 @@
1
+ require 'edools/core/base'
2
+
3
+ module Edools
4
+ module Core
5
+ class Address < Edools::Core::Base
6
+
7
+ def self.collection_path(prefix_options = {}, query_options = nil)
8
+ super
9
+
10
+ student_id = prefix_options[:student_id] || query_options.try(:[], :student_id)
11
+ collaborator_id = prefix_options[:collaborator_id] || query_options.try(:[], :collaborator_id)
12
+
13
+ if student_id
14
+ "/students/#{student_id}/#{collection_name}.#{format.extension}#{query_string(query_options)}"
15
+ elsif collaborator_id
16
+ "/collaborators/#{collaborator_id}/#{collection_name}.#{format.extension}#{query_string(query_options)}"
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,35 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
+
3
+ describe Edools::Core::Address, :vcr do
4
+ xit 'finds the address' do
5
+ address = Edools::Core::Address.find(1)
6
+
7
+ expect(address.id).to eq 1
8
+ end
9
+
10
+ xit 'update the address' do
11
+ address = Edools::Core::Address.find(1)
12
+ address.street = "Abc 2"
13
+
14
+ expect(address.save).to eq true
15
+ end
16
+
17
+ it 'create the address' do
18
+ address = Edools::Core::Address.new()
19
+ address.prefix_options[:student_id] = 1024
20
+ address.street = 'Abc'
21
+ address.number = 123
22
+ address.complement = 'Cde'
23
+ address.city = 'Nikiti'
24
+ address.state = 'RJ'
25
+ address.zip_code = '24210000'
26
+ address.district = 'Saint Rose'
27
+
28
+ expect(address.save).to eq true
29
+ end
30
+
31
+ xit 'destroy the address' do
32
+ address = Edools::Core::Address.find(1)
33
+ expect(address.destroy.code).to eq '204'
34
+ end
35
+ end
@@ -0,0 +1,67 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://core.edools.com/students/1024/addresses.json
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"address":{"street":"Abc","number":123,"complement":"Cde","city":"Nikiti","state":"RJ","zip_code":"24210000","district":"Saint
9
+ Rose"}}'
10
+ headers:
11
+ Content-Type:
12
+ - application/json
13
+ Authorization:
14
+ - Token token=84cc0400cd52f62f2e12309b502889ab:2fee1e06d56ab6394ab9acd4c6a8c62f
15
+ Accept:
16
+ - application/+json
17
+ Accept-Encoding:
18
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
19
+ User-Agent:
20
+ - Ruby
21
+ response:
22
+ status:
23
+ code: 201
24
+ message: Created
25
+ headers:
26
+ Cache-Control:
27
+ - max-age=0, private, must-revalidate
28
+ Content-Security-Policy-Report-Only:
29
+ - default-src https://* 'self'; connect-src https://* 'self'; font-src https://*
30
+ 'self'; frame-src https://* 'self'; img-src https://* 'self' data:; media-src
31
+ https://* 'self'; object-src https://* 'self'; script-src https://* 'self';
32
+ style-src https://* 'self'; report-uri https://core.edools.com/uri-directive;
33
+ Content-Type:
34
+ - application/vnd.edools.core.v1+json; charset=utf-8
35
+ Date:
36
+ - Thu, 09 Jul 2015 14:47:24 GMT
37
+ Etag:
38
+ - '"b32ab436769c507f6d608be0530463a8"'
39
+ Location:
40
+ - https://core.edools.com/addresses/1
41
+ Server:
42
+ - nginx/1.4.7
43
+ Status:
44
+ - 201 Created
45
+ Strict-Transport-Security:
46
+ - max-age=631152000; includeSubdomains
47
+ X-Content-Type-Options:
48
+ - nosniff
49
+ X-Frame-Options:
50
+ - DENY
51
+ X-Request-Id:
52
+ - d6db0e71-0a20-45ed-ba4f-01eb9cbd01e1
53
+ X-Runtime:
54
+ - '0.283767'
55
+ X-Xss-Protection:
56
+ - 1; mode=block
57
+ Content-Length:
58
+ - '225'
59
+ Connection:
60
+ - keep-alive
61
+ body:
62
+ encoding: UTF-8
63
+ string: '{"id":1,"street":"Abc","number":123,"complement":"Cde","city":"Nikiti","state":"RJ","zip_code":"24210000","district":"Saint
64
+ Rose","user_id":1024,"created_at":"2015-07-09T14:47:24.566Z","updated_at":"2015-07-09T14:47:24.566Z"}'
65
+ http_version:
66
+ recorded_at: Thu, 09 Jul 2015 14:47:24 GMT
67
+ recorded_with: VCR 2.9.2
@@ -0,0 +1,59 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://core.edools.com/addresses/1.json
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - application/+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: 401
21
+ message: Unauthorized
22
+ headers:
23
+ Cache-Control:
24
+ - no-cache
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, 09 Jul 2015 14:48:52 GMT
34
+ Server:
35
+ - nginx/1.4.7
36
+ Status:
37
+ - 401 Unauthorized
38
+ Strict-Transport-Security:
39
+ - max-age=631152000; includeSubdomains
40
+ X-Content-Type-Options:
41
+ - nosniff
42
+ X-Frame-Options:
43
+ - DENY
44
+ X-Request-Id:
45
+ - 37627e26-5ba8-4e00-a5eb-396f1068dfa0
46
+ X-Runtime:
47
+ - '0.050703'
48
+ X-Xss-Protection:
49
+ - 1; mode=block
50
+ Content-Length:
51
+ - '23'
52
+ Connection:
53
+ - keep-alive
54
+ body:
55
+ encoding: UTF-8
56
+ string: Resource not authorized
57
+ http_version:
58
+ recorded_at: Thu, 09 Jul 2015 14:48:52 GMT
59
+ recorded_with: VCR 2.9.2
@@ -0,0 +1,59 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://core.edools.com/addresses/1.json
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - application/+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: 401
21
+ message: Unauthorized
22
+ headers:
23
+ Cache-Control:
24
+ - no-cache
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, 09 Jul 2015 14:48:51 GMT
34
+ Server:
35
+ - nginx/1.4.7
36
+ Status:
37
+ - 401 Unauthorized
38
+ Strict-Transport-Security:
39
+ - max-age=631152000; includeSubdomains
40
+ X-Content-Type-Options:
41
+ - nosniff
42
+ X-Frame-Options:
43
+ - DENY
44
+ X-Request-Id:
45
+ - 2ec94a51-1418-49ea-aca9-ec815ecfa34e
46
+ X-Runtime:
47
+ - '0.043759'
48
+ X-Xss-Protection:
49
+ - 1; mode=block
50
+ Content-Length:
51
+ - '23'
52
+ Connection:
53
+ - keep-alive
54
+ body:
55
+ encoding: UTF-8
56
+ string: Resource not authorized
57
+ http_version:
58
+ recorded_at: Thu, 09 Jul 2015 14:48:50 GMT
59
+ recorded_with: VCR 2.9.2
@@ -0,0 +1,59 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://core.edools.com/addresses/1.json
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - application/+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: 401
21
+ message: Unauthorized
22
+ headers:
23
+ Cache-Control:
24
+ - no-cache
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, 09 Jul 2015 14:48:52 GMT
34
+ Server:
35
+ - nginx/1.4.7
36
+ Status:
37
+ - 401 Unauthorized
38
+ Strict-Transport-Security:
39
+ - max-age=631152000; includeSubdomains
40
+ X-Content-Type-Options:
41
+ - nosniff
42
+ X-Frame-Options:
43
+ - DENY
44
+ X-Request-Id:
45
+ - c2058b02-6ac1-476a-a70d-aa0d04b395a3
46
+ X-Runtime:
47
+ - '0.042585'
48
+ X-Xss-Protection:
49
+ - 1; mode=block
50
+ Content-Length:
51
+ - '23'
52
+ Connection:
53
+ - keep-alive
54
+ body:
55
+ encoding: UTF-8
56
+ string: Resource not authorized
57
+ http_version:
58
+ recorded_at: Thu, 09 Jul 2015 14:48:51 GMT
59
+ 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.6.0
4
+ version: 0.7.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: 2015-07-08 00:00:00.000000000 Z
11
+ date: 2015-07-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activeresource
@@ -172,6 +172,7 @@ files:
172
172
  - lib/edools/base.rb
173
173
  - lib/edools/config.rb
174
174
  - lib/edools/core.rb
175
+ - lib/edools/core/address.rb
175
176
  - lib/edools/core/api_key.rb
176
177
  - lib/edools/core/base.rb
177
178
  - lib/edools/core/category.rb
@@ -193,6 +194,7 @@ files:
193
194
  - lib/edools/ecommerce/product.rb
194
195
  - lib/edools/initialization.rb
195
196
  - lib/edools/paginated_collection.rb
197
+ - spec/edools/core/address_spec.rb
196
198
  - spec/edools/core/api_key_spec.rb
197
199
  - spec/edools/core/base_spec.rb
198
200
  - spec/edools/core/category_spec.rb
@@ -211,6 +213,10 @@ files:
211
213
  - spec/edools/core/student_spec.rb
212
214
  - spec/edools/ecommerce/base_spec.rb
213
215
  - spec/edools/ecommerce/product_spec.rb
216
+ - spec/fixtures/vcr_cassettes/Edools_Core_Address/create_the_address.yml
217
+ - spec/fixtures/vcr_cassettes/Edools_Core_Address/destroy_the_address.yml
218
+ - spec/fixtures/vcr_cassettes/Edools_Core_Address/finds_the_address.yml
219
+ - spec/fixtures/vcr_cassettes/Edools_Core_Address/update_the_address.yml
214
220
  - spec/fixtures/vcr_cassettes/Edools_Core_ApiKey/finds_the_api_key.yml
215
221
  - spec/fixtures/vcr_cassettes/Edools_Core_Category/create_the_category.yml
216
222
  - spec/fixtures/vcr_cassettes/Edools_Core_Category/destroy_the_category.yml