]> gitweb.factorcode.org Git - factor.git/commitdiff
bitly: move from bit.ly to bitly.
authorDoug Coleman <doug.coleman@gmail.com>
Tue, 15 Mar 2016 07:22:01 +0000 (00:22 -0700)
committerDoug Coleman <doug.coleman@gmail.com>
Wed, 16 Mar 2016 00:19:20 +0000 (17:19 -0700)
extra/bit/ly/authors.txt [deleted file]
extra/bit/ly/ly.factor [deleted file]
extra/bit/ly/summary.txt [deleted file]
extra/bit/ly/tags.txt [deleted file]
extra/bitly/authors.txt [new file with mode: 0644]
extra/bitly/bitly.factor [new file with mode: 0644]
extra/bitly/summary.txt [new file with mode: 0644]
extra/bitly/tags.txt [new file with mode: 0644]
extra/webapps/mason/version/version.factor

diff --git a/extra/bit/ly/authors.txt b/extra/bit/ly/authors.txt
deleted file mode 100644 (file)
index 8a4581b..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-Slava Pestov
-John Benediktsson
diff --git a/extra/bit/ly/ly.factor b/extra/bit/ly/ly.factor
deleted file mode 100644 (file)
index f69eff3..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-! Copyright (C) 2010-2012 Slava Pestov, John Benediktsson.
-! See http://factorcode.org/license.txt for BSD license.
-USING: assocs http.client json.reader kernel namespaces
-sequences urls ;
-IN: bit.ly
-
-SYMBOLS: bitly-api-user bitly-api-key ;
-
-<PRIVATE
-
-: <bitly-url> ( path -- url )
-    "http://api.bitly.com/v3/" prepend >url
-        bitly-api-user get "login" set-query-param
-        bitly-api-key get "apiKey" set-query-param
-        "json" "format" set-query-param ;
-
-ERROR: bad-response json status ;
-
-: check-status ( json -- json )
-    dup "status_code" of 200 = [
-        dup "status_txt" of
-        bad-response
-    ] unless ;
-
-: json-data ( url -- json )
-    http-get nip json> check-status "data" of ;
-
-: get-short-url ( short-url path -- data )
-    <bitly-url> swap "shortUrl" set-query-param json-data ;
-
-: get-long-url ( long-url path -- data )
-    <bitly-url> swap "longUrl" set-query-param json-data ;
-
-PRIVATE>
-
-: shorten-url ( long-url -- short-url )
-    "shorten" get-long-url "url" of ;
-
-: expand-url ( short-url -- url )
-    "expand" get-short-url "expand" of first "long_url" of ;
-
-: valid-user? ( user api-key -- ? )
-    "validate" <bitly-url>
-        swap "x_apiKey" set-query-param
-        swap "x_login" set-query-param
-    json-data "valid" of 1 = ;
-
-: clicks ( short-url -- clicks )
-    "clicks" get-short-url "clicks" of first "global_clicks" of ;
-
-: referrers ( short-url -- referrers )
-    "referrers" get-short-url "referrers" of ;
-
-: countries ( short-url -- countries )
-    "countries" get-short-url "countries" of ;
-
-: clicks-by-minute ( short-url -- clicks )
-    "clicks_by_minute" get-short-url "clicks_by_minute" of ;
-
-: clicks-by-day ( short-url -- clicks )
-    "clicks_by_day" get-short-url "clicks_by_day" of ;
-
-: lookup ( long-urls -- short-urls )
-    "lookup" <bitly-url>
-        swap "url" set-query-param
-    json-data "lookup" of [ "short_url" of ] map ;
-
-: info ( short-url -- title )
-    "info" get-short-url "info" of first "title" of ;
diff --git a/extra/bit/ly/summary.txt b/extra/bit/ly/summary.txt
deleted file mode 100644 (file)
index 29020a6..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Wrapper for bit.ly URL shortening web service
diff --git a/extra/bit/ly/tags.txt b/extra/bit/ly/tags.txt
deleted file mode 100644 (file)
index 0a8d552..0000000
+++ /dev/null
@@ -1 +0,0 @@
-web services
diff --git a/extra/bitly/authors.txt b/extra/bitly/authors.txt
new file mode 100644 (file)
index 0000000..8a4581b
--- /dev/null
@@ -0,0 +1,2 @@
+Slava Pestov
+John Benediktsson
diff --git a/extra/bitly/bitly.factor b/extra/bitly/bitly.factor
new file mode 100644 (file)
index 0000000..5be72c8
--- /dev/null
@@ -0,0 +1,69 @@
+! Copyright (C) 2010-2012 Slava Pestov, John Benediktsson.
+! See http://factorcode.org/license.txt for BSD license.
+USING: assocs http.client json.reader kernel namespaces
+sequences urls ;
+IN: bitly
+
+SYMBOLS: bitly-api-user bitly-api-key ;
+
+<PRIVATE
+
+: <bitly-url> ( path -- url )
+    "http://api.bitly.com/v3/" prepend >url
+        bitly-api-user get "login" set-query-param
+        bitly-api-key get "apiKey" set-query-param
+        "json" "format" set-query-param ;
+
+ERROR: bad-response json status ;
+
+: check-status ( json -- json )
+    dup "status_code" of 200 = [
+        dup "status_txt" of
+        bad-response
+    ] unless ;
+
+: json-data ( url -- json )
+    http-get nip json> check-status "data" of ;
+
+: get-short-url ( short-url path -- data )
+    <bitly-url> swap "shortUrl" set-query-param json-data ;
+
+: get-long-url ( long-url path -- data )
+    <bitly-url> swap "longUrl" set-query-param json-data ;
+
+PRIVATE>
+
+: shorten-url ( long-url -- short-url )
+    "shorten" get-long-url "url" of ;
+
+: expand-url ( short-url -- url )
+    "expand" get-short-url "expand" of first "long_url" of ;
+
+: valid-user? ( user api-key -- ? )
+    "validate" <bitly-url>
+        swap "x_apiKey" set-query-param
+        swap "x_login" set-query-param
+    json-data "valid" of 1 = ;
+
+: clicks ( short-url -- clicks )
+    "clicks" get-short-url "clicks" of first "global_clicks" of ;
+
+: referrers ( short-url -- referrers )
+    "referrers" get-short-url "referrers" of ;
+
+: countries ( short-url -- countries )
+    "countries" get-short-url "countries" of ;
+
+: clicks-by-minute ( short-url -- clicks )
+    "clicks_by_minute" get-short-url "clicks_by_minute" of ;
+
+: clicks-by-day ( short-url -- clicks )
+    "clicks_by_day" get-short-url "clicks_by_day" of ;
+
+: lookup ( long-urls -- short-urls )
+    "lookup" <bitly-url>
+        swap "url" set-query-param
+    json-data "lookup" of [ "short_url" of ] map ;
+
+: info ( short-url -- title )
+    "info" get-short-url "info" of first "title" of ;
diff --git a/extra/bitly/summary.txt b/extra/bitly/summary.txt
new file mode 100644 (file)
index 0000000..29020a6
--- /dev/null
@@ -0,0 +1 @@
+Wrapper for bit.ly URL shortening web service
diff --git a/extra/bitly/tags.txt b/extra/bitly/tags.txt
new file mode 100644 (file)
index 0000000..0a8d552
--- /dev/null
@@ -0,0 +1 @@
+web services
index cdb4ebb5f98438d0e60ad1dd8438375af83f8378..5fa7de89a093c26394283d8fac227baa2822cee6 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors bit.ly combinators db.tuples debugger fry
+USING: accessors bitly combinators db.tuples debugger fry
 grouping io io.streams.string kernel locals make sequences
 threads mason.email mason.twitter webapps.mason.backend
 webapps.mason.version.common webapps.mason.version.data