clnk_api 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 91aa142d923c07b8831899fa64292bf25bdc7ff454c6f99b9fc40c77b38a589e
4
- data.tar.gz: 1f72e6007cd1250669d8b6c2e8beb3001d99c384e29749cb3624052fc8da1d63
3
+ metadata.gz: aadd78f740df8828fa1f9c8c9b07eca199178d6a0b737932ad004a027df836bb
4
+ data.tar.gz: 2ef777e85b8783dd1a3fc3f7e0cb3432a8205f9014a55238308d10b1103bcc31
5
5
  SHA512:
6
- metadata.gz: 9b04461f444b7ac02b8ccdad3f6c76249e5cc6a8e254de72ddb174002b2736045f0fb0558f228dd8b3bfb4b9788e5c6e38047533cdcd8776f4250774acc66996
7
- data.tar.gz: 5b63abd0f1af786612143073c3dfae7979b829f16d029bbfcd08e03ff3eec9af55240282fd485e2801b1e8b0b2a82136590fc89518695fb5b7fb65b61a320c60
6
+ metadata.gz: 54b80490dff6e20b0e70f1586acd9e133f20c18f4740a93412dfc979801d1655700bf73538b2337c5bf9ee71bd5b6f8cccd81ec3171aa2f5e99a8a933994a7b1
7
+ data.tar.gz: cbac5854628067c65699f6387218b5a10edd9255f01429e64634c05189598406e0d914af66e1dcbde79d230cec4aa10b67d988cb0bec1762aad03f59693f92dc
data/CHANGELOG.md ADDED
@@ -0,0 +1,42 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ ## [0.0.5] - 2024-10-08
6
+
7
+ ### Changed
8
+ - Relaxed HTTParty dependency from `~> 0.17.3` to `>= 0.13.0` for better compatibility
9
+ - Relaxed multi_json dependency from `~> 1.11.2` to `>= 1.10` for better compatibility
10
+ - This allows the gem to work with newer versions of HTTParty (tested up to 0.23.x) and multi_json (tested up to 1.15.x)
11
+ - Resolves Bundler dependency conflicts with other gems that require different versions of these libraries
12
+
13
+ ## [0.0.4] - 2024-10-08
14
+
15
+ ### Added
16
+ - Support for custom base URI configuration
17
+ - Users can now specify alternative API endpoints when initializing the client
18
+ - Example: `ClnkApi::Clnk.new("token", "https://custom.api.example.com")`
19
+
20
+ ### Changed
21
+ - Updated Clnk initializer to accept optional base_uri parameter
22
+ - Updated Link class to use configurable base URI
23
+
24
+ ## [0.0.3] - 2014-11-14
25
+
26
+ ### Changed
27
+ - Updated to use HTTPS instead of HTTP for API endpoints
28
+
29
+ ## [0.0.2] - 2014-11-11
30
+
31
+ ### Changed
32
+ - Updated HTTParty gem version
33
+
34
+ ## [0.0.1] - 2014-11-11
35
+
36
+ ### Added
37
+ - Initial release
38
+ - URL shortening functionality
39
+ - URL expansion functionality
40
+ - URL info retrieval
41
+ - Bulk URL operations
42
+ - Error handling for API responses
data/CLAUDE.md ADDED
@@ -0,0 +1,112 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+ ## Project Overview
6
+
7
+ ClnkApi is a Ruby gem that provides a client library for interacting with the Clnk URL shortening service API. It supports URL shortening, expansion, info retrieval, and bulk operations.
8
+
9
+ ## Development Commands
10
+
11
+ ### Essential Commands
12
+ ```bash
13
+ # Install dependencies
14
+ bundle install
15
+
16
+ # Build the gem
17
+ gem build clnk_api.gemspec
18
+
19
+ # Install the gem locally
20
+ gem install ./clnk_api-0.0.3.gem
21
+
22
+ # Run console with gem loaded
23
+ irb -r ./lib/clnk_api
24
+
25
+ # Release new version
26
+ rake release
27
+ ```
28
+
29
+ ## Architecture Overview
30
+
31
+ ### Core Components
32
+
33
+ - **`lib/clnk_api/clnk.rb`**: Main client class that handles API authentication and provides high-level methods
34
+ - **`lib/clnk_api/link.rb`**: Low-level API operations and HTTP request handling
35
+ - **`lib/clnk_api/errors.rb`**: Custom error classes mapped to HTTP status codes
36
+
37
+ ### API Operations
38
+
39
+ The gem supports four main operations:
40
+
41
+ 1. **Shorten**: Convert long URLs to short Clnk URLs
42
+ 2. **Expand**: Retrieve original URL from short code
43
+ 3. **Info**: Get detailed information about a shortened URL
44
+ 4. **Bulk**: Process multiple URLs in a single request
45
+
46
+ ### Key Implementation Details
47
+
48
+ #### URL Validation
49
+ - Accepts String, Array, or Hash inputs
50
+ - Validates URLs against URI.regexp for HTTP/HTTPS protocols
51
+ - Automatically adds "http://" prefix if protocol is missing
52
+
53
+ #### Error Handling
54
+ Maps HTTP status codes to specific error classes:
55
+ - 401 → `Unauthorized` (invalid API key)
56
+ - 400 → `General` (validation errors)
57
+ - 404 → `NotFound` (invalid short code)
58
+ - 500 → `InformClnk` (server error)
59
+ - 503 → `Unavailable` (service down)
60
+
61
+ #### API Configuration
62
+ - Base URI: `https://api.clnk.in`
63
+ - Authentication via access token in request headers
64
+ - Uses HTTParty for HTTP client functionality
65
+ - JSON parsing with multi_json gem
66
+
67
+ ## Testing Approach
68
+
69
+ Currently no test suite is implemented. When adding tests:
70
+ ```bash
71
+ # Recommended test framework setup
72
+ bundle add rspec --group test
73
+ bundle exec rspec --init
74
+
75
+ # Run tests (once implemented)
76
+ bundle exec rspec
77
+ ```
78
+
79
+ ## Usage Examples
80
+
81
+ ```ruby
82
+ # Initialize client
83
+ clnk = ClnkApi::Clnk.new("your_access_token")
84
+
85
+ # Shorten URL
86
+ short_url = clnk.shorten("https://example.com/very/long/url")
87
+
88
+ # Expand short code
89
+ original_url = clnk.expand("abc123")
90
+
91
+ # Get URL info
92
+ info = clnk.info("https://clnk.in/abc123")
93
+
94
+ # Bulk operations
95
+ urls = ["https://example1.com", "https://example2.com"]
96
+ results = clnk.bulk(urls)
97
+ ```
98
+
99
+ ## External Dependencies
100
+
101
+ - **HTTParty (~> 0.17.3)**: HTTP client library
102
+ - **multi_json (~> 1.11.2)**: JSON parsing
103
+ - **bundler (~> 1.7)**: Dependency management
104
+ - **rake (~> 10.0)**: Task automation
105
+
106
+ ## Version Management
107
+
108
+ Current version is defined in `lib/clnk_api/version.rb`. To release a new version:
109
+ 1. Update version number in `lib/clnk_api/version.rb`
110
+ 2. Update CHANGELOG if present
111
+ 3. Commit changes
112
+ 4. Run `rake release` to build, tag, and push to RubyGems
Binary file
data/clnk_api.gemspec CHANGED
@@ -8,9 +8,9 @@ Gem::Specification.new do |spec|
8
8
  spec.version = ClnkApi::VERSION
