Class: PlatformSdk::Edfi::Client
- Inherits:
-
Object
- Object
- PlatformSdk::Edfi::Client
- Defined in:
- lib/platform_sdk/edfi/client.rb
Overview
IdMapper::Client
Instance Attribute Summary collapse
-
#conn ⇒ Object
readonly
Returns the value of attribute conn.
-
#domain ⇒ Object
readonly
Returns the value of attribute domain.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Instance Method Summary collapse
- #get_student_programs(uid) ⇒ Object
-
#initialize(base_url, auth_client) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(base_url, auth_client) ⇒ Client
Returns a new instance of Client.
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/platform_sdk/edfi/client.rb', line 9 def initialize(base_url, auth_client) @base_url ||= base_url @auth_client = auth_client @conn = Faraday.new(@base_url) do |faraday| faraday.headers = headers faraday.adapter Faraday.default_adapter faraday.response :json, content_type: /\bjson$/ faraday.response :raise_error end end |
Instance Attribute Details
#conn ⇒ Object (readonly)
Returns the value of attribute conn.
7 8 9 |
# File 'lib/platform_sdk/edfi/client.rb', line 7 def conn @conn end |
#domain ⇒ Object (readonly)
Returns the value of attribute domain.
7 8 9 |
# File 'lib/platform_sdk/edfi/client.rb', line 7 def domain @domain end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
7 8 9 |
# File 'lib/platform_sdk/edfi/client.rb', line 7 def token @token end |
Instance Method Details
#get_student_programs(uid) ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/platform_sdk/edfi/client.rb', line 21 def get_student_programs(uid) begin response = @conn.get("/ed-fi/v5.1.0/api/data/v3/ed-fi/studentProgramAssociations?studentUniqueId=#{uid}") response.body rescue Faraday::ResourceNotFound => e puts "Faraday::ResourceNotFound: #{e}" [] end end |