Module: Wistia
- Defined in:
- lib/wistia.rb,
lib/wistia/base.rb,
lib/wistia/media.rb,
lib/wistia/config.rb,
lib/wistia/project.rb,
lib/wistia/projects/sharing.rb
Defined Under Namespace
Modules: Config, Projects Classes: Base, Media, Project
Class Method Summary (collapse)
- + (Object) config(&block)
-
+ (Object) format=(fmt)
Set the format that the API uses to either 'json' or 'xml'.
-
+ (Object) password=(pw)
Set your API password using this method.
-
+ (Object) refresh_config!
Force each ActiveResource descendant to re-read its configuration from the configatron.
-
+ (Object) use_config!(config)
Specifies a new configuration to use for the API.
Class Method Details
+ (Object) config(&block)
5 6 7 |
# File 'lib/wistia/config.rb', line 5 def config(&block) Wistia::Config.config(&block) end |
+ (Object) format=(fmt)
Set the format that the API uses to either 'json' or 'xml'. Accepts either a String or a Symbol.
35 36 37 38 39 |
# File 'lib/wistia.rb', line 35 def self.format=(fmt) valid_formats = [ :json, :xml ] raise ArgumentError, "Invalid format. Supported formats: #{valid_formats.join(', ')}." unless valid_formats.include?(fmt.to_sym) use_config!(:wistia => { :api => { :format => fmt.to_sym } }) end |
+ (Object) password=(pw)
Set your API password using this method. For instructions to find your API password, go here: wistia.com/doc/api-enable
29 30 31 |
# File 'lib/wistia.rb', line 29 def self.password=(pw) use_config!(:wistia => { :api => { :key => pw } }) end |
+ (Object) refresh_config!
Force each ActiveResource descendant to re-read its configuration from the configatron.
42 43 44 45 46 |
# File 'lib/wistia.rb', line 42 def self.refresh_config! Wistia::Media.refresh_config! Wistia::Project.refresh_config! Wistia::Projects::Sharing.refresh_config! end |
+ (Object) use_config!(config)
Specifies a new configuration to use for the API. Accepts either a Hash or a String pointing to a YAML configuration file.
Example using a Hash:
Wistia.use_config!(:wistia => { :api => { :key => 'your-api-key', :format => 'json-or-xml' } })
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/wistia.rb', line 15 def self.use_config!(config) if config.is_a?(String) && File.exists?(config) && File.extname(config) == '.yml' configatron.configure_from_yaml(config) elsif config.is_a?(Hash) configatron.configure_from_hash(config) else raise ArgumentError, 'Invalid config' end refresh_config! end |