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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: d789fee50053028836cd4a32424944eb403baa41cbdf9610d062446f3b7ba2d0
4
+ data.tar.gz: c58c53b9c328bb99b3de767a040528ac438aed475a946fffae2e3896426c5c48
5
+ SHA512:
6
+ metadata.gz: 474da205ffa683947c0f5d2e4b8fac301a914bd6012e8a7ee4a86e2c9ed9d477af957f4b640a84ad97af462b50423e5857709d1f6c3043090c7475946e411d9b
7
+ data.tar.gz: 6ebb982d8e7b8e07e8a75aa9b64e6a13e422f9264986b6656a290a282689d0a19fe7e040c1b791b7143f6a77684ba65709d89a651445983d175a334728df5976
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/CHANGELOG.md ADDED
@@ -0,0 +1,16 @@
1
+ # Changelog
2
+
3
+ ## [0.1.0] - 2026-03-10
4
+
5
+ ### Added
6
+
7
+ - Initial release of `gorgias-ruby`
8
+ - `Gorgias::Client` with support for global and per-instance configuration
9
+ - Resource classes for all major Gorgias API endpoints:
10
+ - Account, Customers, Events, Files, Integrations, Jobs, Macros, Rules
11
+ - Satisfaction Surveys, Search, Statistics, Tags, Tickets, Ticket Messages
12
+ - Users, Views, Widgets
13
+ - `Gorgias::Object` for method-style and hash-style attribute access on API responses
14
+ - Full error hierarchy (`APIError`, `AuthenticationError`, `NotFoundError`, `RateLimitError`, etc.)
15
+ - Basic auth via domain + username + API key
16
+ - Multipart file upload support via `faraday-multipart`
@@ -0,0 +1,132 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, caste, color, religion, or sexual
10
+ identity and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the overall
26
+ community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or advances of
31
+ any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email address,
35
+ without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official email address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at
63
+ [INSERT CONTACT METHOD].
64
+ All complaints will be reviewed and investigated promptly and fairly.
65
+
66
+ All community leaders are obligated to respect the privacy and security of the
67
+ reporter of any incident.
68
+
69
+ ## Enforcement Guidelines
70
+
71
+ Community leaders will follow these Community Impact Guidelines in determining
72
+ the consequences for any action they deem in violation of this Code of Conduct:
73
+
74
+ ### 1. Correction
75
+
76
+ **Community Impact**: Use of inappropriate language or other behavior deemed
77
+ unprofessional or unwelcome in the community.
78
+
79
+ **Consequence**: A private, written warning from community leaders, providing
80
+ clarity around the nature of the violation and an explanation of why the
81
+ behavior was inappropriate. A public apology may be requested.
82
+
83
+ ### 2. Warning
84
+
85
+ **Community Impact**: A violation through a single incident or series of
86
+ actions.
87
+
88
+ **Consequence**: A warning with consequences for continued behavior. No
89
+ interaction with the people involved, including unsolicited interaction with
90
+ those enforcing the Code of Conduct, for a specified period of time. This
91
+ includes avoiding interactions in community spaces as well as external channels
92
+ like social media. Violating these terms may lead to a temporary or permanent
93
+ ban.
94
+
95
+ ### 3. Temporary Ban
96
+
97
+ **Community Impact**: A serious violation of community standards, including
98
+ sustained inappropriate behavior.
99
+
100
+ **Consequence**: A temporary ban from any sort of interaction or public
101
+ communication with the community for a specified period of time. No public or
102
+ private interaction with the people involved, including unsolicited interaction
103
+ with those enforcing the Code of Conduct, is allowed during this period.
104
+ Violating these terms may lead to a permanent ban.
105
+
106
+ ### 4. Permanent Ban
107
+
108
+ **Community Impact**: Demonstrating a pattern of violation of community
109
+ standards, including sustained inappropriate behavior, harassment of an
110
+ individual, or aggression toward or disparagement of classes of individuals.
111
+
112
+ **Consequence**: A permanent ban from any sort of public interaction within the
113
+ community.
114
+
115
+ ## Attribution
116
+
117
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
+ version 2.1, available at
119
+ [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
120
+
121
+ Community Impact Guidelines were inspired by
122
+ [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
123
+
124
+ For answers to common questions about this code of conduct, see the FAQ at
125
+ [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
126
+ [https://www.contributor-covenant.org/translations][translations].
127
+
128
+ [homepage]: https://www.contributor-covenant.org
129
+ [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
130
+ [Mozilla CoC]: https://github.com/mozilla/diversity
131
+ [FAQ]: https://www.contributor-covenant.org/faq
132
+ [translations]: https://www.contributor-covenant.org/translations
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2026 Chayut Orapinpatipat
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
13
+ all 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
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,256 @@
1
+ # gorgias-ruby
2
+
3
+ A professional-grade Ruby client for the [Gorgias REST API](https://developers.gorgias.com/).
4
+
5
+ [![Gem Version](https://badge.fury.io/rb/gorgias-ruby.svg)](https://rubygems.org/gems/gorgias-ruby)
6
+ [![Source](https://img.shields.io/badge/source-GitHub-blue)](https://github.com/Sentia/gorgias-ruby)
7
+
8
+ ## Installation
9
+
10
+ Add to your `Gemfile`:
11
+
12
+ ```ruby
13
+ gem "gorgias-ruby"
14
+ ```
15
+
16
+ Or install directly:
17
+
18
+ ```bash
19
+ gem install gorgias-ruby
20
+ ```
21
+
22
+ ## Configuration
23
+
24
+ ### Global (recommended for Rails apps)
25
+
26
+ ```ruby
27
+ Gorgias.configure do |config|
28
+ config.domain = "mycompany" # your Gorgias subdomain
29
+ config.username = "me@mycompany.com" # agent email
30
+ config.api_key = ENV["GORGIAS_API_KEY"]
31
+ end
32
+
33
+ client = Gorgias.new # uses global config
34
+ ```
35
+
36
+ ### Per-client
37
+
38
+ ```ruby
39
+ client = Gorgias::Client.new(
40
+ domain: "mycompany",
41
+ username: "me@mycompany.com",
42
+ api_key: ENV["GORGIAS_API_KEY"]
43
+ )
44
+ ```
45
+
46
+ ### Optional settings
47
+
48
+ ```ruby
49
+ Gorgias.configure do |config|
50
+ config.timeout = 30 # read timeout in seconds (default: 30)
51
+ config.open_timeout = 10 # connection timeout in seconds (default: 10)
52
+ config.logger = Logger.new($stdout)
53
+ end
54
+ ```
55
+
56
+ ## Usage
57
+
58
+ All methods return `Gorgias::Object` instances (or arrays of them) that support
59
+ both method-style and hash-style attribute access.
60
+
61
+ ### Account
62
+
63
+ ```ruby
64
+ account = client.account.retrieve
65
+ account.domain # => "mycompany"
66
+ account.status.status # => "active"
67
+ ```
68
+
69
+ ### Tickets
70
+
71
+ ```ruby
72
+ tickets = client.tickets.list(status: "open", limit: 20)
73
+ ticket = client.tickets.retrieve(123)
74
+ ticket.subject # => "My order is late"
75
+
76
+ client.tickets.create(
77
+ subject: "Delivery issue",
78
+ channel: "email",
79
+ customer: { email: "john@example.com" },
80
+ messages: [{ body_text: "Hi, my package hasn't arrived.", from_agent: false }]
81
+ )
82
+
83
+ client.tickets.update(123, status: "closed")
84
+ client.tickets.close(123)
85
+ client.tickets.mark_as_spam(123)
86
+ client.tickets.delete(123)
87
+ ```
88
+
89
+ ### Ticket Messages
90
+
91
+ ```ruby
92
+ messages = client.ticket_messages.list(123)
93
+ message = client.ticket_messages.retrieve(123, 456)
94
+
95
+ client.ticket_messages.create(123, body_text: "Thanks!", from_agent: true, channel: "email")
96
+ client.ticket_messages.update(123, 456, body_text: "Updated reply")
97
+ client.ticket_messages.delete(123, 456)
98
+ ```
99
+
100
+ ### Customers
101
+
102
+ ```ruby
103
+ customers = client.customers.list(email: "john@example.com")
104
+ customer = client.customers.retrieve(3924)
105
+
106
+ client.customers.create(name: "John Smith", email: "john@example.com")
107
+ client.customers.update(3924, name: "John Doe")
108
+ client.customers.delete(3924)
109
+ client.customers.delete_many([3924, 3925])
110
+ ```
111
+
112
+ ### Users (Agents)
113
+
114
+ ```ruby
115
+ users = client.users.list
116
+ client.users.create(name: "Alice", email: "alice@mycompany.com", role: "agent")
117
+ client.users.update(7, name: "Alice B.")
118
+ client.users.delete(7)
119
+ ```
120
+
121
+ ### Tags
122
+
123
+ ```ruby
124
+ client.tags.list
125
+ client.tags.create(name: "billing")
126
+ client.tags.merge(3, target_id: 4)
127
+ client.tags.delete(3)
128
+ ```
129
+
130
+ ### Events
131
+
132
+ ```ruby
133
+ events = client.events.list(limit: 50)
134
+ event = client.events.retrieve(789)
135
+ event.event_type # => "ticket-created"
136
+ ```
137
+
138
+ ### Search
139
+
140
+ ```ruby
141
+ client.search.tickets(query: "refund order")
142
+ client.search.customers(query: "john smith")
143
+ client.search.ticket_messages(query: "damaged")
144
+ ```
145
+
146
+ ### Statistics
147
+
148
+ ```ruby
149
+ opts = { start_datetime: "2024-01-01T00:00:00Z", end_datetime: "2024-12-31T23:59:59Z" }
150
+
151
+ client.statistics.tickets(**opts)
152
+ client.statistics.customers(**opts)
153
+ client.statistics.customer_satisfaction(**opts)
154
+ ```
155
+
156
+ ### Views
157
+
158
+ ```ruby
159
+ client.views.list
160
+ client.views.export(10)
161
+ client.views.create(name: "Open VIP tickets", type: "ticket")
162
+ ```
163
+
164
+ ### Macros
165
+
166
+ ```ruby
167
+ client.macros.list
168
+ client.macros.create(name: "Refund approved", actions: [{ type: "assign-tag", value: "refunded" }])
169
+ ```
170
+
171
+ ### Rules
172
+
173
+ ```ruby
174
+ client.rules.list
175
+ rule = client.rules.retrieve(5)
176
+ client.rules.create(name: "Auto-tag VIP", conditions: [], actions: [])
177
+ client.rules.update(5, name: "Auto-tag VIP (updated)")
178
+ client.rules.delete(5)
179
+ ```
180
+
181
+ ### Integrations / Jobs / Satisfaction Surveys / Widgets
182
+
183
+ ```ruby
184
+ client.integrations.list
185
+ client.jobs.cancel(8)
186
+ client.satisfaction_surveys.accept(20, score: 5, body_text: "Great service!")
187
+ client.widgets.list
188
+ ```
189
+
190
+ ### File Uploads
191
+
192
+ ```ruby
193
+ files = client.files.upload(
194
+ "receipt.png" => File.open("/path/to/receipt.png", "rb"),
195
+ "invoice.pdf" => File.open("/path/to/invoice.pdf", "rb")
196
+ )
197
+ files.first.url # => "https://gorgias.io/attachments/receipt.png"
198
+ ```
199
+
200
+ ## Response objects
201
+
202
+ ```ruby
203
+ ticket = client.tickets.retrieve(1)
204
+
205
+ ticket.id # method access
206
+ ticket[:id] # hash-style access
207
+ ticket.customer # => #<Gorgias::Object ...> (nested)
208
+ ticket.customer.email # => "john@example.com"
209
+ ticket.tags # => [#<Gorgias::Object ...>, ...]
210
+ ticket.to_h # plain Hash
211
+ ```
212
+
213
+ ## Error handling
214
+
215
+ ```ruby
216
+ begin
217
+ client.tickets.retrieve(999)
218
+ rescue Gorgias::NotFoundError => e
219
+ e.http_status # => 404
220
+ rescue Gorgias::RateLimitError => e
221
+ e.retry_after # seconds until rate-limit resets
222
+ rescue Gorgias::UnprocessableEntityError => e
223
+ e.errors # => [{ "field" => "subject", ... }]
224
+ rescue Gorgias::AuthenticationError
225
+ # bad credentials
226
+ rescue Gorgias::APIError => e
227
+ # catch-all
228
+ end
229
+ ```
230
+
231
+ ### Error hierarchy
232
+
233
+ ```
234
+ Gorgias::Error
235
+ ├── Gorgias::ConfigurationError
236
+ └── Gorgias::APIError
237
+ ├── Gorgias::BadRequestError (400)
238
+ ├── Gorgias::AuthenticationError (401)
239
+ ├── Gorgias::AuthorizationError (403)
240
+ ├── Gorgias::NotFoundError (404)
241
+ ├── Gorgias::ConflictError (409)
242
+ ├── Gorgias::UnprocessableEntityError (422)
243
+ ├── Gorgias::RateLimitError (429)
244
+ └── Gorgias::ServerError (5xx)
245
+ ```
246
+
247
+ ## Development
248
+
249
+ ```bash
250
+ bundle install
251
+ bundle exec rspec
252
+ ```
253
+
254
+ ## License
255
+
256
+ MIT
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
@@ -0,0 +1,226 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "base64"
4
+ require "faraday"
5
+ require "faraday/multipart"
6
+ require "json"
7
+
8
+ module Gorgias
9
+ class Client
10
+ # @param options [Hash] Per-client overrides for any Configuration attribute.
11
+ # If not provided, falls back to values from Gorgias.configuration.
12
+ def initialize(**options)
13
+ @config = build_config(options)
14
+ @config.validate!
15
+ end
16
+
17
+ # ── Resource accessors ────────────────────────────────────────────────── #
18
+
19
+ def account
20
+ @account ||= Resources::Account.new(self)
21
+ end
22
+
23
+ def customers
24
+ @customers ||= Resources::Customers.new(self)
25
+ end
26
+
27
+ def events
28
+ @events ||= Resources::Events.new(self)
29
+ end
30
+
31
+ def files
32
+ @files ||= Resources::Files.new(self)
33
+ end
34
+
35
+ def integrations
36
+ @integrations ||= Resources::Integrations.new(self)
37
+ end
38
+
39
+ def jobs
40
+ @jobs ||= Resources::Jobs.new(self)
41
+ end
42
+
43
+ def macros
44
+ @macros ||= Resources::Macros.new(self)
45
+ end
46
+
47
+ def rules
48
+ @rules ||= Resources::Rules.new(self)
49
+ end
50
+
51
+ def satisfaction_surveys
52
+ @satisfaction_surveys ||= Resources::SatisfactionSurveys.new(self)
53
+ end
54
+
55
+ def search
56
+ @search ||= Resources::Search.new(self)
57
+ end
58
+
59
+ def statistics
60
+ @statistics ||= Resources::Statistics.new(self)
61
+ end
62
+
63
+ def tags
64
+ @tags ||= Resources::Tags.new(self)
65
+ end
66
+
67
+ def tickets
68
+ @tickets ||= Resources::Tickets.new(self)
69
+ end
70
+
71
+ def ticket_messages
72
+ @ticket_messages ||= Resources::TicketMessages.new(self)
73
+ end
74
+
75
+ def users
76
+ @users ||= Resources::Users.new(self)
77
+ end
78
+
79
+ def views
80
+ @views ||= Resources::Views.new(self)
81
+ end
82
+
83
+ def widgets
84
+ @widgets ||= Resources::Widgets.new(self)
85
+ end
86
+
87
+ # ── Low-level HTTP methods (used by Resource classes) ─────────────────── #
88
+
89
+ def get(path, params = {})
90
+ response = connection.get(path, compact(params))
91
+ handle_response(response)
92
+ end
93
+
94
+ def post(path, body = {}, headers: {})
95
+ response = connection.post(path) do |req|
96
+ if headers["Content-Type"] == "multipart/form-data"
97
+ # body is a Hash of label => IO — let Faraday::Multipart handle it
98
+ req.headers.merge!(headers)
99
+ req.body = body
100
+ else
101
+ req.headers["Content-Type"] = "application/json"
102
+ req.body = JSON.generate(body)
103
+ end
104
+ end
105
+ handle_response(response)
106
+ end
107
+
108
+ def put(path, body = {})
109
+ response = connection.put(path) do |req|
110
+ req.headers["Content-Type"] = "application/json"
111
+ req.body = JSON.generate(body)
112
+ end
113
+ handle_response(response)
114
+ end
115
+
116
+ def delete(path, body = nil)
117
+ response = connection.delete(path) do |req|
118
+ if body
119
+ req.headers["Content-Type"] = "application/json"
120
+ req.body = JSON.generate(body)
121
+ end
122
+ end
123
+ handle_response(response)
124
+ end
125
+
126
+ private
127
+
128
+ def connection
129
+ @connection ||= Faraday.new(url: @config.base_url) do |conn|
130
+ conn.request :multipart
131
+ conn.adapter Faraday.default_adapter
132
+
133
+ conn.options.timeout = @config.timeout
134
+ conn.options.open_timeout = @config.open_timeout
135
+
136
+ conn.headers["Authorization"] = basic_auth_header
137
+ conn.headers["User-Agent"] = "gorgias-ruby/#{Gorgias::VERSION} Ruby/#{RUBY_VERSION}"
138
+ conn.headers["Accept"] = "application/json"
139
+
140
+ if @config.logger
141
+ conn.response :logger, @config.logger, bodies: true
142
+ end
143
+ end
144
+ end
145
+
146
+ def handle_response(response)
147
+ body = parse_body(response)
148
+
149
+ case response.status
150
+ when 200, 201
151
+ coerce(body)
152
+ when 204
153
+ true
154
+ when 400
155
+ raise BadRequestError.new(
156
+ http_status: response.status, http_body: body, http_headers: response.headers
157
+ )
158
+ when 401
159
+ raise AuthenticationError.new(
160
+ http_status: response.status, http_body: body, http_headers: response.headers
161
+ )
162
+ when 403
163
+ raise AuthorizationError.new(
164
+ http_status: response.status, http_body: body, http_headers: response.headers
165
+ )
166
+ when 404
167
+ raise NotFoundError.new(
168
+ http_status: response.status, http_body: body, http_headers: response.headers
169
+ )
170
+ when 409
171
+ raise ConflictError.new(
172
+ http_status: response.status, http_body: body, http_headers: response.headers
173
+ )
174
+ when 422
175
+ raise UnprocessableEntityError.new(
176
+ http_status: response.status, http_body: body, http_headers: response.headers
177
+ )
178
+ when 429
179
+ raise RateLimitError.new(
180
+ http_status: response.status, http_body: body, http_headers: response.headers
181
+ )
182
+ when 500..599
183
+ raise ServerError.new(
184
+ http_status: response.status, http_body: body, http_headers: response.headers
185
+ )
186
+ else
187
+ raise APIError.new(
188
+ "Unexpected HTTP status #{response.status}",
189
+ http_status: response.status, http_body: body, http_headers: response.headers
190
+ )
191
+ end
192
+ end
193
+
194
+ def parse_body(response)
195
+ return nil if response.body.nil? || response.body.empty?
196
+
197
+ JSON.parse(response.body)
198
+ rescue JSON::ParserError
199
+ response.body
200
+ end
201
+
202
+ def coerce(data)
203
+ case data
204
+ when Array then data.map { |item| item.is_a?(Hash) ? Gorgias::Object.new(item) : item }
205
+ when Hash then Gorgias::Object.new(data)
206
+ else data
207
+ end
208
+ end
209
+
210
+ # Remove nil/blank values from query params so Faraday doesn't include them.
211
+ def compact(params)
212
+ params.reject { |_, v| v.nil? }
213
+ end
214
+
215
+ def basic_auth_header
216
+ encoded = Base64.strict_encode64("#{@config.username}:#{@config.api_key}")
217
+ "Basic #{encoded}"
218
+ end
219
+
220
+ def build_config(options)
221
+ config = Gorgias.configuration.dup
222
+ options.each { |key, value| config.public_send(:"#{key}=", value) }
223
+ config
224
+ end
225
+ end
226
+ end