Class: Figshare::Init
- Inherits:
-
Object
- Object
- Figshare::Init
- Defined in:
- lib/figshare_api_v2.rb
Overview
HACK: to do a lazy initialization of the Figshare subclasses. i.e. only if they get called. Usage: @figshare = Figshare::Init.new(figshare_user: ‘figshare_admin’, conf_dir: “#<strong>dir</strong>/conf”)
@figshare.authors.detail(author_id: 12345) { |a| puts a } @figshare.institutions.private_articles { |article| puts article } …
Instance Method Summary collapse
-
#authors ⇒ Figshare::Authors
Create Figshare::Authors, if it doesn’t exist.
-
#initialize(figshare_user:, conf_dir: nil, key_file: nil, conf_file: nil) ⇒ Init
constructor
Intitialize the Init class, so it can dynamically initialize the Figshare subclasses.
-
#institutions ⇒ Figshare::Institutions
Create Figshare::Institutions, if it doesn’t exist.
-
#oai_pmh ⇒ Figshare::OAI_PMH
Create Figshare::OAI_PMH, if it doesn’t exist.
-
#other ⇒ Figshare::Other
Create Figshare::Other, if it doesn’t exist.
-
#private_articles ⇒ Figshare::PrivateArticles
Create Figshare::PrivateArticles, if it doesn’t exist.
-
#private_collections ⇒ Figshare::PrivateCollections
Create Figshare::PrivateCollections, if it doesn’t exist.
-
#private_projects ⇒ Figshare::PrivateProjects
Create Figshare::PrivateProjects, if it doesn’t exist.
-
#public_articles ⇒ Figshare::PublicArticles
Create Figshare::PublicArticles, if it doesn’t exist.
-
#public_collections ⇒ Figshare::PublicCollections
Create Figshare::PublicCollections, if it doesn’t exist.
-
#public_projects ⇒ Figshare::PublicProjects
Create Figshare::PublicProjects, if it doesn’t exist.
-
#stats ⇒ Figshare::Stats
Create Figshare::Stats, if it doesn’t exist.
-
#upload ⇒ Figshare::Upload
Create Figshare::Upload, if it doesn’t exist.
Constructor Details
#initialize(figshare_user:, conf_dir: nil, key_file: nil, conf_file: nil) ⇒ Init
Intitialize the Init class, so it can dynamically initialize the Figshare subclasses
39 40 41 42 43 44 |
# File 'lib/figshare_api_v2.rb', line 39 def initialize(figshare_user:, conf_dir: nil, key_file: nil, conf_file: nil) @figshare_user = figshare_user @conf_dir = conf_dir @key_file = key_file @conf_file = conf_file end |
Instance Method Details
#authors ⇒ Figshare::Authors
Create Figshare::Authors, if it doesn’t exist. Initialized with @figshare_user and @conf_dir
49 50 51 |
# File 'lib/figshare_api_v2.rb', line 49 def @authors ||= Authors.new(figshare_user: @figshare_user, conf_dir: @conf_dir, key_file: @key_file, conf_file: @conf_file) end |
#institutions ⇒ Figshare::Institutions
Create Figshare::Institutions, if it doesn’t exist. Initialized with @figshare_user and @conf_dir
56 57 58 |
# File 'lib/figshare_api_v2.rb', line 56 def institutions @institutions ||= Institutions.new(figshare_user: @figshare_user, conf_dir: @conf_dir, key_file: @key_file, conf_file: @conf_file) end |
#oai_pmh ⇒ Figshare::OAI_PMH
Create Figshare::OAI_PMH, if it doesn’t exist. Initialized with @figshare_user and @conf_dir
126 127 128 |
# File 'lib/figshare_api_v2.rb', line 126 def oai_pmh @oai_pmh ||= OAI_PMH.new(figshare_user: @figshare_user, conf_dir: @conf_dir, key_file: @key_file, conf_file: @conf_file) end |
#other ⇒ Figshare::Other
Create Figshare::Other, if it doesn’t exist. Initialized with @figshare_user and @conf_dir
63 64 65 |
# File 'lib/figshare_api_v2.rb', line 63 def other @other ||= Other.new(figshare_user: @figshare_user, conf_dir: @conf_dir, key_file: @key_file, conf_file: @conf_file) end |
#private_articles ⇒ Figshare::PrivateArticles
Create Figshare::PrivateArticles, if it doesn’t exist. Initialized with @figshare_user and @conf_dir
70 71 72 |
# File 'lib/figshare_api_v2.rb', line 70 def private_articles @private_articles ||= PrivateArticles.new(figshare_user: @figshare_user, conf_dir: @conf_dir, key_file: @key_file, conf_file: @conf_file) end |
#private_collections ⇒ Figshare::PrivateCollections
Create Figshare::PrivateCollections, if it doesn’t exist. Initialized with @figshare_user and @conf_dir
77 78 79 |
# File 'lib/figshare_api_v2.rb', line 77 def private_collections @private_collections ||= PrivateCollections.new(figshare_user: @figshare_user, conf_dir: @conf_dir, key_file: @key_file, conf_file: @conf_file) end |
#private_projects ⇒ Figshare::PrivateProjects
Create Figshare::PrivateProjects, if it doesn’t exist. Initialized with @figshare_user and @conf_dir
84 85 86 |
# File 'lib/figshare_api_v2.rb', line 84 def private_projects @private_projects ||= PrivateProjects.new(figshare_user: @figshare_user, conf_dir: @conf_dir, key_file: @key_file, conf_file: @conf_file) end |
#public_articles ⇒ Figshare::PublicArticles
Create Figshare::PublicArticles, if it doesn’t exist. Initialized with @figshare_user and @conf_dir
91 92 93 |
# File 'lib/figshare_api_v2.rb', line 91 def public_articles @public_articles ||= PublicArticles.new(figshare_user: @figshare_user, conf_dir: @conf_dir, key_file: @key_file, conf_file: @conf_file) end |
#public_collections ⇒ Figshare::PublicCollections
Create Figshare::PublicCollections, if it doesn’t exist. Initialized with @figshare_user and @conf_dir
98 99 100 |
# File 'lib/figshare_api_v2.rb', line 98 def public_collections @public_collections ||= PublicCollections.new(figshare_user: @figshare_user, conf_dir: @conf_dir, key_file: @key_file, conf_file: @conf_file) end |
#public_projects ⇒ Figshare::PublicProjects
Create Figshare::PublicProjects, if it doesn’t exist. Initialized with @figshare_user and @conf_dir
105 106 107 |
# File 'lib/figshare_api_v2.rb', line 105 def public_projects @public_projects ||= PublicProjects.new(figshare_user: @figshare_user, conf_dir: @conf_dir, key_file: @key_file, conf_file: @conf_file) end |
#stats ⇒ Figshare::Stats
Create Figshare::Stats, if it doesn’t exist. Initialized with @figshare_user and @conf_dir
119 120 121 |
# File 'lib/figshare_api_v2.rb', line 119 def stats @stats ||= Stats.new(figshare_user: @figshare_user, conf_dir: @conf_dir, key_file: @key_file, conf_file: @conf_file) end |
#upload ⇒ Figshare::Upload
Create Figshare::Upload, if it doesn’t exist. Initialized with @figshare_user and @conf_dir
112 113 114 |
# File 'lib/figshare_api_v2.rb', line 112 def upload @upload ||= Upload.new(figshare_user: @figshare_user, conf_dir: @conf_dir, key_file: @key_file, conf_file: @conf_file) end |