Class: Webex::User::File
- Inherits:
-
Object
- Object
- Webex::User::File
- Includes:
- Webex, Webex::User
- Defined in:
- lib/webex/user/file.rb
Overview
comment
Constant Summary
Constants included from Webex::User
Constants included from Webex
Instance Attribute Summary collapse
-
#back_url ⇒ Object
Returns the value of attribute back_url.
-
#current_directory ⇒ Object
Returns the value of attribute current_directory.
-
#file_name ⇒ Object
Returns the value of attribute file_name.
Instance Method Summary collapse
- #download ⇒ Object
- #generate_params(overwrite_params = {}) ⇒ Object
-
#initialize(attributes = {}) ⇒ File
constructor
A new instance of File.
- #list ⇒ Object
Methods included from Webex::User
Methods included from Webex
#env_attributes!, #option_required!
Constructor Details
#initialize(attributes = {}) ⇒ File
Returns a new instance of File.
10 11 12 13 14 |
# File 'lib/webex/user/file.rb', line 10 def initialize(attributes = {}) attributes.each { |k, v| send("#{k}=", v) } env_attributes! option_required! :back_url end |
Instance Attribute Details
#back_url ⇒ Object
Returns the value of attribute back_url.
8 9 10 |
# File 'lib/webex/user/file.rb', line 8 def back_url @back_url end |
#current_directory ⇒ Object
Returns the value of attribute current_directory.
8 9 10 |
# File 'lib/webex/user/file.rb', line 8 def current_directory @current_directory end |
#file_name ⇒ Object
Returns the value of attribute file_name.
8 9 10 |
# File 'lib/webex/user/file.rb', line 8 def file_name @file_name end |
Instance Method Details
#download ⇒ Object
16 17 18 19 20 |
# File 'lib/webex/user/file.rb', line 16 def download option_required! :file_name res = Net::HTTP.post_form post_url, generate_params(api_type: 'DF') Hash[res.body.stringify_string.split('&').map! { |i| i.split('=') }] end |
#generate_params(overwrite_params = {}) ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/webex/user/file.rb', line 27 def generate_params(overwrite_params = {}) result = {} result[:AT] = overwrite_params[:api_type] result[:BU] = back_url result[:FN] = file_name if result[:AT] == 'DF' result[:CD] = current_directory if result[:AT] == 'LF' result.delete_if { |k, v| v.nil? } end |
#list ⇒ Object
22 23 24 25 |
# File 'lib/webex/user/file.rb', line 22 def list res = Net::HTTP.post_form post_url, generate_params(api_type: 'LF') Hash[res.body.stringify_string.split('&').map! { |i| i.split('=') }] end |