Class: SchoologyClient::Client
- Inherits:
-
Object
- Object
- SchoologyClient::Client
- Defined in:
- lib/schoology_client/client.rb
Instance Attribute Summary collapse
-
#oauth_consumer_key ⇒ Object
readonly
Returns the value of attribute oauth_consumer_key.
-
#oauth_consumer_secret ⇒ Object
readonly
Returns the value of attribute oauth_consumer_secret.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #connection ⇒ Object
- #group ⇒ Object
-
#initialize(conn = nil) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(conn = nil) ⇒ Client
Returns a new instance of Client.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/schoology_client/client.rb', line 9 def initialize(conn = nil) if conn.nil? # setup faraday connection using 2-legged oauth 1.0 @connection = Faraday.new(url: SchoologyClient.configuration.url) do |faraday| faraday.request :json faraday.request :oauth, { consumer_key: SchoologyClient.configuration.oauth_consumer_key, consumer_secret: SchoologyClient.configuration.oauth_consumer_secret } faraday.response :json end else @connection = conn end end |
Instance Attribute Details
#oauth_consumer_key ⇒ Object (readonly)
Returns the value of attribute oauth_consumer_key.
7 8 9 |
# File 'lib/schoology_client/client.rb', line 7 def oauth_consumer_key @oauth_consumer_key end |
#oauth_consumer_secret ⇒ Object (readonly)
Returns the value of attribute oauth_consumer_secret.
7 8 9 |
# File 'lib/schoology_client/client.rb', line 7 def oauth_consumer_secret @oauth_consumer_secret end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
7 8 9 |
# File 'lib/schoology_client/client.rb', line 7 def url @url end |
Instance Method Details
#connection ⇒ Object
30 31 32 |
# File 'lib/schoology_client/client.rb', line 30 def connection @connection end |
#group ⇒ Object
26 27 28 |
# File 'lib/schoology_client/client.rb', line 26 def group GroupResource.new(self) end |