gorgias-ruby 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.
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Gorgias
4
+ module Resources
5
+ class Tags < Base
6
+ # Create a new tag.
7
+ #
8
+ # @param params [Hash] Tag attributes (name, etc.)
9
+ # @return [Gorgias::Object]
10
+ def create(**params)
11
+ post("/api/tags", params)
12
+ end
13
+
14
+ # List tags.
15
+ #
16
+ # @param params [Hash] Filter/pagination options
17
+ # @return [Array<Gorgias::Object>]
18
+ def list(**params)
19
+ get("/api/tags", params)
20
+ end
21
+
22
+ # Retrieve a single tag by ID.
23
+ #
24
+ # @param id [Integer, String]
25
+ # @return [Gorgias::Object]
26
+ def retrieve(id)
27
+ get("/api/tags/#{id}/")
28
+ end
29
+
30
+ # Update a tag.
31
+ #
32
+ # @param id [Integer, String]
33
+ # @param params [Hash] Attributes to update
34
+ # @return [Gorgias::Object]
35
+ def update(id, **params)
36
+ put("/api/tags/#{id}/", params)
37
+ end
38
+
39
+ # Delete a tag.
40
+ #
41
+ # @param id [Integer, String]
42
+ # @return [true]
43
+ def delete(id)
44
+ super("/api/tags/#{id}/")
45
+ end
46
+
47
+ # Merge one tag into another.
48
+ #
49
+ # @param id [Integer, String] Source tag ID
50
+ # @param params [Hash] Merge attributes (target_id, etc.)
51
+ # @return [Gorgias::Object]
52
+ def merge(id, **params)
53
+ put("/api/tags/#{id}/merge", params)
54
+ end
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Gorgias
4
+ module Resources
5
+ class TicketMessages < Base
6
+ # Create a message on a ticket.
7
+ #
8
+ # @param ticket_id [Integer, String] Parent ticket ID
9
+ # @param params [Hash] Message attributes:
10
+ # - :body_text [String] Plain-text body
11
+ # - :body_html [String] HTML body
12
+ # - :from_agent [Boolean]
13
+ # - :channel [String]
14
+ # - :attachments [Array<Hash>]
15
+ # @return [Gorgias::Object]
16
+ def create(ticket_id, **params)
17
+ post("/api/tickets/#{ticket_id}/messages", params)
18
+ end
19
+
20
+ # List messages for a ticket.
21
+ #
22
+ # @param ticket_id [Integer, String]
23
+ # @param params [Hash] Filter/pagination options
24
+ # @return [Array<Gorgias::Object>]
25
+ def list(ticket_id, **params)
26
+ get("/api/tickets/#{ticket_id}/messages", params)
27
+ end
28
+
29
+ # Retrieve a single message by ID.
30
+ #
31
+ # @param ticket_id [Integer, String]
32
+ # @param id [Integer, String] Message ID
33
+ # @return [Gorgias::Object]
34
+ def retrieve(ticket_id, id)
35
+ get("/api/tickets/#{ticket_id}/messages/#{id}/")
36
+ end
37
+
38
+ # Update a ticket message.
39
+ #
40
+ # @param ticket_id [Integer, String]
41
+ # @param id [Integer, String] Message ID
42
+ # @param params [Hash] Attributes to update
43
+ # @return [Gorgias::Object]
44
+ def update(ticket_id, id, **params)
45
+ put("/api/tickets/#{ticket_id}/messages/#{id}/", params)
46
+ end
47
+
48
+ # Delete a ticket message.
49
+ #
50
+ # @param ticket_id [Integer, String]
51
+ # @param id [Integer, String] Message ID
52
+ # @return [true]
53
+ def delete(ticket_id, id)
54
+ super("/api/tickets/#{ticket_id}/messages/#{id}/")
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,78 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Gorgias
4
+ module Resources
5
+ class Tickets < Base
6
+ # Create a new ticket.
7
+ #
8
+ # @param params [Hash] Ticket attributes:
9
+ # - :subject [String]
10
+ # - :channel [String] e.g. "email", "chat"
11
+ # - :status [String] e.g. "open", "closed"
12
+ # - :customer [Hash] { id: } or { email: }
13
+ # - :tags [Array<Hash>]
14
+ # - :assignee_user [Hash]
15
+ # - :assignee_team [Hash]
16
+ # - :messages [Array<Hash>] Initial messages
17
+ # @return [Gorgias::Object]
18
+ def create(**params)
19
+ post("/api/tickets", params)
20
+ end
21
+
22
+ # List tickets (paginated).
23
+ #
24
+ # @param params [Hash] Filter/pagination options:
25
+ # - :status [String]
26
+ # - :customer_id [Integer]
27
+ # - :assignee_user_id [Integer]
28
+ # - :channel [String]
29
+ # - :cursor [String]
30
+ # - :limit [Integer]
31
+ # @return [Array<Gorgias::Object>]
32
+ def list(**params)
33
+ get("/api/tickets", params)
34
+ end
35
+
36
+ # Retrieve a single ticket by ID.
37
+ #
38
+ # @param id [Integer, String]
39
+ # @return [Gorgias::Object]
40
+ def retrieve(id)
41
+ get("/api/tickets/#{id}/")
42
+ end
43
+
44
+ # Update a ticket.
45
+ #
46
+ # @param id [Integer, String]
47
+ # @param params [Hash] Attributes to update
48
+ # @return [Gorgias::Object]
49
+ def update(id, **params)
50
+ put("/api/tickets/#{id}/", params)
51
+ end
52
+
53
+ # Close a ticket.
54
+ #
55
+ # @param id [Integer, String]
56
+ # @return [Gorgias::Object]
57
+ def close(id)
58
+ put("/api/tickets/#{id}/close")
59
+ end
60
+
61
+ # Mark a ticket as spam.
62
+ #
63
+ # @param id [Integer, String]
64
+ # @return [Gorgias::Object]
65
+ def mark_as_spam(id)
66
+ put("/api/tickets/#{id}/spam")
67
+ end
68
+
69
+ # Delete a ticket.
70
+ #
71
+ # @param id [Integer, String]
72
+ # @return [true]
73
+ def delete(id)
74
+ super("/api/tickets/#{id}/")
75
+ end
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Gorgias
4
+ module Resources
5
+ class Users < Base
6
+ # Create a new agent/user.
7
+ #
8
+ # @param params [Hash] User attributes (name, email, role, etc.)
9
+ # @return [Gorgias::Object]
10
+ def create(**params)
11
+ post("/api/users", params)
12
+ end
13
+
14
+ # List users (agents).
15
+ #
16
+ # @param params [Hash] Filter/pagination options
17
+ # @return [Array<Gorgias::Object>]
18
+ def list(**params)
19
+ get("/api/users", params)
20
+ end
21
+
22
+ # Retrieve a single user by ID.
23
+ #
24
+ # @param id [Integer, String]
25
+ # @return [Gorgias::Object]
26
+ def retrieve(id)
27
+ get("/api/users/#{id}/")
28
+ end
29
+
30
+ # Update a user.
31
+ #
32
+ # @param id [Integer, String]
33
+ # @param params [Hash] Attributes to update
34
+ # @return [Gorgias::Object]
35
+ def update(id, **params)
36
+ put("/api/users/#{id}/", params)
37
+ end
38
+
39
+ # Delete a user.
40
+ #
41
+ # @param id [Integer, String]
42
+ # @return [true]
43
+ def delete(id)
44
+ super("/api/users/#{id}/")
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Gorgias
4
+ module Resources
5
+ class Views < Base
6
+ # Create a new view.
7
+ #
8
+ # @param params [Hash] View attributes (name, filters, etc.)
9
+ # @return [Gorgias::Object]
10
+ def create(**params)
11
+ post("/api/views", params)
12
+ end
13
+
14
+ # List views.
15
+ #
16
+ # @param params [Hash] Filter/pagination options
17
+ # @return [Array<Gorgias::Object>]
18
+ def list(**params)
19
+ get("/api/views", params)
20
+ end
21
+
22
+ # Retrieve a single view by ID.
23
+ #
24
+ # @param id [Integer, String]
25
+ # @return [Gorgias::Object]
26
+ def retrieve(id)
27
+ get("/api/views/#{id}/")
28
+ end
29
+
30
+ # Update a view.
31
+ #
32
+ # @param id [Integer, String]
33
+ # @param params [Hash] Attributes to update
34
+ # @return [Gorgias::Object]
35
+ def update(id, **params)
36
+ put("/api/views/#{id}/", params)
37
+ end
38
+
39
+ # Delete a view.
40
+ #
41
+ # @param id [Integer, String]
42
+ # @return [true]
43
+ def delete(id)
44
+ super("/api/views/#{id}/")
45
+ end
46
+
47
+ # Export the tickets in a view.
48
+ #
49
+ # @param id [Integer, String]
50
+ # @param params [Hash] Export options
51
+ # @return [Gorgias::Object]
52
+ def export(id, **params)
53
+ get("/api/views/#{id}/export", params)
54
+ end
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Gorgias
4
+ module Resources
5
+ class Widgets < Base
6
+ # Create a new widget.
7
+ #
8
+ # @param params [Hash] Widget attributes
9
+ # @return [Gorgias::Object]
10
+ def create(**params)
11
+ post("/api/widgets", params)
12
+ end
13
+
14
+ # List widgets.
15
+ #
16
+ # @param params [Hash] Filter/pagination options
17
+ # @return [Array<Gorgias::Object>]
18
+ def list(**params)
19
+ get("/api/widgets", params)
20
+ end
21
+
22
+ # Retrieve a single widget by ID.
23
+ #
24
+ # @param id [Integer, String]
25
+ # @return [Gorgias::Object]
26
+ def retrieve(id)
27
+ get("/api/widgets/#{id}/")
28
+ end
29
+
30
+ # Update a widget.
31
+ #
32
+ # @param id [Integer, String]
33
+ # @param params [Hash] Attributes to update
34
+ # @return [Gorgias::Object]
35
+ def update(id, **params)
36
+ put("/api/widgets/#{id}/", params)
37
+ end
38
+
39
+ # Delete a widget.
40
+ #
41
+ # @param id [Integer, String]
42
+ # @return [true]
43
+ def delete(id)
44
+ super("/api/widgets/#{id}/")
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Gorgias
4
+ module Ruby
5
+ VERSION = "0.1.0"
6
+ end
7
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Backward-compatibility shim — load the real gem entry point.
4
+ require_relative "../gorgias"
5
+
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Gorgias
4
+ VERSION = "0.1.0"
5
+ end
data/lib/gorgias.rb ADDED
@@ -0,0 +1,75 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "gorgias/version"
4
+ require_relative "gorgias/error"
5
+ require_relative "gorgias/configuration"
6
+ require_relative "gorgias/object"
7
+
8
+ require_relative "gorgias/resources/base"
9
+ require_relative "gorgias/resources/account"
10
+ require_relative "gorgias/resources/customers"
11
+ require_relative "gorgias/resources/events"
12
+ require_relative "gorgias/resources/files"
13
+ require_relative "gorgias/resources/integrations"
14
+ require_relative "gorgias/resources/jobs"
15
+ require_relative "gorgias/resources/macros"
16
+ require_relative "gorgias/resources/rules"
17
+ require_relative "gorgias/resources/satisfaction_surveys"
18
+ require_relative "gorgias/resources/search"
19
+ require_relative "gorgias/resources/statistics"
20
+ require_relative "gorgias/resources/tags"
21
+ require_relative "gorgias/resources/tickets"
22
+ require_relative "gorgias/resources/ticket_messages"
23
+ require_relative "gorgias/resources/users"
24
+ require_relative "gorgias/resources/views"
25
+ require_relative "gorgias/resources/widgets"
26
+
27
+ require_relative "gorgias/client"
28
+
29
+ # Gorgias REST API Ruby client.
30
+ #
31
+ # @example Global configuration
32
+ # Gorgias.configure do |c|
33
+ # c.domain = "mycompany"
34
+ # c.username = "me@example.com"
35
+ # c.api_key = "abc123"
36
+ # end
37
+ # client = Gorgias.new
38
+ #
39
+ # @example Per-client configuration
40
+ # client = Gorgias::Client.new(
41
+ # domain: "mycompany",
42
+ # username: "me@example.com",
43
+ # api_key: "abc123"
44
+ # )
45
+ #
46
+ module Gorgias
47
+ class << self
48
+ # Yields the global {Configuration} for mutation.
49
+ #
50
+ # @yieldparam config [Gorgias::Configuration]
51
+ def configure
52
+ yield(configuration)
53
+ end
54
+
55
+ # Returns the global {Configuration} instance (created lazily).
56
+ #
57
+ # @return [Gorgias::Configuration]
58
+ def configuration
59
+ @configuration ||= Configuration.new
60
+ end
61
+
62
+ # Resets the global configuration back to defaults.
63
+ def reset_configuration!
64
+ @configuration = Configuration.new
65
+ end
66
+
67
+ # Convenience constructor — equivalent to {Client.new}.
68
+ #
69
+ # @param options [Hash] See {Client#initialize}
70
+ # @return [Client]
71
+ def new(**options)
72
+ Client.new(**options)
73
+ end
74
+ end
75
+ end
@@ -0,0 +1,6 @@
1
+ module Gorgias
2
+ module Ruby
3
+ VERSION: String
4
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
5
+ end
6
+ end
metadata ADDED
@@ -0,0 +1,123 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gorgias-ruby
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Chayut Orapinpatipat
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2026-03-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: base64
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: faraday
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: faraday-multipart
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.0'
55
+ description: A professional-grade Ruby gem that wraps the Gorgias Public API, providing
56
+ resource-oriented access to tickets, customers, users, integrations, and more.
57
+ email:
58
+ - chayut_o@hotmail.com
59
+ executables: []
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - ".rspec"
64
+ - CHANGELOG.md
65
+ - CODE_OF_CONDUCT.md
66
+ - LICENSE.txt
67
+ - README.md
68
+ - Rakefile
69
+ - lib/gorgias.rb
70
+ - lib/gorgias/client.rb
71
+ - lib/gorgias/configuration.rb
72
+ - lib/gorgias/error.rb
73
+ - lib/gorgias/object.rb
74
+ - lib/gorgias/resources/account.rb
75
+ - lib/gorgias/resources/base.rb
76
+ - lib/gorgias/resources/customers.rb
77
+ - lib/gorgias/resources/events.rb
78
+ - lib/gorgias/resources/files.rb
79
+ - lib/gorgias/resources/integrations.rb
80
+ - lib/gorgias/resources/jobs.rb
81
+ - lib/gorgias/resources/macros.rb
82
+ - lib/gorgias/resources/rules.rb
83
+ - lib/gorgias/resources/satisfaction_surveys.rb
84
+ - lib/gorgias/resources/search.rb
85
+ - lib/gorgias/resources/statistics.rb
86
+ - lib/gorgias/resources/tags.rb
87
+ - lib/gorgias/resources/ticket_messages.rb
88
+ - lib/gorgias/resources/tickets.rb
89
+ - lib/gorgias/resources/users.rb
90
+ - lib/gorgias/resources/views.rb
91
+ - lib/gorgias/resources/widgets.rb
92
+ - lib/gorgias/ruby.rb
93
+ - lib/gorgias/ruby/version.rb
94
+ - lib/gorgias/version.rb
95
+ - sig/gorgias/ruby.rbs
96
+ homepage: https://github.com/Sentia/gorgias-ruby
97
+ licenses:
98
+ - MIT
99
+ metadata:
100
+ homepage_uri: https://github.com/Sentia/gorgias-ruby
101
+ changelog_uri: https://github.com/Sentia/gorgias-ruby/blob/main/CHANGELOG.md
102
+ bug_tracker_uri: https://github.com/Sentia/gorgias-ruby/issues
103
+ rubygems_mfa_required: 'true'
104
+ post_install_message:
105
+ rdoc_options: []
106
+ require_paths:
107
+ - lib
108
+ required_ruby_version: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: 3.1.0
113
+ required_rubygems_version: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ requirements: []
119
+ rubygems_version: 3.5.22
120
+ signing_key:
121
+ specification_version: 4
122
+ summary: Ruby client for the Gorgias REST API
123
+ test_files: []