files.com 1.0.70 → 1.0.75
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +82 -0
- data/_VERSION +1 -1
- data/docs/bundle.md +13 -3
- data/docs/clickwrap.md +143 -0
- data/docs/remote_server.md +53 -4
- data/docs/site.md +4 -0
- data/docs/user.md +8 -0
- data/files.com.gemspec +3 -3
- data/lib/files.com.rb +2 -1
- data/lib/files.com/models/behavior.rb +2 -2
- data/lib/files.com/models/bundle.rb +24 -0
- data/lib/files.com/models/clickwrap.rb +197 -0
- data/lib/files.com/models/file.rb +4 -4
- data/lib/files.com/models/file_action.rb +3 -1
- data/lib/files.com/models/folder.rb +1 -0
- data/lib/files.com/models/remote_server.rb +114 -0
- data/lib/files.com/models/session.rb +1 -0
- data/lib/files.com/models/site.rb +7 -0
- data/lib/files.com/models/user.rb +15 -0
- data/lib/files.com/sizable_io.rb +2 -2
- data/spec/spec_helper.rb +1 -3
- data/test/test.rb +1 -1
- metadata +18 -15
    
        data/docs/site.md
    CHANGED
    
    | @@ -83,6 +83,7 @@ | |
| 83 83 | 
             
              "session": "",
         | 
| 84 84 | 
             
              "session_pinned_by_ip": true,
         | 
| 85 85 | 
             
              "sftp_user_root_enabled": true,
         | 
| 86 | 
            +
              "sharing_enabled": true,
         | 
| 86 87 | 
             
              "show_request_access_link": true,
         | 
| 87 88 | 
             
              "site_footer": "",
         | 
| 88 89 | 
             
              "site_header": "",
         | 
| @@ -193,6 +194,7 @@ | |
| 193 194 | 
             
            * `session`: Current session
         | 
| 194 195 | 
             
            * `session_pinned_by_ip` (boolean): Are sessions locked to the same IP? (i.e. do users need to log in again if they change IPs?)
         | 
| 195 196 | 
             
            * `sftp_user_root_enabled` (boolean): Use user FTP roots also for SFTP?
         | 
| 197 | 
            +
            * `sharing_enabled` (boolean): Allow bundle creation
         | 
| 196 198 | 
             
            * `show_request_access_link` (boolean): Show request access link for users without access?  Currently unused.
         | 
| 197 199 | 
             
            * `site_footer` (string): Custom site footer text
         | 
| 198 200 | 
             
            * `site_header` (string): Custom site header text
         | 
