personalized_song_gift 0.1.0
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 +7 -0
- data/LICENSE +21 -0
- data/README.md +13 -0
- data/lib/personalized_song_gift.rb +48 -0
- metadata +50 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 377e8d5cad63fe91c5b1126d937597371791bd4a9d61705027d4b8ac05d24dea
|
|
4
|
+
data.tar.gz: c155a5d275a6f54c6fc6411cf88133c5825898d301129f6fb40796d94f797481
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: f3a16ad848b54ceb1eb9533fa4f8670f8b83e784677581cc2d53f5a1d732080b12f54751f3a987495147ff5e64bd785b309fea614f8ca25a8c93db97d1df7733
|
|
7
|
+
data.tar.gz: 1b72544f10eec1b2466f58503c95e79d561504ddc08f84411562f112cea87ce72d38ac2580abe8632fa149f64638a5f57cbd477030e66e0dc7d005786f3a0d81
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Personalized Song Gift
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# personalized_song_gift (Ruby Gem)
|
|
2
|
+
|
|
3
|
+
A personalized song gift with their name in the chorus, written from your story. Hear two versions free in minutes, then keep the one that sounds like them at **[Personalized Song Gift](https://personalized-song-gift.com/)**.
|
|
4
|
+
|
|
5
|
+
Zero-dependency Ruby library for validating custom song gift briefs, building pre-filled create URLs, and checking live free preview quota.
|
|
6
|
+
|
|
7
|
+
```ruby
|
|
8
|
+
require "personalized_song_gift"
|
|
9
|
+
puts PersonalizedSongGift.build_create_url(occasion: "anniversary", for_recipient: "wife")
|
|
10
|
+
puts PersonalizedSongGift.check_free_preview_quota.inspect
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Visit [Personalized Song Gift](https://personalized-song-gift.com/) · [Pricing](https://personalized-song-gift.com/pricing) · [Source](https://gitlab.com/daniel7dat/personalized-song-gift-sdks)
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
require "net/http"
|
|
3
|
+
require "uri"
|
|
4
|
+
|
|
5
|
+
module PersonalizedSongGift
|
|
6
|
+
VERSION = "0.1.0"
|
|
7
|
+
BASE_URL = "https://personalized-song-gift.com"
|
|
8
|
+
GENRES = %w[pop acoustic ballad country rnb rock hiphop folk jazz holiday kids edm].freeze
|
|
9
|
+
MOODS = %w[happy romantic emotional funny nostalgic epic].freeze
|
|
10
|
+
TEMPOS = %w[slow medium upbeat].freeze
|
|
11
|
+
OCCASIONS = %w[birthday anniversary wedding proposal love mothers-day christmas pet memorial other].freeze
|
|
12
|
+
|
|
13
|
+
module_function
|
|
14
|
+
|
|
15
|
+
def validate_brief(recipient_name:, story: "", lyrics: "", genre: "pop", mood: "happy", tempo: "medium")
|
|
16
|
+
errors = []
|
|
17
|
+
name = recipient_name.to_s.strip
|
|
18
|
+
errors << "recipient_name is required" if name.empty?
|
|
19
|
+
errors << "recipient_name max 40 chars" if name.length > 40
|
|
20
|
+
if !lyrics.to_s.strip.empty?
|
|
21
|
+
errors << "lyrics must be 40-3000 chars" unless lyrics.strip.length.between?(40, 3000)
|
|
22
|
+
else
|
|
23
|
+
errors << "story must be 20-900 chars" unless story.to_s.strip.length.between?(20, 900)
|
|
24
|
+
end
|
|
25
|
+
errors << "unsupported genre" unless GENRES.include?(genre)
|
|
26
|
+
errors << "unsupported mood" unless MOODS.include?(mood)
|
|
27
|
+
errors << "unsupported tempo" unless TEMPOS.include?(tempo)
|
|
28
|
+
errors
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def build_create_url(occasion: nil, for_recipient: nil)
|
|
32
|
+
params = {}
|
|
33
|
+
params["occasion"] = occasion if OCCASIONS.include?(occasion.to_s)
|
|
34
|
+
params["for"] = for_recipient if %w[wife husband boyfriend girlfriend myself].include?(for_recipient.to_s)
|
|
35
|
+
params.empty? ? "#{BASE_URL}/create" : "#{BASE_URL}/create?#{URI.encode_www_form(params)}"
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def check_free_preview_quota(base_url: BASE_URL)
|
|
39
|
+
uri = URI("#{base_url}/api/song?quota=1")
|
|
40
|
+
req = Net::HTTP::Get.new(uri)
|
|
41
|
+
req["User-Agent"] = "personalized-song-gift-rb/#{VERSION}"
|
|
42
|
+
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == "https", open_timeout: 10, read_timeout: 15) { |http| http.request(req) }
|
|
43
|
+
raise "HTTP #{res.code}" unless res.is_a?(Net::HTTPSuccess)
|
|
44
|
+
data = JSON.parse(res.body)
|
|
45
|
+
raise(data["message"] || "API error") unless data["code"] == 0
|
|
46
|
+
data["data"]
|
|
47
|
+
end
|
|
48
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: personalized_song_gift
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Personalized Song Gift
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2026-11-29 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: A personalized song gift with their name in the chorus, written from
|
|
14
|
+
your story. Validate custom song briefs, format chorus prompts, generate create
|
|
15
|
+
links, and check live free preview quota on personalized-song-gift.com.
|
|
16
|
+
email: support@personalized-song-gift.com
|
|
17
|
+
executables: []
|
|
18
|
+
extensions: []
|
|
19
|
+
extra_rdoc_files: []
|
|
20
|
+
files:
|
|
21
|
+
- LICENSE
|
|
22
|
+
- README.md
|
|
23
|
+
- lib/personalized_song_gift.rb
|
|
24
|
+
homepage: https://personalized-song-gift.com/
|
|
25
|
+
licenses:
|
|
26
|
+
- MIT
|
|
27
|
+
metadata:
|
|
28
|
+
homepage_uri: https://personalized-song-gift.com/
|
|
29
|
+
source_code_uri: https://gitlab.com/daniel7dat/personalized-song-gift-sdks
|
|
30
|
+
documentation_uri: https://daniel7dat.gitlab.io/personalized-song-gift-sdks/
|
|
31
|
+
post_install_message:
|
|
32
|
+
rdoc_options: []
|
|
33
|
+
require_paths:
|
|
34
|
+
- lib
|
|
35
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - ">="
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '2.6'
|
|
40
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
41
|
+
requirements:
|
|
42
|
+
- - ">="
|
|
43
|
+
- !ruby/object:Gem::Version
|
|
44
|
+
version: '0'
|
|
45
|
+
requirements: []
|
|
46
|
+
rubygems_version: 3.0.3.1
|
|
47
|
+
signing_key:
|
|
48
|
+
specification_version: 4
|
|
49
|
+
summary: Custom song gift brief validator, deep-link builder, and live quota client.
|
|
50
|
+
test_files: []
|