Sha256: 3c766f9ecbc3dccab95573feddb7a1103139fd1b3c786cb72e3aed62cef137db

Contents?: true

Size: 1.05 KB

Versions: 4

Compression:

Stored size: 1.05 KB

Contents

module Fog
  module SharedFileSystem
    class HuaweiCloud
      class Real
        def update_share(id, options = {})
          request(
            :body    => Fog::JSON.encode('share' => options),
            :expects => 200,
            :method  => 'PUT',
            :path    => "shares/#{id}"
          )
        end
      end

      class Mock
        def update_share(id, options = {})
          # stringify keys
          options = Hash[options.map { |k, v| [k.to_s, v] }]

          update_data(id, options)

          response = Excon::Response.new
          response.status = 200
          response.body = {'share' => data[:share_updated]}
          response
        end

        private

        def update_data(id, options)
          data[:share_updated]                  = data[:shares_detailed].first.merge(options)
          data[:share_updated]['id']            = id
          data[:share_updated]['status']        = "PENDING"
          data[:share_updated]['links']['self'] = "https://127.0.0.1:8786/v2/shares/#{id}"
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fog-huaweicloud-0.0.3 lib/fog/shared_file_system/huaweicloud/requests/update_share.rb
fog-huaweicloud-0.0.2 lib/fog/shared_file_system/huaweicloud/requests/update_share.rb
fog-huaweicloud-0.1.3 lib/fog/shared_file_system/huaweicloud/requests/update_share.rb
fog-huaweicloud-0.1.2 lib/fog/shared_file_system/huaweicloud/requests/update_share.rb