Sha256: 329b049292fb9246d508d2044d57392a1bfb4898a9b655f45335a1fb4384a8dd

Contents?: true

Size: 802 Bytes

Versions: 2

Compression:

Stored size: 802 Bytes

Contents

# frozen_string_literal: true
require 'faraday'


module SchoologyClient
  class Client
    attr_reader :oauth_consumer_key, :oauth_consumer_secret, :url

    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

    def group
      GroupResource.new(self)
    end

    def connection
      @connection
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
strongmind-schoology-client-0.1.5 lib/schoology_client/client.rb
strongmind-schoology-client-0.1.4 lib/schoology_client/client.rb