Class: Figshare::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/base.rb

Overview

Supporting web calls to the API

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(figshare_user:, conf_dir:) ⇒ Base

Init reads the Json configuration files, setting @course_codes_to_faculty and @academic_department_code_to_faculty Opens a connection to the LDAP server, setting @ldap for other methods to use.

Parameters:

  • figshare_user (String)

    figshare user, in the figshare_keys.json

  • conf_dir (String)

    directory for figshare_keys.json and figshare_site_params.json



21
22
23
24
25
26
27
28
29
30
# File 'lib/base.rb', line 21

def initialize(figshare_user:, conf_dir:)
  figshare_token = load_json_file("#{conf_dir}/figshare_keys.json")
  @auth_token = figshare_token[figshare_user]

  figshare_site_params = load_json_file("#{conf_dir}/figshare_site_params.json")

  @hostname = figshare_site_params['host']
  @api_url = figshare_site_params['api_url']
  @institute_id = figshare_site_params['institute_id']
end

Instance Attribute Details

#api_urlObject

Returns the value of attribute api_url.



13
14
15
# File 'lib/base.rb', line 13

def api_url
  @api_url
end

#article_index_fileObject

Returns the value of attribute article_index_file.



11
12
13
# File 'lib/base.rb', line 11

def article_index_file
  @article_index_file
end

#auth_tokenObject

Returns the value of attribute auth_token.



9
10
11
# File 'lib/base.rb', line 9

def auth_token
  @auth_token
end

#base_dirObject

Returns the value of attribute base_dir.



10
11
12
# File 'lib/base.rb', line 10

def base_dir
  @base_dir
end

#hostnameObject

Returns the value of attribute hostname.



12
13
14
# File 'lib/base.rb', line 12

def hostname
  @hostname
end

#institute_idObject

Returns the value of attribute institute_id.



14
15
16
# File 'lib/base.rb', line 14

def institute_id
  @institute_id
end