Class: Shortly::Clients::Snim
- Inherits:
-
Shortly::Client
- Object
- Shortly::Client
- Shortly::Clients::Snim
- Defined in:
- lib/shortly/clients/snim.rb
Class Attribute Summary (collapse)
-
+ (Object) apiKey
login = "" apiKey = "".
-
+ (Object) login
login = "" apiKey = "".
Class Method Summary (collapse)
-
+ (Object) analytics(short_id, options = {})
gets analytics.
-
+ (Object) expand(short_url, options = {})
expands provided url by making call to bitly api with given options.
-
+ (Object) shorten(url, options = {})
shorts provided url by making call to bitly api with given options.
Methods inherited from Shortly::Client
Class Attribute Details
+ (Object) apiKey
login = "<your login>" apiKey = "<your apiKey>"
33 34 35 |
# File 'lib/shortly/clients/snim.rb', line 33 def apiKey @apiKey end |
+ (Object) login
login = "<your login>" apiKey = "<your apiKey>"
33 34 35 |
# File 'lib/shortly/clients/snim.rb', line 33 def login @login end |
Class Method Details
+ (Object) analytics(short_id, options = {})
gets analytics
53 54 55 56 57 58 |
# File 'lib/shortly/clients/snim.rb', line 53 def self.analytics(short_id, = {}) = {:snipapi => self.apiKey,:snipuser => self.login, :snipid => short_id}.merge() validate!() response = post("/getsnipdetails", post_params()) OpenStruct.new(unescape_url(response)["snip"]) end |
+ (Object) expand(short_url, options = {})
expands provided url by making call to bitly api with given options.
48 49 50 |
# File 'lib/shortly/clients/snim.rb', line 48 def self.(short_url, = {}) analytics(short_url.gsub('http://sn.im/', ''), ) end |
+ (Object) shorten(url, options = {})
shorts provided url by making call to bitly api with given options.
39 40 41 42 43 44 45 |
# File 'lib/shortly/clients/snim.rb', line 39 def self.shorten(url, = {}) validate_uri!(url) = {:snipapi => self.apiKey,:snipuser => self.login, :sniplink => url}.merge() validate!() response = post("/getsnip", post_params()) OpenStruct.new(response["snip"].merge(:shortUrl => response["snip"]["id"])) end |