Skip to content
This repository has been archived by the owner on Mar 10, 2024. It is now read-only.

Commit

Permalink
Publish final version
Browse files Browse the repository at this point in the history
  • Loading branch information
nnichols committed Mar 10, 2024
1 parent a950d5a commit 149a8ba
Show file tree
Hide file tree
Showing 10 changed files with 202 additions and 30 deletions.
3 changes: 3 additions & 0 deletions .cljstyle
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{:files {:extensions #{"clj" "cljs" "cljc" "cljx" "edn"}
:ignore #{"target" ".git" ".idea" ".vscode" "node_modules"}}
:rules {:namespaces {:enabled? false}}}
52 changes: 52 additions & 0 deletions .github/workflows/deploy_to_clojars.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Deploy to Clojars

on:
workflow_dispatch:


jobs:
deploy:

runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v4.1.1

- name: Cache maven dependencies
uses: actions/cache@v4
env:
cache-name: cache-maven
with:
path: ~/.m2
save-always: true
key: ${{ runner.os }}-clj-${{ hashFiles('**/project.clj') }}
restore-keys: |
${{ runner.os }}-clj
- name: Install Clojure dependencies
run: |
lein deps && lein project-version
- name: Run sanity tests
run: lein test

- name: Run build test
run: lein jar

- name: Publish to Clojars
env:
CLOJARS_USER: ${{ secrets.CLOJARS_USER }}
CLOJARS_PASS: ${{ secrets.CLOJARS_PASS }}
run: lein deploy clojars

- name: Resolve version
id: versionchk
run: echo "::set-output name=VERSION::$(lein project-version)"

- name: Push Tag
uses: hole19/git-tag-action@v1.0
env:
TAG: v${{ steps.versionchk.outputs.VERSION }}
GITHUB_TOKEN: ${{ secrets.WALL_BREW_BOT_PAT }}

4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## v1.1.0 / 2024 Mar 10

> This release marks the library as deprecated
## v1.0.0 / 2021 Oct 22

> This release adds all initial functionality
99 changes: 99 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.wallbrew</groupId>
<artifactId>strawpoll-client</artifactId>
<packaging>jar</packaging>
<version>1.1.0</version>
<name>strawpoll-client</name>
<description>A clj-http client library for https://strawpoll.com/</description>
<url>https://github.com/Wall-Brew-Co/strawpoll-client</url>
<licenses>
<license>
<name>MIT</name>
<url>https://opensource.org/licenses/MIT</url>
</license>
</licenses>
<scm>
<url>https://github.com/Wall-Brew-Co/strawpoll-client</url>
<connection>scm:git:git://github.com/Wall-Brew-Co/strawpoll-client.git</connection>
<developerConnection>scm:git:ssh://git@github.com/Wall-Brew-Co/strawpoll-client.git</developerConnection>
<tag>a950d5a52f4a77010c121b95b5b7a78f94971021</tag>
</scm>
<build>
<sourceDirectory>src</sourceDirectory>
<testSourceDirectory>test</testSourceDirectory>
<resources>
<resource>
<directory>resources</directory>
</resource>
</resources>
<testResources>
<testResource>
<directory>resources</directory>
</testResource>
</testResources>
<directory>target</directory>
<outputDirectory>target/classes</outputDirectory>
<plugins/>
</build>
<repositories>
<repository>
<id>central</id>
<url>https://repo1.maven.org/maven2/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
<repository>
<id>clojars</id>
<url>https://repo.clojars.org/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>
<dependencyManagement>
<dependencies/>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>cheshire</groupId>
<artifactId>cheshire</artifactId>
<version>5.12.0</version>
</dependency>
<dependency>
<groupId>clj-http</groupId>
<artifactId>clj-http</artifactId>
<version>3.12.3</version>
</dependency>
<dependency>
<groupId>org.clojure</groupId>
<artifactId>clojure</artifactId>
<version>1.11.2</version>
</dependency>
<dependency>
<groupId>circleci</groupId>
<artifactId>bond</artifactId>
<version>0.6.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>clj-http-fake</groupId>
<artifactId>clj-http-fake</artifactId>
<version>1.0.4</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

<!-- This file was autogenerated by Leiningen.
Please do not edit it directly; instead edit project.clj and regenerate it.
It should not be considered canonical data. For more information see
https://codeberg.org/leiningen/leiningen -->
26 changes: 21 additions & 5 deletions project.clj
Original file line number Diff line number Diff line change
@@ -1,12 +1,28 @@
(defproject com.wallbrew/strawpoll-client "1.0.0"
(defproject com.wallbrew/strawpoll-client "1.1.0"
:description "A clj-http client library for https://strawpoll.com/"
:url "https://github.com/Wall-Brew-Co/strawpoll-client"
:license {:name "MIT"
:url "https://opensource.org/licenses/MIT"}
:license {:name "MIT"
:url "https://opensource.org/licenses/MIT"
:distribution :repo
:comments "Same-as all Wall-Brew projects."}
:scm {:name "git"
:url "https://github.com/Wall-Brew-Co/strawpoll-client"}
:dependencies [[cheshire "5.12.0"]
[clj-http "3.12.3"]
[org.clojure/clojure "1.11.2"]]
:plugins [[com.github.clj-kondo/lein-clj-kondo "2024.03.05"]
[com.wallbrew/lein-sealog "1.2.0"]
[lein-cljsbuild "1.1.8"]
[lein-project-version "0.1.0"]
[mvxcvi/cljstyle "0.16.630"]
[ns-sort "1.0.3"]]
:profiles {:uberjar {:aot :all}
:dev {:dependencies [[circleci/bond "0.6.0"]
[clj-http-fake "1.0.4"]]}}
:dev {:dependencies [[circleci/bond "0.6.0"]
[clj-http-fake "1.0.4"]]}}
:resource-paths ["resources"]
:deploy-branches ["master"]
:deploy-repositories [["clojars" {:url "https://clojars.org/repo"
:username :env/clojars_user
:password :env/clojars_pass
:sign-releases false}]]
:min-lein-version "2.5.3")
19 changes: 10 additions & 9 deletions src/strawpoll_client/core.clj
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
(ns strawpoll-client.core
"Basic functions to interact with [Strawpoll](https://strawpoll.com/en/api-docs/)"
(:require
[cheshire.core :as json]
[clj-http.client :as client]
[strawpoll-client.impl :as impl]))
(:require [cheshire.core :as json]
[clj-http.client :as client]
[strawpoll-client.impl :as impl]))