| @@ -295,6 +297,7 @@ Files::Site.update( | |
| 295 297 | 
             
              disable_users_from_inactivity_period_days: 1, 
         | 
| 296 298 | 
             
              non_sso_groups_allowed: true, 
         | 
| 297 299 | 
             
              non_sso_users_allowed: true, 
         | 
| 300 | 
            +
              sharing_enabled: true, 
         | 
| 298 301 | 
             
              allowed_2fa_method_sms: true, 
         | 
| 299 302 | 
             
              allowed_2fa_method_u2f: true, 
         | 
| 300 303 | 
             
              allowed_2fa_method_totp: true, 
         | 
| @@ -385,6 +388,7 @@ Files::Site.update( | |
| 385 388 | 
             
            * `disable_users_from_inactivity_period_days` (int64): If greater than zero, users will unable to login if they do not show activity within this number of days.
         | 
| 386 389 | 
             
            * `non_sso_groups_allowed` (boolean): If true, groups can be manually created / modified / deleted by Site Admins. Otherwise, groups can only be managed via your SSO provider.
         | 
| 387 390 | 
             
            * `non_sso_users_allowed` (boolean): If true, users can be manually created / modified / deleted by Site Admins. Otherwise, users can only be managed via your SSO provider.
         | 
| 391 | 
            +
            * `sharing_enabled` (boolean): Allow bundle creation
         | 
| 388 392 | 
             
            * `allowed_2fa_method_sms` (boolean): Is SMS two factor authentication allowed?
         | 
| 389 393 | 
             
            * `allowed_2fa_method_u2f` (boolean): Is U2F two factor authentication allowed?
         | 
| 390 394 | 
             
            * `allowed_2fa_method_totp` (boolean): Is TOTP two factor authentication allowed?
         | 
    
        data/docs/user.md
    CHANGED
    
    | @@ -26,6 +26,7 @@ | |
| 26 26 | 
             
              "group_ids": [
         | 
| 27 27 |  | 
| 28 28 | 
             
              ],
         | 
| 29 | 
            +
              "header_text": "User-specific message.",
         | 
| 29 30 | 
             
              "language": "en",
         | 
| 30 31 | 
             
              "last_login_at": "2000-01-01T01:00:00Z",
         | 
| 31 32 | 
             
              "last_protocol_cipher": "",
         | 
| @@ -72,6 +73,7 @@ | |
| 72 73 | 
             
            * `email` (email): User email address
         | 
| 73 74 | 
             
            * `ftp_permission` (boolean): Can the user access with FTP/FTPS?
         | 
| 74 75 | 
             
            * `group_ids` (array): Comma-separated list of group IDs of which this user is a member
         | 
| 76 | 
            +
            * `header_text` (string): Text to display to the user in the header of the UI
         | 
| 75 77 | 
             
            * `language` (string): Preferred language
         | 
| 76 78 | 
             
            * `last_login_at` (date-time): User's last login time
         | 
| 77 79 | 
             
            * `last_protocol_cipher` (string): The last protocol and cipher used
         | 
| @@ -169,6 +171,7 @@ Files::User.create( | |
| 169 171 | 
             
              dav_permission: true, 
         | 
| 170 172 | 
             
              disabled: true, 
         | 
| 171 173 | 
             
              ftp_permission: true, 
         | 
| 174 | 
            +
              header_text: "User-specific message.", 
         | 
| 172 175 | 
             
              language: "en", 
         | 
| 173 176 | 
             
              notification_daily_send_time: 18, 
         | 
| 174 177 | 
             
              name: "John Doe", 
         | 
| @@ -212,6 +215,7 @@ Files::User.create( | |
| 212 215 | 
             
            * `dav_permission` (boolean): Can the user connect with WebDAV?
         | 
| 213 216 | 
             
            * `disabled` (boolean): Is user disabled? Disabled users cannot log in, and do not count for billing purposes.  Users can be automatically disabled after an inactivity period via a Site setting.
         | 
| 214 217 | 
             
            * `ftp_permission` (boolean): Can the user access with FTP/FTPS?
         | 
| 218 | 
            +
            * `header_text` (string): Text to display to the user in the header of the UI
         | 
| 215 219 | 
             
            * `language` (string): Preferred language
         | 
| 216 220 | 
             
            * `notification_daily_send_time` (int64): Hour of the day at which daily notifications should be sent. Can be in range 0 to 23
         | 
| 217 221 | 
             
            * `name` (string): User's full name
         | 
| @@ -291,6 +295,7 @@ Files::User.update(id, | |
| 291 295 | 
             
              dav_permission: true, 
         | 
| 292 296 | 
             
              disabled: true, 
         | 
| 293 297 | 
             
              ftp_permission: true, 
         | 
| 298 | 
            +
              header_text: "User-specific message.", 
         | 
| 294 299 | 
             
              language: "en", 
         | 
| 295 300 | 
             
              notification_daily_send_time: 18, 
         | 
| 296 301 | 
             
              name: "John Doe", 
         | 
| @@ -335,6 +340,7 @@ Files::User.update(id, | |
| 335 340 | 
             
            * `dav_permission` (boolean): Can the user connect with WebDAV?
         | 
| 336 341 | 
             
            * `disabled` (boolean): Is user disabled? Disabled users cannot log in, and do not count for billing purposes.  Users can be automatically disabled after an inactivity period via a Site setting.
         | 
| 337 342 | 
             
            * `ftp_permission` (boolean): Can the user access with FTP/FTPS?
         | 
| 343 | 
            +
            * `header_text` (string): Text to display to the user in the header of the UI
         | 
| 338 344 | 
             
            * `language` (string): Preferred language
         | 
| 339 345 | 
             
            * `notification_daily_send_time` (int64): Hour of the day at which daily notifications should be sent. Can be in range 0 to 23
         | 
| 340 346 | 
             
            * `name` (string): User's full name
         | 
| @@ -435,6 +441,7 @@ user.update( | |
| 435 441 | 
             
              dav_permission: true,
         | 
| 436 442 | 
             
              disabled: true,
         | 
| 437 443 | 
             
              ftp_permission: true,
         | 
| 444 | 
            +
              header_text: "User-specific message.",
         | 
| 438 445 | 
             
              language: "en",
         | 
| 439 446 | 
             
              notification_daily_send_time: 18,
         | 
| 440 447 | 
             
              name: "John Doe",
         | 
| @@ -479,6 +486,7 @@ user.update( | |
| 479 486 | 
             
            * `dav_permission` (boolean): Can the user connect with WebDAV?
         | 
| 480 487 | 
             
            * `disabled` (boolean): Is user disabled? Disabled users cannot log in, and do not count for billing purposes.  Users can be automatically disabled after an inactivity period via a Site setting.
         | 
| 481 488 | 
             
            * `ftp_permission` (boolean): Can the user access with FTP/FTPS?
         | 
| 489 | 
            +
            * `header_text` (string): Text to display to the user in the header of the UI
         | 
| 482 490 | 
             
            * `language` (string): Preferred language
         | 
| 483 491 | 
             
            * `notification_daily_send_time` (int64): Hour of the day at which daily notifications should be sent. Can be in range 0 to 23
         | 
| 484 492 | 
             
            * `name` (string): User's full name
         | 
    
        data/files.com.gemspec
    CHANGED
    
    | @@ -10,11 +10,11 @@ Gem::Specification.new do |s| | |
| 10 10 | 
             
              s.summary     = "Files.com Ruby client."
         | 
| 11 11 | 
             
              s.description = "The Files.com Ruby client."
         | 
| 12 12 | 
             
              s.license     = "MIT"
         | 
| 13 | 
            -
              s.required_ruby_version = ">= 2. | 
| 14 | 
            -
              s.add_dependency 'faraday', ">= 1.0.1"
         | 
| 15 | 
            -
              s.add_dependency 'net-http-persistent'
         | 
| 13 | 
            +
              s.required_ruby_version = ">= 2.5"
         | 
| 16 14 | 
             
              s.add_dependency 'addressable', ">= 2.7.0"
         | 
| 17 15 | 
             
              s.add_dependency 'concurrent-ruby', ">= 1.1.3"
         | 
| 16 | 
            +
              s.add_dependency 'faraday', ">= 1.0.1"
         | 
| 17 | 
            +
              s.add_dependency 'net-http-persistent'
         | 
| 18 18 |  | 
| 19 19 | 
             
              s.files         = `find *`.split("\n").uniq.sort.reject(&:empty?)
         | 
| 20 20 | 
             
              s.executables   = [ "files", "files-console" ]
         | 
    
        data/lib/files.com.rb
    CHANGED
    
    | @@ -34,6 +34,7 @@ require "files.com/models/auto" | |
| 34 34 | 
             
            require "files.com/models/automation"
         | 
| 35 35 | 
             
            require "files.com/models/behavior"
         | 
| 36 36 | 
             
            require "files.com/models/bundle"
         | 
| 37 | 
            +
            require "files.com/models/clickwrap"
         | 
| 37 38 | 
             
            require "files.com/models/dns_record"
         | 
| 38 39 | 
             
            require "files.com/models/errors"
         | 
| 39 40 | 
             
            require "files.com/models/file"
         | 
| @@ -94,7 +95,7 @@ module Files | |
| 94 95 | 
             
              @read_timeout = 80
         | 
| 95 96 |  | 
| 96 97 | 
             
              class << self
         | 
| 97 | 
            -
                attr_accessor :api_key, :base_url, :initial_network_retry_delay, : | 
| 98 | 
            +
                attr_accessor :api_key, :base_url, :initial_network_retry_delay, :max_network_retry_delay, :open_timeout, :read_timeout, :proxy, :session_id
         | 
| 98 99 | 
             
              end
         | 
| 99 100 |  | 
| 100 101 | 
             
              # map to the same values as the standard library's logger
         | 
| @@ -201,9 +201,9 @@ module Files | |
| 201 201 | 
             
                def self.update(id, params = {}, options = {})
         | 
| 202 202 | 
             
                  params ||= {}
         | 
| 203 203 | 
             
                  params[:id] = id
         | 
| 204 | 
            -
                  raise InvalidParameterError.new("Bad parameter: id must be one of String, Integer, Hash") if params.dig(:id) and [String, Integer, Hash].none? { |klass| params.dig(:id).is_a?(klass) }
         | 
| 204 | 
            +
                  raise InvalidParameterError.new("Bad parameter: id must be one of String, Integer, Hash") if params.dig(:id) and [ String, Integer, Hash ].none? { |klass| params.dig(:id).is_a?(klass) }
         | 
| 205 205 | 
             
                  raise InvalidParameterError.new("Bad parameter: value must be an String") if params.dig(:value) and !params.dig(:value).is_a?(String)
         | 
| 206 | 
            -
                  raise InvalidParameterError.new("Bad parameter: attachment_file must be one of String, Integer, Hash") if params.dig(:attachment_file) and [String, Integer, Hash].none? { |klass| params.dig(:attachment_file).is_a?(klass) }
         | 
| 206 | 
            +
                  raise InvalidParameterError.new("Bad parameter: attachment_file must be one of String, Integer, Hash") if params.dig(:attachment_file) and [ String, Integer, Hash ].none? { |klass| params.dig(:attachment_file).is_a?(klass) }
         | 
| 207 207 | 
             
                  raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
         | 
| 208 208 |  | 
| 209 209 | 
             
                  response, options = Api.send_request("/behaviors/#{params[:id]}", :patch, params, options)
         | 
| @@ -54,6 +54,15 @@ module Files | |
| 54 54 | 
             
                  @attributes[:require_registration] = value
         | 
| 55 55 | 
             
                end
         | 
| 56 56 |  | 
| 57 | 
            +
                # string - Legal text that must be agreed to prior to accessing Bundle.
         | 
| 58 | 
            +
                def clickwrap_body
         | 
| 59 | 
            +
                  @attributes[:clickwrap_body]
         | 
| 60 | 
            +
                end
         | 
| 61 | 
            +
             | 
| 62 | 
            +
                def clickwrap_body=(value)
         | 
| 63 | 
            +
                  @attributes[:clickwrap_body] = value
         | 
| 64 | 
            +
                end
         | 
| 65 | 
            +
             | 
| 57 66 | 
             
                # int64 - Bundle ID
         | 
| 58 67 | 
             
                def id
         | 
| 59 68 | 
             
                  @attributes[:id]
         | 
| @@ -104,6 +113,15 @@ module Files | |
| 104 113 | 
             
                  @attributes[:username] = value
         | 
| 105 114 | 
             
                end
         | 
| 106 115 |  | 
| 116 | 
            +
                # int64 - ID of the clickwrap to use with this bundle.
         | 
| 117 | 
            +
                def clickwrap_id
         | 
| 118 | 
            +
                  @attributes[:clickwrap_id]
         | 
| 119 | 
            +
                end
         | 
| 120 | 
            +
             | 
| 121 | 
            +
                def clickwrap_id=(value)
         | 
| 122 | 
            +
                  @attributes[:clickwrap_id] = value
         | 
| 123 | 
            +
                end
         | 
| 124 | 
            +
             | 
| 107 125 | 
             
                # array - A list of paths in this bundle
         | 
| 108 126 | 
             
                def paths
         | 
| 109 127 | 
             
                  @attributes[:paths]
         | 
| @@ -147,6 +165,7 @@ module Files | |
| 147 165 | 
             
                #   note - string - Bundle internal note
         | 
| 148 166 | 
             
                #   code - string - Bundle code.  This code forms the end part of the Public URL.
         | 
| 149 167 | 
             
                #   require_registration - boolean - Show a registration page that captures the downloader's name and email address?
         | 
| 168 | 
            +
                #   clickwrap_id - int64 - ID of the clickwrap to use with this bundle.
         | 
| 150 169 | 
             
                def update(params = {})
         | 
| 151 170 | 
             
                  params ||= {}
         | 
| 152 171 | 
             
                  params[:id] = @attributes[:id]
         | 
| @@ -157,6 +176,7 @@ module Files | |
| 157 176 | 
             
                  raise InvalidParameterError.new("Bad parameter: description must be an String") if params.dig(:description) and !params.dig(:description).is_a?(String)
         | 
| 158 177 | 
             
                  raise InvalidParameterError.new("Bad parameter: note must be an String") if params.dig(:note) and !params.dig(:note).is_a?(String)
         | 
| 159 178 | 
             
                  raise InvalidParameterError.new("Bad parameter: code must be an String") if params.dig(:code) and !params.dig(:code).is_a?(String)
         | 
| 179 | 
            +
                  raise InvalidParameterError.new("Bad parameter: clickwrap_id must be an Integer") if params.dig(:clickwrap_id) and !params.dig(:clickwrap_id).is_a?(Integer)
         | 
| 160 180 | 
             
                  raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
         | 
| 161 181 |  | 
| 162 182 | 
             
                  Api.send_request("/bundles/#{@attributes[:id]}", :patch, params, @options)
         | 
| @@ -231,6 +251,7 @@ module Files | |
| 231 251 | 
             
                #   note - string - Bundle internal note
         | 
| 232 252 | 
             
                #   code - string - Bundle code.  This code forms the end part of the Public URL.
         | 
| 233 253 | 
             
                #   require_registration - boolean - Show a registration page that captures the downloader's name and email address?
         | 
| 254 | 
            +
                #   clickwrap_id - int64 - ID of the clickwrap to use with this bundle.
         | 
| 234 255 | 
             
                def self.create(params = {}, options = {})
         | 
| 235 256 | 
             
                  raise InvalidParameterError.new("Bad parameter: user_id must be an Integer") if params.dig(:user_id) and !params.dig(:user_id).is_a?(Integer)
         | 
| 236 257 | 
             
                  raise InvalidParameterError.new("Bad parameter: paths must be an Array") if params.dig(:paths) and !params.dig(:paths).is_a?(Array)
         | 
| @@ -239,6 +260,7 @@ module Files | |
| 239 260 | 
             
                  raise InvalidParameterError.new("Bad parameter: description must be an String") if params.dig(:description) and !params.dig(:description).is_a?(String)
         | 
| 240 261 | 
             
                  raise InvalidParameterError.new("Bad parameter: note must be an String") if params.dig(:note) and !params.dig(:note).is_a?(String)
         | 
| 241 262 | 
             
                  raise InvalidParameterError.new("Bad parameter: code must be an String") if params.dig(:code) and !params.dig(:code).is_a?(String)
         | 
| 263 | 
            +
                  raise InvalidParameterError.new("Bad parameter: clickwrap_id must be an Integer") if params.dig(:clickwrap_id) and !params.dig(:clickwrap_id).is_a?(Integer)
         | 
| 242 264 | 
             
                  raise MissingParameterError.new("Parameter missing: paths") unless params.dig(:paths)
         | 
| 243 265 |  | 
| 244 266 | 
             
                  response, options = Api.send_request("/bundles", :post, params, options)
         | 
| @@ -270,6 +292,7 @@ module Files | |
| 270 292 | 
             
                #   note - string - Bundle internal note
         | 
| 271 293 | 
             
                #   code - string - Bundle code.  This code forms the end part of the Public URL.
         | 
| 272 294 | 
             
                #   require_registration - boolean - Show a registration page that captures the downloader's name and email address?
         | 
| 295 | 
            +
                #   clickwrap_id - int64 - ID of the clickwrap to use with this bundle.
         | 
| 273 296 | 
             
                def self.update(id, params = {}, options = {})
         | 
| 274 297 | 
             
                  params ||= {}
         | 
| 275 298 | 
             
                  params[:id] = id
         | 
| @@ -279,6 +302,7 @@ module Files | |
| 279 302 | 
             
                  raise InvalidParameterError.new("Bad parameter: description must be an String") if params.dig(:description) and !params.dig(:description).is_a?(String)
         | 
| 280 303 | 
             
                  raise InvalidParameterError.new("Bad parameter: note must be an String") if params.dig(:note) and !params.dig(:note).is_a?(String)
         | 
| 281 304 | 
             
                  raise InvalidParameterError.new("Bad parameter: code must be an String") if params.dig(:code) and !params.dig(:code).is_a?(String)
         | 
| 305 | 
            +
                  raise InvalidParameterError.new("Bad parameter: clickwrap_id must be an Integer") if params.dig(:clickwrap_id) and !params.dig(:clickwrap_id).is_a?(Integer)
         | 
| 282 306 | 
             
                  raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
         | 
| 283 307 |  | 
| 284 308 | 
             
                  response, options = Api.send_request("/bundles/#{params[:id]}", :patch, params, options)
         | 
| @@ -0,0 +1,197 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module Files
         | 
| 4 | 
            +
              class Clickwrap
         | 
| 5 | 
            +
                attr_reader :options, :attributes
         | 
| 6 | 
            +
             | 
| 7 | 
            +
                def initialize(attributes = {}, options = {})
         | 
| 8 | 
            +
                  @attributes = attributes || {}
         | 
| 9 | 
            +
                  @options = options || {}
         | 
| 10 | 
            +
                end
         | 
| 11 | 
            +
             | 
| 12 | 
            +
                # string - Name of the Clickwrap agreement (used when selecting from multiple Clickwrap agreements.)
         | 
| 13 | 
            +
                def name
         | 
| 14 | 
            +
                  @attributes[:name]
         | 
| 15 | 
            +
                end
         | 
| 16 | 
            +
             | 
| 17 | 
            +
                def name=(value)
         | 
| 18 | 
            +
                  @attributes[:name] = value
         | 
| 19 | 
            +
                end
         | 
| 20 | 
            +
             | 
| 21 | 
            +
                # string - Body text of Clickwrap (supports Markdown formatting).
         | 
| 22 | 
            +
                def body
         | 
| 23 | 
            +
                  @attributes[:body]
         | 
| 24 | 
            +
                end
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                def body=(value)
         | 
| 27 | 
            +
                  @attributes[:body] = value
         | 
| 28 | 
            +
                end
         | 
| 29 | 
            +
             | 
| 30 | 
            +
                # string - Use this Clickwrap for User Registrations?  Note: This only applies to User Registrations where the User is invited to your Files.com site using an E-Mail invitation process where they then set their own password.
         | 
| 31 | 
            +
                def use_with_users
         | 
| 32 | 
            +
                  @attributes[:use_with_users]
         | 
| 33 | 
            +
                end
         | 
| 34 | 
            +
             | 
| 35 | 
            +
                def use_with_users=(value)
         | 
| 36 | 
            +
                  @attributes[:use_with_users] = value
         | 
| 37 | 
            +
                end
         | 
| 38 | 
            +
             | 
| 39 | 
            +
                # string - Use this Clickwrap for Bundles?
         | 
| 40 | 
            +
                def use_with_bundles
         | 
| 41 | 
            +
                  @attributes[:use_with_bundles]
         | 
| 42 | 
            +
                end
         | 
| 43 | 
            +
             | 
| 44 | 
            +
                def use_with_bundles=(value)
         | 
| 45 | 
            +
                  @attributes[:use_with_bundles] = value
         | 
| 46 | 
            +
                end
         | 
| 47 | 
            +
             | 
| 48 | 
            +
                # string - Use this Clickwrap for Inboxes?
         | 
| 49 | 
            +
                def use_with_inboxes
         | 
| 50 | 
            +
                  @attributes[:use_with_inboxes]
         | 
| 51 | 
            +
                end
         | 
| 52 | 
            +
             | 
| 53 | 
            +
                def use_with_inboxes=(value)
         | 
| 54 | 
            +
                  @attributes[:use_with_inboxes] = value
         | 
| 55 | 
            +
                end
         | 
| 56 | 
            +
             | 
| 57 | 
            +
                # int64 - Clickwrap ID.
         | 
| 58 | 
            +
                def id
         | 
| 59 | 
            +
                  @attributes[:id]
         | 
| 60 | 
            +
                end
         | 
| 61 | 
            +
             | 
| 62 | 
            +
                def id=(value)
         | 
| 63 | 
            +
                  @attributes[:id] = value
         | 
| 64 | 
            +
                end
         | 
| 65 | 
            +
             | 
| 66 | 
            +
                # Parameters:
         | 
| 67 | 
            +
                #   name - string - Name of the Clickwrap agreement (used when selecting from multiple Clickwrap agreements.)
         | 
| 68 | 
            +
                #   body - string - Body text of Clickwrap (supports Markdown formatting).
         | 
| 69 | 
            +
                #   use_with_bundles - string - Use this Clickwrap for Bundles?
         | 
| 70 | 
            +
                #   use_with_inboxes - string - Use this Clickwrap for Inboxes?
         | 
| 71 | 
            +
                #   use_with_users - string - Use this Clickwrap for User Registrations?  Note: This only applies to User Registrations where the User is invited to your Files.com site using an E-Mail invitation process where they then set their own password.
         | 
| 72 | 
            +
                def update(params = {})
         | 
| 73 | 
            +
                  params ||= {}
         | 
| 74 | 
            +
                  params[:id] = @attributes[:id]
         | 
| 75 | 
            +
                  raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
         | 
| 76 | 
            +
                  raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
         | 
| 77 | 
            +
                  raise InvalidParameterError.new("Bad parameter: name must be an String") if params.dig(:name) and !params.dig(:name).is_a?(String)
         | 
| 78 | 
            +
                  raise InvalidParameterError.new("Bad parameter: body must be an String") if params.dig(:body) and !params.dig(:body).is_a?(String)
         | 
| 79 | 
            +
                  raise InvalidParameterError.new("Bad parameter: use_with_bundles must be an String") if params.dig(:use_with_bundles) and !params.dig(:use_with_bundles).is_a?(String)
         | 
| 80 | 
            +
                  raise InvalidParameterError.new("Bad parameter: use_with_inboxes must be an String") if params.dig(:use_with_inboxes) and !params.dig(:use_with_inboxes).is_a?(String)
         | 
| 81 | 
            +
                  raise InvalidParameterError.new("Bad parameter: use_with_users must be an String") if params.dig(:use_with_users) and !params.dig(:use_with_users).is_a?(String)
         | 
| 82 | 
            +
                  raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
         | 
| 83 | 
            +
             | 
| 84 | 
            +
                  Api.send_request("/clickwraps/#{@attributes[:id]}", :patch, params, @options)
         | 
| 85 | 
            +
                end
         | 
| 86 | 
            +
             | 
| 87 | 
            +
                def delete(params = {})
         | 
| 88 | 
            +
                  params ||= {}
         | 
| 89 | 
            +
                  params[:id] = @attributes[:id]
         | 
| 90 | 
            +
                  raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
         | 
| 91 | 
            +
                  raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
         | 
| 92 | 
            +
                  raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
         | 
| 93 | 
            +
             | 
| 94 | 
            +
                  Api.send_request("/clickwraps/#{@attributes[:id]}", :delete, params, @options)
         | 
| 95 | 
            +
                end
         | 
| 96 | 
            +
             | 
| 97 | 
            +
                def destroy(params = {})
         | 
| 98 | 
            +
                  delete(params)
         | 
| 99 | 
            +
                end
         | 
| 100 | 
            +
             | 
| 101 | 
            +
                def save
         | 
| 102 | 
            +
                  if @attributes[:id]
         | 
| 103 | 
            +
                    update(@attributes)
         | 
| 104 | 
            +
                  else
         | 
| 105 | 
            +
                    new_obj = Clickwrap.create(@attributes, @options)
         | 
| 106 | 
            +
                    @attributes = new_obj.attributes
         | 
| 107 | 
            +
                  end
         | 
| 108 | 
            +
                end
         | 
| 109 | 
            +
             | 
| 110 | 
            +
                # Parameters:
         | 
| 111 | 
            +
                #   page - int64 - Current page number.
         | 
| 112 | 
            +
                #   per_page - int64 - Number of records to show per page.  (Max: 10,000, 1,000 or less is recommended).
         | 
| 113 | 
            +
                #   action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
         | 
| 114 | 
            +
                def self.list(params = {}, options = {})
         | 
| 115 | 
            +
                  raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
         | 
| 116 | 
            +
                  raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
         | 
| 117 | 
            +
                  raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
         | 
| 118 | 
            +
             | 
| 119 | 
            +
                  response, options = Api.send_request("/clickwraps", :get, params, options)
         | 
| 120 | 
            +
                  response.data.map do |entity_data|
         | 
| 121 | 
            +
                    Clickwrap.new(entity_data, options)
         | 
| 122 | 
            +
                  end
         | 
| 123 | 
            +
                end
         | 
| 124 | 
            +
             | 
| 125 | 
            +
                def self.all(params = {}, options = {})
         | 
| 126 | 
            +
                  list(params, options)
         | 
| 127 | 
            +
                end
         | 
| 128 | 
            +
             | 
| 129 | 
            +
                # Parameters:
         | 
| 130 | 
            +
                #   id (required) - int64 - Clickwrap ID.
         | 
| 131 | 
            +
                def self.find(id, params = {}, options = {})
         | 
| 132 | 
            +
                  params ||= {}
         | 
| 133 | 
            +
                  params[:id] = id
         | 
| 134 | 
            +
                  raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
         | 
| 135 | 
            +
                  raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
         | 
| 136 | 
            +
             | 
| 137 | 
            +
                  response, options = Api.send_request("/clickwraps/#{params[:id]}", :get, params, options)
         | 
| 138 | 
            +
                  Clickwrap.new(response.data, options)
         | 
| 139 | 
            +
                end
         | 
| 140 | 
            +
             | 
| 141 | 
            +
                def self.get(id, params = {}, options = {})
         | 
| 142 | 
            +
                  find(id, params, options)
         | 
| 143 | 
            +
                end
         | 
| 144 | 
            +
             | 
| 145 | 
            +
                # Parameters:
         | 
| 146 | 
            +
                #   name - string - Name of the Clickwrap agreement (used when selecting from multiple Clickwrap agreements.)
         | 
| 147 | 
            +
                #   body - string - Body text of Clickwrap (supports Markdown formatting).
         | 
| 148 | 
            +
                #   use_with_bundles - string - Use this Clickwrap for Bundles?
         | 
| 149 | 
            +
                #   use_with_inboxes - string - Use this Clickwrap for Inboxes?
         | 
| 150 | 
            +
                #   use_with_users - string - Use this Clickwrap for User Registrations?  Note: This only applies to User Registrations where the User is invited to your Files.com site using an E-Mail invitation process where they then set their own password.
         | 
| 151 | 
            +
                def self.create(params = {}, options = {})
         | 
| 152 | 
            +
                  raise InvalidParameterError.new("Bad parameter: name must be an String") if params.dig(:name) and !params.dig(:name).is_a?(String)
         | 
| 153 | 
            +
                  raise InvalidParameterError.new("Bad parameter: body must be an String") if params.dig(:body) and !params.dig(:body).is_a?(String)
         | 
| 154 | 
            +
                  raise InvalidParameterError.new("Bad parameter: use_with_bundles must be an String") if params.dig(:use_with_bundles) and !params.dig(:use_with_bundles).is_a?(String)
         | 
| 155 | 
            +
                  raise InvalidParameterError.new("Bad parameter: use_with_inboxes must be an String") if params.dig(:use_with_inboxes) and !params.dig(:use_with_inboxes).is_a?(String)
         | 
| 156 | 
            +
                  raise InvalidParameterError.new("Bad parameter: use_with_users must be an String") if params.dig(:use_with_users) and !params.dig(:use_with_users).is_a?(String)
         | 
| 157 | 
            +
             | 
| 158 | 
            +
                  response, options = Api.send_request("/clickwraps", :post, params, options)
         | 
| 159 | 
            +
                  Clickwrap.new(response.data, options)
         | 
| 160 | 
            +
                end
         | 
| 161 | 
            +
             | 
| 162 | 
            +
                # Parameters:
         | 
| 163 | 
            +
                #   name - string - Name of the Clickwrap agreement (used when selecting from multiple Clickwrap agreements.)
         | 
| 164 | 
            +
                #   body - string - Body text of Clickwrap (supports Markdown formatting).
         | 
| 165 | 
            +
                #   use_with_bundles - string - Use this Clickwrap for Bundles?
         | 
| 166 | 
            +
                #   use_with_inboxes - string - Use this Clickwrap for Inboxes?
         | 
| 167 | 
            +
                #   use_with_users - string - Use this Clickwrap for User Registrations?  Note: This only applies to User Registrations where the User is invited to your Files.com site using an E-Mail invitation process where they then set their own password.
         | 
| 168 | 
            +
                def self.update(id, params = {}, options = {})
         | 
| 169 | 
            +
                  params ||= {}
         | 
| 170 | 
            +
                  params[:id] = id
         | 
| 171 | 
            +
                  raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
         | 
| 172 | 
            +
                  raise InvalidParameterError.new("Bad parameter: name must be an String") if params.dig(:name) and !params.dig(:name).is_a?(String)
         | 
| 173 | 
            +
                  raise InvalidParameterError.new("Bad parameter: body must be an String") if params.dig(:body) and !params.dig(:body).is_a?(String)
         | 
| 174 | 
            +
                  raise InvalidParameterError.new("Bad parameter: use_with_bundles must be an String") if params.dig(:use_with_bundles) and !params.dig(:use_with_bundles).is_a?(String)
         | 
| 175 | 
            +
                  raise InvalidParameterError.new("Bad parameter: use_with_inboxes must be an String") if params.dig(:use_with_inboxes) and !params.dig(:use_with_inboxes).is_a?(String)
         | 
| 176 | 
            +
                  raise InvalidParameterError.new("Bad parameter: use_with_users must be an String") if params.dig(:use_with_users) and !params.dig(:use_with_users).is_a?(String)
         | 
| 177 | 
            +
                  raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
         | 
| 178 | 
            +
             | 
| 179 | 
            +
                  response, options = Api.send_request("/clickwraps/#{params[:id]}", :patch, params, options)
         | 
| 180 | 
            +
                  Clickwrap.new(response.data, options)
         | 
| 181 | 
            +
                end
         | 
| 182 | 
            +
             | 
| 183 | 
            +
                def self.delete(id, params = {}, options = {})
         | 
| 184 | 
            +
                  params ||= {}
         | 
| 185 | 
            +
                  params[:id] = id
         | 
| 186 | 
            +
                  raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
         | 
| 187 | 
            +
                  raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
         | 
| 188 | 
            +
             | 
| 189 | 
            +
                  response, _options = Api.send_request("/clickwraps/#{params[:id]}", :delete, params, options)
         | 
| 190 | 
            +
                  response.data
         | 
| 191 | 
            +
                end
         | 
| 192 | 
            +
             | 
| 193 | 
            +
                def self.destroy(id, params = {}, options = {})
         | 
| 194 | 
            +
                  delete(id, params, options)
         | 
| 195 | 
            +
                end
         | 
| 196 | 
            +
              end
         | 
| 197 | 
            +
            end
         | 
| @@ -90,7 +90,7 @@ module Files | |
| 90 90 | 
             
                  new(path).mtime
         | 
| 91 91 | 
             
                end
         | 
| 92 92 |  | 
| 93 | 
            -
                def self.open(path, mode = "r", options={}, &block)
         | 
| 93 | 
            +
                def self.open(path, mode = "r", options = {}, &block)
         | 
| 94 94 | 
             
                  file = new(path, mode, options)
         | 
| 95 95 | 
             
                  if block
         | 
| 96 96 | 
             
                    yield file
         | 
| @@ -306,7 +306,7 @@ module Files | |
| 306 306 | 
             
                end
         | 
| 307 307 |  | 
| 308 308 | 
             
                def download_content(io)
         | 
| 309 | 
            -
                  Files::ApiClient | 
| 309 | 
            +
                  Files::ApiClient.download_client.stream_download(download_uri_with_load, io)
         | 
| 310 310 | 
             
                end
         | 
| 311 311 |  | 
| 312 312 | 
             
                def each(*args, &block)
         | 
| @@ -571,13 +571,13 @@ module Files | |
| 571 571 | 
             
                end
         | 
| 572 572 |  | 
| 573 573 | 
             
                def upload_file(local_file)
         | 
| 574 | 
            -
                  File.upload_file(local_file. | 
| 574 | 
            +
                  File.upload_file(local_file.path)
         | 
| 575 575 | 
             
                end
         | 
| 576 576 |  | 
| 577 577 | 
             
                def write(*args)
         | 
| 578 578 | 
             
                  @mode ||= 'w'
         | 
| 579 579 | 
             
                  if args[0].respond_to?(:read)
         | 
| 580 | 
            -
                    flush if @write_io.size > 0
         | 
| 580 | 
            +
                    flush if @write_io.size > 0 # rubocop:disable Style/ZeroLengthPredicate
         | 
| 581 581 | 
             
                    @write_io = args[0]
         | 
| 582 582 | 
             
                  else
         | 
| 583 583 | 
             
                    @write_io.write *args
         | 
| @@ -116,7 +116,9 @@ module Files | |
| 116 116 | 
             
                  raise MissingParameterError.new("Parameter missing: path") unless params.dig(:path)
         | 
| 117 117 |  | 
| 118 118 | 
             
                  response, options = Api.send_request("/file_actions/begin_upload/#{Addressable::URI.encode_component(params[:path])}", :post, params, options)
         | 
| 119 | 
            -
                   | 
| 119 | 
            +
                  response.data.map do |entity_data|
         | 
| 120 | 
            +
                    FilePartUpload.new(entity_data, options)
         | 
| 121 | 
            +
                  end
         | 
| 120 122 | 
             
                end
         | 
| 121 123 | 
             
              end
         | 
| 122 124 | 
             
            end
         |