9
9
  spec.authors = ["mothirajha"]
10
10
  spec.email = ["rajha12@gmail.com"]
11
- spec.summary = %q{Clnk Client API}
12
- spec.description = %q{Clnk Client API}
13
- spec.homepage = ""
11
+ spec.summary = %q{Ruby client for Cuelinks URL shortening API}
12
+ spec.description = %q{A Ruby gem that provides a client library for interacting with the Cuelinks URL shortening service. Supports URL shortening, expansion, info retrieval, bulk operations, and custom base URIs.}
13
+ spec.homepage = "https://github.com/cuelinks/clnk_api"
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0")
@@ -20,6 +20,6 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_development_dependency "bundler", "~> 1.7"
22
22
  spec.add_development_dependency "rake", "~> 10.0"
23
- spec.add_dependency "httparty", "~> 0.17.3"
24
- spec.add_dependency "multi_json", "~> 1.11.2"
23
+ spec.add_dependency "httparty", ">= 0.13.0", "< 1.0"
24
+ spec.add_dependency "multi_json", ">= 1.10", "< 2.0"
25
25
  end
@@ -1,3 +1,3 @@
1
1
  module ClnkApi
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clnk_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - mothirajha
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-10-07 00:00:00.000000000 Z
11
+ date: 2025-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -42,31 +42,45 @@ dependencies:
42
42
  name: httparty
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: 0.13.0
48
+ - - "<"
46
49
  - !ruby/object:Gem::Version
47
- version: 0.17.3
50
+ version: '1.0'
48
51
  type: :runtime
49
52
  prerelease: false
50
53
  version_requirements: !ruby/object:Gem::Requirement
51
54
  requirements:
52
- - - "~>"
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: 0.13.0
58
+ - - "<"
53
59
  - !ruby/object:Gem::Version
54
- version: 0.17.3
60
+ version: '1.0'
55
61
  - !ruby/object:Gem::Dependency
56
62
  name: multi_json
57
63
  requirement: !ruby/object:Gem::Requirement
58
64
  requirements:
59
- - - "~>"
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '1.10'
68
+ - - "<"
60
69
  - !ruby/object:Gem::Version
61
- version: 1.11.2
70
+ version: '2.0'
62
71
  type: :runtime
63
72
  prerelease: false
64
73
  version_requirements: !ruby/object:Gem::Requirement
65
74
  requirements:
66
- - - "~>"
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ version: '1.10'
78
+ - - "<"
67
79
  - !ruby/object:Gem::Version
68
- version: 1.11.2
69
- description: Clnk Client API
80
+ version: '2.0'
81
+ description: A Ruby gem that provides a client library for interacting with the Cuelinks
82
+ URL shortening service. Supports URL shortening, expansion, info retrieval, bulk
83
+ operations, and custom base URIs.
70
84
  email:
71
85
  - rajha12@gmail.com
72
86
  executables: []
@@ -74,17 +88,20 @@ extensions: []
74
88
  extra_rdoc_files: []
75
89
  files:
76
90
  - ".gitignore"
91
+ - CHANGELOG.md
92
+ - CLAUDE.md
77
93
  - Gemfile
78
94
  - LICENSE.txt
79
95
  - README.md
80
96
  - Rakefile
97
+ - clnk_api-0.0.4.gem
81
98
  - clnk_api.gemspec
82
99
  - lib/clnk_api.rb
83
100
  - lib/clnk_api/clnk.rb
84
101
  - lib/clnk_api/errors.rb
85
102
  - lib/clnk_api/link.rb
86
103
  - lib/clnk_api/version.rb
87
- homepage: ''
104
+ homepage: https://github.com/cuelinks/clnk_api
88
105
  licenses:
89
106
  - MIT
90
107
  metadata: {}
@@ -106,5 +123,5 @@ requirements: []
106
123
  rubygems_version: 3.4.10
107
124
  signing_key:
108
125
  specification_version: 4
109
- summary: Clnk Client API
126
+ summary: Ruby client for Cuelinks URL shortening API
110
127
  test_files: []