Module: Socialcast
- Defined in:
- lib/socialcast/cli.rb,
lib/socialcast.rb,
lib/socialcast/message.rb,
lib/socialcast/version.rb
Overview
uncomment to debug HTTP traffic class ActiveResource::Connection
def configure_http(http)
http = (http)
# Net::HTTP timeouts default to 60 seconds.
if @timeout
http.open_timeout = @timeout
http.read_timeout = @timeout
end
http.set_debug_output STDOUT
http
end
end
Defined Under Namespace
Constant Summary collapse
- VERSION =
"1.2.3"
Class Method Summary collapse
- .basic_auth_options ⇒ Object
- .config_dir ⇒ Object
- .credentials ⇒ Object
- .credentials=(options) ⇒ Object
- .credentials_file ⇒ Object
- .default_options ⇒ Object
-
.resource_for_path(path, options = {}, debug = true) ⇒ Object
configure restclient for api call.
Class Method Details
.basic_auth_options ⇒ Object
26 27 28 |
# File 'lib/socialcast.rb', line 26 def {:user => credentials[:user], :password => credentials[:password]} end |
.config_dir ⇒ Object
8 9 10 11 12 |
# File 'lib/socialcast.rb', line 8 def config_dir config_dir = File. '~/.socialcast' FileUtils.mkdir config_dir, :mode => 0700 unless File.exist?(config_dir) config_dir end |
.credentials ⇒ Object
16 17 18 19 |
# File 'lib/socialcast.rb', line 16 def credentials fail 'Unknown Socialcast credentials. Run `socialcast authenticate` to initialize' unless File.exist?(credentials_file) @@credentials ||= YAML.load_file(credentials_file) end |
.credentials=(options) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/socialcast.rb', line 20 def credentials=() File.open(credentials_file, "w") do |f| f.write(.to_yaml) end File.chmod 0600, credentials_file end |
.credentials_file ⇒ Object
13 14 15 |
# File 'lib/socialcast.rb', line 13 def credentials_file File.join config_dir, 'credentials.yml' end |
.default_options ⇒ Object
29 30 31 |
# File 'lib/socialcast.rb', line 29 def end |
.resource_for_path(path, options = {}, debug = true) ⇒ Object
configure restclient for api call
33 34 35 36 37 38 |
# File 'lib/socialcast.rb', line 33 def resource_for_path(path, = {}, debug = true) RestClient.log = Logger.new(STDOUT) if debug RestClient.proxy = credentials[:proxy] if credentials[:proxy] url = ['https://', credentials[:domain], path].join RestClient::Resource.new url, .merge() end |