Class: Nylas::Account

Inherits:
RestfulModel show all
Defined in:
lib/account.rb

Instance Attribute Summary

Attributes inherited from RestfulModel

#raw_json

Instance Method Summary collapse

Methods inherited from RestfulModel

#==, #as_json, collection_name, #destroy, #inflate, #initialize, #save!, #update, #url

Methods included from TimeAttrAccessor

#time_attr_accessor

Methods included from Parameters

included, #parameters

Constructor Details

This class inherits a constructor from Nylas::RestfulModel

Instance Method Details

#_perform_account_action!(action) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/account.rb', line 12

def (action)
  raise UnexpectedAccountAction.new unless action == "upgrade" || action == "downgrade"

  collection = ManagementModelCollection.new(Account, @_api, {:account_id=>@account_id})
  ::RestClient.post("#{collection.url}/#{@account_id}/#{action}",{}) do |response, request, result|
      # Throw any exceptions
    json = Nylas.interpret_response(result, response, :expected_class => Object)
  end
end

#downgrade!Object



26
27
28
# File 'lib/account.rb', line 26

def downgrade!
  ('downgrade')
end

#upgrade!Object



22
23
24
# File 'lib/account.rb', line 22

def upgrade!
  ('upgrade')
end