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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f4cb4e26d5923cc56a29d4cd0b70289004d39299720baf5207345674ca7392bf
4
- data.tar.gz: ba09678a33c23594f4612665b004272ab90d8d3ee0a58c94478be8188963e95c
3
+ metadata.gz: 6b91ea8a262bcd0fc408fd4241eb06bc64f4e8b9290edeaaa8a81f9d30f41470
4
+ data.tar.gz: 8cde99cddefb22dc92b45523952b52d267dc0767d898a60879426011ddd44056
5
5
  SHA512:
6
- metadata.gz: 0133ba499fee8a4ba7261ebdf445d694f19d9fd35df9fd5fdbbdfbbcc6c1f71ee155d1f2a2368f892a3bfaa30167bad1e803521f3150a045b9bf1b99968a31f2
7
- data.tar.gz: ed185bb83060c9311e66e53ad0baaf5dce2673c16c5d09560ff793379fc860584de6c9c88e0dadd6d49467164859c0c8a2169fff88436fa55f0549458ef9b3e6
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 :api_key, :base_url
5
+ attr_accessor :token, :base_url
6
6
  attr_reader :sandbox
7
7
 
8
8
  def initialize
9
- @api_key = nil
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.api_key if config.api_key
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
- CampusIvy::Object.new(response.body)
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CampusIvy
4
- VERSION = "0.1.0"
4
+ VERSION = '0.1.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: campus_ivy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - marcus.salinas