Class: Files::InboxRecipientRegistration

Inherits:
Object
  • Object
show all
Defined in:
lib/files.com/models/inbox_recipient_registration.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}, options = {}) ⇒ InboxRecipientRegistration

Returns a new instance of InboxRecipientRegistration.



7
8
9
10
# File 'lib/files.com/models/inbox_recipient_registration.rb', line 7

def initialize(attributes = {}, options = {})
  @attributes = attributes || {}
  @options = options || {}
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



5
6
7
# File 'lib/files.com/models/inbox_recipient_registration.rb', line 5

def attributes
  @attributes
end

#optionsObject (readonly)

Returns the value of attribute options.



5
6
7
# File 'lib/files.com/models/inbox_recipient_registration.rb', line 5

def options
  @options
end

Class Method Details

.create(params = {}, options = {}) ⇒ Object

Parameters:

inbox_recipient_code (required) - string - Inbox recipient code


79
80
81
82
83
84
85
# File 'lib/files.com/models/inbox_recipient_registration.rb', line 79

def self.create(params = {}, options = {})
  raise InvalidParameterError.new("Bad parameter: inbox_recipient_code must be an String") if params[:inbox_recipient_code] and !params[:inbox_recipient_code].is_a?(String)
  raise MissingParameterError.new("Parameter missing: inbox_recipient_code") unless params[:inbox_recipient_code]

  response, options = Api.send_request("/inbox_recipient_registrations", :post, params, options)
  InboxRecipientRegistration.new(response.data, options)
end

Instance Method Details

#codeObject

string - The inbox recipient registration code. Use this to register for the inbox.



13
14
15
# File 'lib/files.com/models/inbox_recipient_registration.rb', line 13

def code
  @attributes[:code]
end

#code=(value) ⇒ Object



17
18
19
# File 'lib/files.com/models/inbox_recipient_registration.rb', line 17

def code=(value)
  @attributes[:code] = value
end

#companyObject

string - The recipient's company.



49
50
51
# File 'lib/files.com/models/inbox_recipient_registration.rb', line 49

def company
  @attributes[:company]
end

#company=(value) ⇒ Object



53
54
55
# File 'lib/files.com/models/inbox_recipient_registration.rb', line 53

def company=(value)
  @attributes[:company] = value
end

#inbox_recipient_codeObject

string - Inbox recipient code



58
59
60
# File 'lib/files.com/models/inbox_recipient_registration.rb', line 58

def inbox_recipient_code
  @attributes[:inbox_recipient_code]
end

#inbox_recipient_code=(value) ⇒ Object



62
63
64
# File 'lib/files.com/models/inbox_recipient_registration.rb', line 62

def inbox_recipient_code=(value)
  @attributes[:inbox_recipient_code] = value
end

#inbox_registration_codeObject

string - If the recipient has already registered for this inbox, this is their registration code to get the inbox contents.



22
23
24
# File 'lib/files.com/models/inbox_recipient_registration.rb', line 22

def inbox_registration_code
  @attributes[:inbox_registration_code]
end

#inbox_registration_code=(value) ⇒ Object



26
27
28
# File 'lib/files.com/models/inbox_recipient_registration.rb', line 26

def inbox_registration_code=(value)
  @attributes[:inbox_registration_code] = value
end

#nameObject

string - The recipient's name.



40
41
42
# File 'lib/files.com/models/inbox_recipient_registration.rb', line 40

def name
  @attributes[:name]
end

#name=(value) ⇒ Object



44
45
46
# File 'lib/files.com/models/inbox_recipient_registration.rb', line 44

def name=(value)
  @attributes[:name] = value
end

#recipientObject

string - The recipient's email address.



31
32
33
# File 'lib/files.com/models/inbox_recipient_registration.rb', line 31

def recipient
  @attributes[:recipient]
end

#recipient=(value) ⇒ Object



35
36
37
# File 'lib/files.com/models/inbox_recipient_registration.rb', line 35

def recipient=(value)
  @attributes[:recipient] = value
end

#saveObject



66
67
68
69
70
71
72
73
74
75
# File 'lib/files.com/models/inbox_recipient_registration.rb', line 66

def save
  if @attributes[:id]
    raise NotImplementedError.new("The InboxRecipientRegistration object doesn't support updates.")
  else
    new_obj = InboxRecipientRegistration.create(@attributes, @options)
  end

  @attributes = new_obj.attributes
  true
end