campus_ivy 0.1.0 → 0.1.1
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/campus_ivy/configuration.rb +2 -2
- data/lib/campus_ivy/connection.rb +5 -1
- data/lib/campus_ivy/resources/account.rb +9 -1
- data/lib/campus_ivy/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6b91ea8a262bcd0fc408fd4241eb06bc64f4e8b9290edeaaa8a81f9d30f41470
|
|
4
|
+
data.tar.gz: 8cde99cddefb22dc92b45523952b52d267dc0767d898a60879426011ddd44056
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9e3a90859cc7f155f783c85eb9e937d6a000f8d3d35a81af4e6400477e54339ba3a98a93ebf1074b8c2b2ea23e4e6ca5f2cff63339c9c13a05e0a25b25b05e35
|
|
7
|
+
data.tar.gz: 2cebc15d396c285b763363764b58ea4a2fa4dc26d3d541436a32076cc232d953730864117bcc41da7d872283856ed43ea0122825a42ef33a578a1bf6c5dc26d5
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
module CampusIvy
|
|
4
4
|
class Configuration
|
|
5
|
-
attr_accessor :
|
|
5
|
+
attr_accessor :token, :base_url
|
|
6
6
|
attr_reader :sandbox
|
|
7
7
|
|
|
8
8
|
def initialize
|
|
9
|
-
@
|
|
9
|
+
@token = nil
|
|
10
10
|
@sandbox = ENV['CAMPUS_IVY_USE_SANDBOX'] == 'true'
|
|
11
11
|
@base_url = @sandbox ? 'https://apisandbox.campusivy.com/Apis/CampusIvy.API/api' : 'https://api.campusivy.com/v1'
|
|
12
12
|
end
|
|
@@ -10,7 +10,7 @@ module CampusIvy
|
|
|
10
10
|
conn.request :json
|
|
11
11
|
|
|
12
12
|
# Authentication header
|
|
13
|
-
conn.request :authorization, :Bearer, config.
|
|
13
|
+
conn.request :authorization, :Bearer, config.token if config.token
|
|
14
14
|
|
|
15
15
|
conn.response :json, content_type: /\bjson$/
|
|
16
16
|
|
|
@@ -20,5 +20,9 @@ module CampusIvy
|
|
|
20
20
|
conn.adapter Faraday.default_adapter
|
|
21
21
|
end
|
|
22
22
|
end
|
|
23
|
+
|
|
24
|
+
def reset_connection
|
|
25
|
+
@connection = nil
|
|
26
|
+
end
|
|
23
27
|
end
|
|
24
28
|
end
|
|
@@ -45,7 +45,15 @@ module CampusIvy
|
|
|
45
45
|
password: password
|
|
46
46
|
}
|
|
47
47
|
end
|
|
48
|
-
|
|
48
|
+
|
|
49
|
+
result = CampusIvy::Object.new(response.body)
|
|
50
|
+
|
|
51
|
+
if result.token
|
|
52
|
+
@client.config.token = result.token
|
|
53
|
+
@client.reset_connection
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
result
|
|
49
57
|
end
|
|
50
58
|
|
|
51
59
|
sig do
|
data/lib/campus_ivy/version.rb
CHANGED