Class: CanvasDataClient::Client

Inherits:
Object
  • Object
show all
Includes:
Helpers::CsvHelper, Helpers::HMACHelper
Defined in:
lib/canvas_data_client/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helpers::CsvHelper

#download_latest_to_csv_file, #download_to_csv_file

Methods included from Helpers::HMACHelper

#compute_signature, #headers

Methods included from Helpers::TimeHelper

#rfc7231

Constructor Details

#initialize(key, secret, opts = {}) ⇒ Client

Returns a new instance of Client.



10
11
12
13
14
15
16
# File 'lib/canvas_data_client/client.rb', line 10

def initialize(key, secret, opts = {})
  self.key = key
  self.secret = secret
  self.subdomain = opts[:subdomain] || 'portal'
  self. = opts[:account] || 'self'
  self.logger = Logger.new(STDOUT)
end

Instance Attribute Details

#accountObject

Returns the value of attribute account.



8
9
10
# File 'lib/canvas_data_client/client.rb', line 8

def 
  @account
end

#keyObject

Returns the value of attribute key.



8
9
10
# File 'lib/canvas_data_client/client.rb', line 8

def key
  @key
end

#loggerObject

Returns the value of attribute logger.



8
9
10
# File 'lib/canvas_data_client/client.rb', line 8

def logger
  @logger
end

#secretObject

Returns the value of attribute secret.



8
9
10
# File 'lib/canvas_data_client/client.rb', line 8

def secret
  @secret
end

#subdomainObject

Returns the value of attribute subdomain.



8
9
10
# File 'lib/canvas_data_client/client.rb', line 8

def subdomain
  @subdomain
end

Instance Method Details

#domainObject



18
19
20
# File 'lib/canvas_data_client/client.rb', line 18

def domain
  "https://#{subdomain}.inshosteddata.com"
end

#dump(dump_id) ⇒ Object



35
36
37
# File 'lib/canvas_data_client/client.rb', line 35

def dump(dump_id)
  json_request "#{domain}/api/account/#{}/file/byDump/#{dump_id}"
end

#dumpsObject



27
28
29
# File 'lib/canvas_data_client/client.rb', line 27

def dumps
  paginated_request "#{domain}/api/account/#{}/dump?after=%s"
end

#get_latest_dumpsObject



31
32
33
# File 'lib/canvas_data_client/client.rb', line 31

def get_latest_dumps
  json_request "#{domain}/api/account/#{}/dump"
end

#latest_filesObject Also known as: latest



22
23
24
# File 'lib/canvas_data_client/client.rb', line 22

def latest_files
  json_request "#{domain}/api/account/#{}/file/latest"
end

#latest_schemaObject



47
48
49
# File 'lib/canvas_data_client/client.rb', line 47

def latest_schema
  json_request "#{domain}/api/schema/latest"
end

#schema(version) ⇒ Object



51
52
53
# File 'lib/canvas_data_client/client.rb', line 51

def schema(version)
  json_request "#{domain}/api/schema/#{version}"
end

#schemasObject



43
44
45
# File 'lib/canvas_data_client/client.rb', line 43

def schemas
  json_request "#{domain}/api/schema"
end

#tables(table) ⇒ Object



39
40
41
# File 'lib/canvas_data_client/client.rb', line 39

def tables(table)
  paginated_request "#{domain}/api/account/#{}/file/byTable/#{table}?after=%s"
end