class DropboxApi::Metadata::CommitInfo

Public Class Methods

build_from_options(options) click to toggle source
# File lib/dropbox_api/metadata/commit_info.rb, line 11
def build_from_options(options)
  options = Hash[options.map do |key, value|
    case key
    when :mode
      [key.to_s, build_write_mode(value)]
    when :client_modified
      [key.to_s, build_client_modified(value)]
    when :path, :autorename, :mute
      [key.to_s, value]
    end
  end.compact]

  new(options)
end

Private Class Methods

build_client_modified(client_modified) click to toggle source
# File lib/dropbox_api/metadata/commit_info.rb, line 39
def build_client_modified(client_modified)
  client_modified.utc.strftime('%FT%TZ')
end
build_write_mode(write_mode) click to toggle source
# File lib/dropbox_api/metadata/commit_info.rb, line 28
def build_write_mode(write_mode)
  case write_mode
  when String, Symbol
    DropboxApi::Metadata::WriteMode.new write_mode
  when DropboxApi::Metadata::WriteMode
    write_mode
  else
    raise ArgumentError, "Invalid write mode: #{write_mode.inspect}"
  end.to_hash
end