fortytwo 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.
- checksums.yaml +4 -4
- data/lib/fortytwo/client.rb +0 -4
- data/lib/fortytwo/version.rb +1 -1
- metadata +1 -2
- data/lib/fortytwo/error.rb +0 -67
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6952833d0651aa41b4fec55e1e642e2b0c1f69c6
|
4
|
+
data.tar.gz: b7043903d72e39385f6e48cf6b127f63987c17cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf7bdef762b93f1ec6359d90426f64e585ec2116df4de82823511c71aed2cc6d33c17dc36d51ccaca090b715a3182d5526174d82e3538fd3a87a3b94aa944c88
|
7
|
+
data.tar.gz: 033e1f170801bfbb8806b7ad9ac607ff891eb68fb9fd12901ce057747a03be9c1e7ecccb7b065653b6af0a566268f78b59189d9aa478a2ebdff5fa0ed15e6cfa
|
data/lib/fortytwo/client.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'oauth2'
|
2
2
|
|
3
3
|
require 'fortytwo/configuration'
|
4
|
-
# require 'fortytwo/error'
|
5
4
|
require 'fortytwo/endpoints/user'
|
6
5
|
|
7
6
|
module FortyTwo
|
@@ -22,8 +21,6 @@ module FortyTwo
|
|
22
21
|
end
|
23
22
|
|
24
23
|
def configure
|
25
|
-
# raise Error::AlreadyConfigured unless @configuration.nil?
|
26
|
-
|
27
24
|
@configuration = Configuration.new
|
28
25
|
yield(@configuration)
|
29
26
|
check_api_keys
|
@@ -32,7 +29,6 @@ module FortyTwo
|
|
32
29
|
def check_api_keys
|
33
30
|
if configuration.nil? || configuration.invalid?
|
34
31
|
@configuration = nil
|
35
|
-
# raise Error::MissingAPIKeys
|
36
32
|
else
|
37
33
|
@configuration.freeze
|
38
34
|
end
|
data/lib/fortytwo/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fortytwo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matias Fernandez
|
@@ -123,7 +123,6 @@ files:
|
|
123
123
|
- lib/fortytwo/client.rb
|
124
124
|
- lib/fortytwo/configuration.rb
|
125
125
|
- lib/fortytwo/endpoints/user.rb
|
126
|
-
- lib/fortytwo/error.rb
|
127
126
|
- lib/fortytwo/responses/base.rb
|
128
127
|
- lib/fortytwo/responses/models/campus.rb
|
129
128
|
- lib/fortytwo/responses/models/cursus.rb
|
data/lib/fortytwo/error.rb
DELETED
@@ -1,67 +0,0 @@
|
|
1
|
-
# module FortyTwo
|
2
|
-
# module Error
|
3
|
-
|
4
|
-
# # Not sure if this will work...
|
5
|
-
# class ResponseValidator
|
6
|
-
# def validate(response)
|
7
|
-
# return if successful_response?(response)
|
8
|
-
# raise error_from_response(response)
|
9
|
-
# end
|
10
|
-
|
11
|
-
# def successful_response?(response)
|
12
|
-
# (200..399).include?(response.status)
|
13
|
-
# end
|
14
|
-
|
15
|
-
# def error_from_response(response)
|
16
|
-
# body = JSON.parse(response.body)
|
17
|
-
# klass = error_classes[body['error']['id']]
|
18
|
-
# klass.new(body['error']['text'], body['error'])
|
19
|
-
# end
|
20
|
-
|
21
|
-
# def error_classes
|
22
|
-
# @@error_classes ||= Hash.new do |hash, key|
|
23
|
-
# class_name = key.split('_').map(&:capitalize).join('').gsub('Oauth', 'OAuth')
|
24
|
-
# hash[key] = FortyTwo::Error.const_get(class_name)
|
25
|
-
# end
|
26
|
-
# end
|
27
|
-
# end
|
28
|
-
|
29
|
-
# def self.check_for_error(response)
|
30
|
-
# @response_validator ||= ResponseValidator.new
|
31
|
-
# @response_validator.validate(response)
|
32
|
-
# end
|
33
|
-
|
34
|
-
# class Base < StandardError
|
35
|
-
# def initialize(msg, error = nil)
|
36
|
-
# super(msg)
|
37
|
-
# end
|
38
|
-
# end
|
39
|
-
|
40
|
-
# class AlreadyConfigured < Base
|
41
|
-
# def initialize(msg = 'Gem cannot be reconfigured. Initialize a new ' +
|
42
|
-
# 'instance of FortyTwo::Client', error = nil)
|
43
|
-
# super
|
44
|
-
# end
|
45
|
-
# end
|
46
|
-
|
47
|
-
# class MissingAPIKeys < Base
|
48
|
-
# def initialize(msg = "You're missing an API key", error = nil)
|
49
|
-
# super
|
50
|
-
# end
|
51
|
-
# end
|
52
|
-
|
53
|
-
# # Not sure this will work.
|
54
|
-
# class InvalidParameter < Base
|
55
|
-
# attr_reader :text, :field
|
56
|
-
|
57
|
-
# def initialize(msg = 'One or more parameters were invalid', error = nil)
|
58
|
-
# unless error.nil?
|
59
|
-
# @text = error['text']
|
60
|
-
# @field = error['field']
|
61
|
-
# msg = msg + ': ' + @field
|
62
|
-
# end
|
63
|
-
# super(msg, error)
|
64
|
-
# end
|
65
|
-
# end
|
66
|
-
# end
|
67
|
-
# end
|