Class: Figshare::Base
- Inherits:
-
Object
- Object
- Figshare::Base
- Defined in:
- lib/base.rb
Overview
Supporting web calls to the API
Direct Known Subclasses
Authors, Institutions, Other, PrivateArticles, PrivateCollections, PrivateProjects, PublicArticles, PublicCollections, PublicProjects
Instance Attribute Summary collapse
-
#api_url ⇒ Object
Returns the value of attribute api_url.
-
#article_index_file ⇒ Object
Returns the value of attribute article_index_file.
-
#auth_token ⇒ Object
Returns the value of attribute auth_token.
-
#base_dir ⇒ Object
Returns the value of attribute base_dir.
-
#hostname ⇒ Object
Returns the value of attribute hostname.
-
#institute_id ⇒ Object
Returns the value of attribute institute_id.
Instance Method Summary collapse
-
#initialize(figshare_user:, conf_dir: nil, key_file: nil, conf_file: nil) ⇒ Base
constructor
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.
Constructor Details
#initialize(figshare_user:, conf_dir: nil, key_file: nil, conf_file: nil) ⇒ 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.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/base.rb', line 19 def initialize(figshare_user:, conf_dir: nil, key_file: nil, conf_file: nil) raise 'Figshare_api_v2.initialize: Need to specify the conf_dir if key_file or conf_file are nil' if conf_dir.nil? && (key_file.nil? || conf_file.nil?) conf_file ||= "#{conf_dir}/figshare_site_params.json" key_file ||= "#{conf_dir}/figshare_keys.json" figshare_token = load_json_file(key_file) @auth_token = figshare_token[figshare_user] figshare_site_params = load_json_file(conf_file) @hostname = figshare_site_params['host'] @api_url = figshare_site_params['api_url'] @institute_id = figshare_site_params['institute_id'] end |
Instance Attribute Details
#api_url ⇒ Object
Returns the value of attribute api_url.
9 10 11 |
# File 'lib/base.rb', line 9 def api_url @api_url end |
#article_index_file ⇒ Object
Returns the value of attribute article_index_file.
7 8 9 |
# File 'lib/base.rb', line 7 def article_index_file @article_index_file end |
#auth_token ⇒ Object
Returns the value of attribute auth_token.
5 6 7 |
# File 'lib/base.rb', line 5 def auth_token @auth_token end |
#base_dir ⇒ Object
Returns the value of attribute base_dir.
6 7 8 |
# File 'lib/base.rb', line 6 def base_dir @base_dir end |
#hostname ⇒ Object
Returns the value of attribute hostname.
8 9 10 |
# File 'lib/base.rb', line 8 def hostname @hostname end |
#institute_id ⇒ Object
Returns the value of attribute institute_id.
10 11 12 |
# File 'lib/base.rb', line 10 def institute_id @institute_id end |