]> gitweb.factorcode.org Git - factor.git/commitdiff
gravatar: wrapper for Gravatar.com service.
authorJohn Benediktsson <mrjbq7@gmail.com>
Thu, 28 Mar 2019 20:49:58 +0000 (13:49 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Thu, 28 Mar 2019 20:50:35 +0000 (13:50 -0700)
extra/gravatar/authors.txt [new file with mode: 0644]
extra/gravatar/gravatar.factor [new file with mode: 0644]
extra/gravatar/summary.txt [new file with mode: 0644]

diff --git a/extra/gravatar/authors.txt b/extra/gravatar/authors.txt
new file mode 100644 (file)
index 0000000..e091bb8
--- /dev/null
@@ -0,0 +1 @@
+John Benediktsson
diff --git a/extra/gravatar/gravatar.factor b/extra/gravatar/gravatar.factor
new file mode 100644 (file)
index 0000000..8a068f1
--- /dev/null
@@ -0,0 +1,18 @@
+! Copyright (C) 2011 John Benediktsson
+! See http://factorcode.org/license.txt for BSD license
+
+USING: accessors assocs classes.tuple formatting http.client
+images.http json.reader kernel sequences strings ;
+
+IN: gravatar
+
+TUPLE: info aboutMe accounts currentLocation displayName emails
+hash id ims name phoneNumbers photos preferredUsername
+profileBackground profileUrl requestHash thumbnailUrl urls ;
+
+: gravatar-info ( gravatar-id -- info )
+    "http://gravatar.com/%s.json" sprintf http-get nip
+    >string json> "entry" of first info from-slots ;
+
+: gravatar. ( gravatar-id -- )
+    gravatar-info thumbnailUrl>> http-image. ;
diff --git a/extra/gravatar/summary.txt b/extra/gravatar/summary.txt
new file mode 100644 (file)
index 0000000..a0a5656
--- /dev/null
@@ -0,0 +1 @@
+Wrapper for the Gravatar service.