Class: Echo::Client

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

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Client

calls to echo

Parameters:

  • with (Hash)

    options

    • debug. Print the raw request and response of the network



9
10
11
12
13
# File 'lib/echor/client.rb', line 9

def initialize(options={})            
  self.class.debug_output $stdout if Echo.debug
  self.class.base_uri "#{Echo.endpoint}/submit"
  self.class.basic_auth Echo.user, Echo.password
end

Instance Method Details

#submit(content) ⇒ Object



15
16
17
# File 'lib/echor/client.rb', line 15

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

#tweet_to_xml(status) ⇒ Object



19
20
21
22
# File 'lib/echor/client.rb', line 19

def tweet_to_xml(status)
  template = ERB.new(Echo.Templates.TWITTER_XML_TEMPLATE)
  template.result(binding) 
end