Class: DropboxApi::Metadata::Member

Inherits:
Base
  • Object
show all
Defined in:
lib/dropbox_api/metadata/member.rb

Overview

Examples of serialized AddMember objects:

[
  {
    ".tag": "email",
    "email": "[email protected]"
  },  {
    ".tag": "dropbox_id",
    "dropbox_id": "dbid:AAEufNrMPSPe0dMQijRP0N_aZtBJRm26W4Q"
  }
]

Instance Method Summary collapse

Methods inherited from Base

field, #serialized_field

Constructor Details

#initialize(member) ⇒ Member

Returns a new instance of Member.


16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/dropbox_api/metadata/member.rb', line 16

def initialize(member)
  @member_hash = case member
    when Hash
      member
    when String
      hash_from_email_or_dropbox_id member
    when DropboxApi::Metadata::Member
      member.to_hash
    else
      raise ArgumentError, "Invalid object for Member: #{member.inspect}"
    end
end

Instance Method Details

#to_hashObject


29
30
31
# File 'lib/dropbox_api/metadata/member.rb', line 29

def to_hash
  @member_hash
end