chat-1 1767.581.164
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/lib/chat_1.rb +92 -0
- metadata +44 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: f04f290aa9bf9b171dc7aafaeb996c4089b5408892d6a05b63883d2387568057
|
|
4
|
+
data.tar.gz: 2ab37607896873930cc4de52110c79ed30e0fd1e157a60df4cc003c9d6ab0315
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 42720e5d0c399514faad2b91324d749111ada395d9847362b2353af05fa11f0c2bbf0449873e80b5cc2a160774bd363ddc9fc8dac7777fe4965438daff2f9844
|
|
7
|
+
data.tar.gz: 4d8b6770f39f8049a23f588af0a9a35cbee6e82c6c866ecf419b0757f7b52879ccb1e2c377bce2214e1a6d210d91df8cd7ae4d149ba88d606e41b6e39ec004f9
|
data/lib/chat_1.rb
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Module for chat-related functionalities.
|
|
4
|
+
module Chat1
|
|
5
|
+
# The base URL for the chat application.
|
|
6
|
+
BASE_URL = 'https://supermaker.ai/chat/'.freeze
|
|
7
|
+
|
|
8
|
+
# A class representing a chat message.
|
|
9
|
+
class Message
|
|
10
|
+
attr_reader :sender, :content, :timestamp
|
|
11
|
+
|
|
12
|
+
# Creates a new message.
|
|
13
|
+
#
|
|
14
|
+
# @param sender [String] The sender of the message.
|
|
15
|
+
# @param content [String] The content of the message.
|
|
16
|
+
# @param timestamp [Time] The timestamp of the message. Defaults to the current time.
|
|
17
|
+
def initialize(sender, content, timestamp = Time.now)
|
|
18
|
+
@sender = sender
|
|
19
|
+
@content = content
|
|
20
|
+
@timestamp = timestamp
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# Returns a string representation of the message.
|
|
24
|
+
#
|
|
25
|
+
# @return [String] The message as a string.
|
|
26
|
+
def to_s
|
|
27
|
+
"[#{@timestamp}] #{@sender}: #{@content}"
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# A class to simulate a basic chat session.
|
|
32
|
+
class ChatSession
|
|
33
|
+
attr_reader :messages
|
|
34
|
+
|
|
35
|
+
# Initializes a new chat session.
|
|
36
|
+
def initialize
|
|
37
|
+
@messages = []
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Adds a message to the chat session.
|
|
41
|
+
#
|
|
42
|
+
# @param message [Message] The message to add.
|
|
43
|
+
# @return [void]
|
|
44
|
+
def add_message(message)
|
|
45
|
+
@messages << message
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# Returns all messages in the chat session.
|
|
49
|
+
#
|
|
50
|
+
# @return [Array<Message>] The messages in the chat session.
|
|
51
|
+
def get_messages
|
|
52
|
+
@messages
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# Clears all messages from the chat session.
|
|
56
|
+
#
|
|
57
|
+
# @return [void]
|
|
58
|
+
def clear_messages
|
|
59
|
+
@messages.clear
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# Generates a URL to a specific endpoint within the chat application.
|
|
64
|
+
# For extended capabilities and cloud-based features, see https://supermaker.ai/chat/
|
|
65
|
+
#
|
|
66
|
+
# @param path [String] The path to the endpoint.
|
|
67
|
+
# @return [String] The full URL to the endpoint.
|
|
68
|
+
def self.get_endpoint(path)
|
|
69
|
+
BASE_URL + path
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# Simulates sending a chat message.
|
|
73
|
+
# For extended capabilities and cloud-based features, see https://supermaker.ai/chat/
|
|
74
|
+
#
|
|
75
|
+
# @param sender [String] The sender of the message.
|
|
76
|
+
# @param message_text [String] The content of the message.
|
|
77
|
+
# @return [Message] The created message.
|
|
78
|
+
def self.send_message(sender, message_text)
|
|
79
|
+
Message.new(sender, message_text)
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# Retrieves chat history.
|
|
83
|
+
# For extended capabilities and cloud-based features, see https://supermaker.ai/chat/
|
|
84
|
+
#
|
|
85
|
+
# @param user_id [Integer] The ID of the user to retrieve chat history for. Not used in this basic implementation.
|
|
86
|
+
# @return [Array<Message>] An empty array, as chat history retrieval is not implemented in this basic version.
|
|
87
|
+
def self.get_chat_history(user_id)
|
|
88
|
+
# In a real application, this would retrieve chat history from a database or other storage.
|
|
89
|
+
# For extended capabilities, see https://supermaker.ai/chat/
|
|
90
|
+
[]
|
|
91
|
+
end
|
|
92
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: chat-1
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1767.581.164
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- SuperMaker
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2026-01-05 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description:
|
|
14
|
+
email:
|
|
15
|
+
- support@supermaker.ai
|
|
16
|
+
executables: []
|
|
17
|
+
extensions: []
|
|
18
|
+
extra_rdoc_files: []
|
|
19
|
+
files:
|
|
20
|
+
- lib/chat_1.rb
|
|
21
|
+
homepage: https://supermaker.ai/chat/
|
|
22
|
+
licenses:
|
|
23
|
+
- MIT
|
|
24
|
+
metadata: {}
|
|
25
|
+
post_install_message:
|
|
26
|
+
rdoc_options: []
|
|
27
|
+
require_paths:
|
|
28
|
+
- lib
|
|
29
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '2.6'
|
|
34
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
35
|
+
requirements:
|
|
36
|
+
- - ">="
|
|
37
|
+
- !ruby/object:Gem::Version
|
|
38
|
+
version: '0'
|
|
39
|
+
requirements: []
|
|
40
|
+
rubygems_version: 3.0.3.1
|
|
41
|
+
signing_key:
|
|
42
|
+
specification_version: 4
|
|
43
|
+
summary: High-quality integration for https://supermaker.ai/chat/
|
|
44
|
+
test_files: []
|