(defn ->client
(defn ^:deprecated ->client
"Create a client, which is the required first argument to `create-poll!`, `get-poll-results!`, and `delete-poll!`.
This function expects an option map, with the following key sets:
- :api-key - The Strawpoll API key for your project.
Expand All @@ -20,7 +19,7 @@
:clj-http-opts clj-http-opts})


(defn create-poll!
(defn ^:deprecated create-poll!
"Create a poll using the provided `client` titled `title` with `answers`.
`client` is expected to be the return value of `strawpoll-client.core/->client`
`title` is a string representing the title of the poll you wish to create.
Expand Down Expand Up @@ -74,13 +73,15 @@


#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]}
(defn ->poll-id


(defn ^:deprecated ->poll-id
"A convenience function to extract the identifier of a poll from the return value of `strawpoll-client.core/create-poll!`"
[create-poll!-response]
(:content_id create-poll!-response))


(defn get-poll-results!
(defn ^:deprecated get-poll-results!
"Get the current results of `poll-id` using the provided client.
The poll-id is encoded in the response of `strawpoll-client.core/create-poll!` as `content_id`, which may be retreived by `strawpoll-client.core/->poll-id`"
[{:keys [api-key clj-http-opts]} poll-id]
Expand All @@ -92,7 +93,7 @@
(:body (client/get (impl/->url "/poll/" poll-id) request-opts))))


(defn delete-poll!
(defn ^:deprecated delete-poll!
"Permanently delete `poll-id` using the provided client.
The poll-id is encoded in the response of `strawpoll-client.core/create-poll!` as `content_id`, which may be retreived by `strawpoll-client.core/->poll-id`"
[{:keys [api-key clj-http-opts]} poll-id]
Expand Down
8 changes: 4 additions & 4 deletions src/strawpoll_client/impl.clj
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,25 @@
"https://strawpoll.com/api")


(defn ->url
(defn ^:deprecated ->url
"Append `route` as a suffix to the strawpoll URI stem"
[& route]
(str strawpoll-api-stem (apply str route)))


(defn getenv
(defn ^:deprecated getenv
"Wrapper - here to support testing since we can't redef static methods"
[k]
(System/getenv k))


(defn getProperty
(defn ^:deprecated getProperty
"Wrapper - here to support testing since we can't redef static methods"
[k]
(System/getProperty k))


(defn load-api-key!
(defn ^:deprecated load-api-key!
"Attempt to load the Strawpoll API key from `opts`, otherwise check for a matching Environment Variable or JVM Property"
[opts]
(if-let [api-key (or (:api-key opts)
Expand Down
3 changes: 1 addition & 2 deletions src/strawpoll_client/repl.clj
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
(ns strawpoll-client.repl
"A Rich comment block demonstrating the lifecycle of a poll"
(:require
[strawpoll-client.core :as straw]))
(:require [strawpoll-client.core :as straw]))


(comment
Expand Down
11 changes: 5 additions & 6 deletions test/strawpoll_client/core_test.clj
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
(ns strawpoll-client.core-test
(:require
[bond.james :as bond]
[clj-http.client :as http]
[clj-http.fake :refer [with-fake-routes-in-isolation]]
[clojure.test :as t]
[strawpoll-client.core :as sut]))
(:require [bond.james :as bond]
[clj-http.client :as http]
[clj-http.fake :refer [with-fake-routes-in-isolation]]
[clojure.test :as t]
[strawpoll-client.core :as sut]))


(t/deftest create-poll!-test
Expand Down
7 changes: 3 additions & 4 deletions test/strawpoll_client/impl_test.clj
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
(ns strawpoll-client.impl-test
(:require
[bond.james :as bond]
[clojure.test :as t]
[strawpoll-client.impl :as sut]))
(:require [bond.james :as bond]
[clojure.test :as t]
[strawpoll-client.impl :as sut]))


(t/deftest load-bugsnag-api-key!-test
Expand Down

0 comments on commit 149a8ba

Please sign in to comment.