Class: Echo::User

Inherits:
API show all
Includes:
HTTParty
Defined in:
lib/echor/user.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ User

Returns a new instance of User.



6
7
8
9
10
# File 'lib/echor/user.rb', line 6

def initialize(options={})            
  self.class.debug_output $stdout if Echo.debug
  self.class.base_uri "https://api.echoenabled.com/v1/users/"
  self.class.basic_auth Echo.user, Echo.password
end

Instance Method Details

#get(options = {}) ⇒ Object

Raises:

  • (ArgumentError)


19
20
21
22
23
24
25
# File 'lib/echor/user.rb', line 19

def get(options={})
  options[:appkey] = Echo.user
  raise ArgumentError, "You need to provide a sessionID" unless options[:sessionID]      
  raise ArgumentError, "You need to provide a indetifyURL" unless options[:identityURL]
  raise ArgumentError, "You need to setup Echo.user" unless Echo.user
  self.class.get("/get?#{options.to_query}")      
end

#update(content, options = {}) ⇒ Object



27
28
29
# File 'lib/echor/user.rb', line 27

def update(content, options={})
  self.class.post( "https://api.echoenabled.com/v1/users/update", :query => content)
end

#who_am_i(options = {}) ⇒ Object

Raises:

  • (ArgumentError)


12
13
14
15
16
17
# File 'lib/echor/user.rb', line 12

def who_am_i(options={})
  options[:appkey] = Echo.user
  raise ArgumentError, "You need to provide a sessionID" unless options[:sessionID]      
  raise ArgumentError, "You need to setup Echo.user" unless Echo.user
  self.class.get("/whoami?#{options.to_query}")
end