Class: CoopCli::Coop

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/coop_cli.rb

Instance Method Summary collapse

Constructor Details

#initialize(base_uri) ⇒ Coop

Returns a new instance of Coop.



10
11
12
# File 'lib/coop_cli.rb', line 10

def initialize(base_uri)
  self.class.base_uri base_uri
end

Instance Method Details

#basic_auth(user, pass) ⇒ Object



14
15
16
# File 'lib/coop_cli.rb', line 14

def basic_auth(user,pass)
  self.class.basic_auth user, pass
end

#post_as_cobot(path, message, cobotkey) ⇒ Object



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

def post_as_cobot(path,message,cobotkey)
  self.class.post(path, :query => { :status => message, :key => cobotkey }, :headers => { "User-Agent" => self.user_agent, "Accept"        => "application/json",
    "Content-Type"  => "application/json; charset=utf-8" })
end

#post_as_user(path, message) ⇒ Object



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

def post_as_user(path,message)
  self.class.post(path, :query => { :status => message }, :headers => { "User-Agent" => self.user_agent })
end

#user_agentObject



18
19
20
# File 'lib/coop_cli.rb', line 18

def user_agent
  "coop_cli (v: #{CoopCli::VERSION})"
end