Ping.fm Ruby Library¶ ↑
Library Usage¶ ↑
# Require the library and initialize it. require 'pingfm' pingfm = Pingfm::Client.new('user_app_key') # Ensure proper API and User App keys. pingfm.validate['status'] # => {'status' => 'OK'} # if success, otherwise 'FAIL' # Grab latest 5 posts. pingfm.latest(5) # => {'messages' => [...]} # Posting to all services. pingfm.post('The Dark Knight was amazing.') # => {'status' => 'OK'} # if success, otherwise 'FAIL' # Post using custom user trigger; must be defined on the Ping.fm site. pingfm.tpost('The message here.', '#something_custom', 'Optional Title') # => {'status' => 'OK'} # if success, otherwise 'FAIL'
You can also manage the configuration file through Pingfm::Config
.
# Load from an existing config file (defaults to $HOME/.pingfm.yml). begin app_key = Pingfm::Config['app_key'] rescue Pingfm::ConfigNotFound # This is raised if the config file can't be found. # Helper method to get user app key from STDIN: app_key = Pingfm::Config.ask_for_app_key! # Or just assign a value to 'app_key' (this will automatically save the config file): Pingfm::Config['app_key'] = 'YOUR_USER_APP_KEY' end
Check the documentation for more details.
Shell Usage¶ ↑
$ pingfm This message will post to my default services.
Everything after the ‘pingfm
’ command is what will be posted to the service. You may also include the message within quotes (ex. using the client within a shell script). Run with ‘--help
’ to list all command-line options.
If your key has not been stored, it will ask for it. This key will be saved in a YAML file in your home directory and you won’t be asked for it again.
You can obtain your key here: ping.fm/key/
Authors¶ ↑
Code¶ ↑
Description¶ ↑
Ping.fm is a simple service that makes updating your social networks a snap; and this it’s Ruby library.
Additional Features¶ ↑
-
Installing the gem also installs a ‘
pingfm
’ binary to post from the command-line. -
User API key is stored in a YAML file in your home directory (
$HOME/.pingfm.yml
).
Requirements¶ ↑
Ruby!
Install¶ ↑
$ [sudo] gem install pingfm
License¶ ↑
(The MIT License)
Copyright © 2010 Dale Campbell, Kevin Williams, Krunoslav Husak
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.