From dafbb5a0882ebf085b71428be626ad578653f369 Mon Sep 17 00:00:00 2001 From: Xavi Ablaza Date: Sun, 11 Feb 2024 15:27:46 -0600 Subject: [PATCH 1/5] Update copyright years --- LICENSE | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/LICENSE b/LICENSE index d6a2dd5..b8c6806 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2022 Hostari Philippines, Inc. +Copyright (c) 2022-2024 Hostari Philippines, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index c34019e..d2ea2ca 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ The Thunderstore API Crystal wrapper. Fetch game modification info from your Crystal code. -Copyright 2022 Hostari Philippines, Inc. See LICENSE for copying information. +Copyright 2022-2024 Hostari Philippines, Inc. See LICENSE for copying information. 📝 Implements: [REST API Reference (V1)](https://valheim.thunderstore.io/api/docs/) 😘 Maintainer(s): @xaviablaza From 6889c69d0242992d2662c67f6f86caf1b53b4639 Mon Sep 17 00:00:00 2001 From: Xavi Ablaza Date: Sun, 11 Feb 2024 15:28:06 -0600 Subject: [PATCH 2/5] Use pessimistic version constraint --- shard.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shard.yml b/shard.yml index 9f3e30e..41eb0f8 100644 --- a/shard.yml +++ b/shard.yml @@ -4,7 +4,7 @@ version: 1.0.2 authors: - Xavi Ablaza -crystal: 1.2.2 +crystal: ~> 1.6.2 development_dependencies: webmock: From 5d6b2d7e23876a5dfbde61ffc663badf1a07d185 Mon Sep 17 00:00:00 2001 From: xavi Date: Sun, 11 Feb 2024 15:30:30 -0600 Subject: [PATCH 3/5] Add json library to make crystal spec work --- spec/spec_helper.cr | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/spec_helper.cr b/spec/spec_helper.cr index 1c08c7f..d214d15 100644 --- a/spec/spec_helper.cr +++ b/spec/spec_helper.cr @@ -1,4 +1,5 @@ require "spec" require "webmock" Spec.before_each &->WebMock.reset +require "json" require "../src/thunderstore/**" From 515bb64f198ab14d096d0902f7e646bf2f3077fd Mon Sep 17 00:00:00 2001 From: Xavi Ablaza Date: Mon, 12 Feb 2024 08:38:34 -0600 Subject: [PATCH 4/5] Add more documentation --- src/thunderstore/client.cr | 9 +++++++-- src/thunderstore/error.cr | 1 + src/thunderstore_client.cr | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/thunderstore/client.cr b/src/thunderstore/client.cr index 99c8352..d6998a1 100644 --- a/src/thunderstore/client.cr +++ b/src/thunderstore/client.cr @@ -5,18 +5,23 @@ module Thunderstore def initialize(@community : String = "") end + # Sets the `@community` instance variable. + # You can find a list of communities by going to https://thunderstore.io + # and looking at the the subdomains that each mod community is listed under. def set_community(community : String) @community = community end - # Returns the base url for which this client will make API requests to + # Returns the base url for which this client will make API requests to. def base_url : URI return URI.parse("https://thunderstore.io") if community.empty? URI.parse("https://#{community}.thunderstore.io") end - def get(path : String) + # Initializes an `HTTP::Client` for the configured `base_url`, and executes a GET request on the specified `path`. + # The response will have its body as a String, accessed via `HTTP::Client::Response#body`. + def get(path : String) : HTTP::Client::Response HTTP::Client.new(base_url).get(path) end end diff --git a/src/thunderstore/error.cr b/src/thunderstore/error.cr index 82672ca..c111855 100644 --- a/src/thunderstore/error.cr +++ b/src/thunderstore/error.cr @@ -1,4 +1,5 @@ module Thunderstore + # Error class to catch if operations in this library are thrown. class Error < Exception property message : String? diff --git a/src/thunderstore_client.cr b/src/thunderstore_client.cr index 96eb91a..075a04d 100644 --- a/src/thunderstore_client.cr +++ b/src/thunderstore_client.cr @@ -1,6 +1,7 @@ require "json" require "http/client" +# Specifies information related to this shard, like the `ThunderstoreClient::VERSION` class ThunderstoreClient VERSION = "1.0.2" end From 4609d2c9a5874f51c8df9f2e0128289985a2eab2 Mon Sep 17 00:00:00 2001 From: Xavi Ablaza Date: Mon, 12 Feb 2024 09:47:10 -0600 Subject: [PATCH 5/5] Bump version to 1.0.3 --- shard.yml | 2 +- src/thunderstore_client.cr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/shard.yml b/shard.yml index 41eb0f8..29cc326 100644 --- a/shard.yml +++ b/shard.yml @@ -1,5 +1,5 @@ name: thunderstore_client -version: 1.0.2 +version: 1.0.3 authors: - Xavi Ablaza diff --git a/src/thunderstore_client.cr b/src/thunderstore_client.cr index 075a04d..b439951 100644 --- a/src/thunderstore_client.cr +++ b/src/thunderstore_client.cr @@ -3,7 +3,7 @@ require "http/client" # Specifies information related to this shard, like the `ThunderstoreClient::VERSION` class ThunderstoreClient - VERSION = "1.0.2" + VERSION = "1.0.3" end require "./thunderstore/**"