Class: FetchAppAPI::Account

Inherits:
Base
  • Object
show all
Defined in:
lib/fetchapp-api-ruby/account.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Methods inherited from Base

basic_auth, can_connect?, find, #initialize, key, time

Constructor Details

This class inherits a constructor from FetchAppAPI::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class FetchAppAPI::Base

Instance Attribute Details

#attributesObject

Returns the value of attribute attributes.



3
4
5
# File 'lib/fetchapp-api-ruby/account.rb', line 3

def attributes
  @attributes
end

Class Method Details

.detailsObject

Retrieves information about the Account



9
10
11
12
13
# File 'lib/fetchapp-api-ruby/account.rb', line 9

def self.details
   = Account.new({})
  .attributes = execute(:get, "/account")["account"]
  
end

.new_tokenObject

Generates a new API token. Subsequent API calls using the existing token will be refused.



17
18
19
20
21
22
23
24
# File 'lib/fetchapp-api-ruby/account.rb', line 17

def self.new_token
  token = execute(:get, "/new_token")
  unless token["message"].nil? || token["message"].empty?
    # Reauthorize
    Connector.basic_auth(FetchAppAPI::Base.key, token["message"])
    token
  end
end