helenye-stripe ce8d7ca4cc
Add methods for dynamically referenced constants (#1327)
* Update dynamic constant references

* Manual additionsg

* Fix lint

* Use const_Get

* Remove puts
2024-02-09 17:15:39 -08:00

73 lines
2.2 KiB
Ruby

# File generated from our OpenAPI spec
# frozen_string_literal: true
module Stripe
module Terminal
# A Location represents a grouping of readers.
#
# Related guide: [Fleet management](https://stripe.com/docs/terminal/fleet/locations)
class Location < APIResource
extend Stripe::APIOperations::Create
include Stripe::APIOperations::Delete
extend Stripe::APIOperations::List
include Stripe::APIOperations::Save
OBJECT_NAME = "terminal.location"
def self.object_name
"terminal.location"
end
# Creates a new Location object.
# For further details, including which address fields are required in each country, see the [Manage locations](https://stripe.com/docs/terminal/fleet/locations) guide.
def self.create(params = {}, opts = {})
request_stripe_object(
method: :post,
path: "/v1/terminal/locations",
params: params,
opts: opts
)
end
# Deletes a Location object.
def self.delete(id, params = {}, opts = {})
request_stripe_object(
method: :delete,
path: format("/v1/terminal/locations/%<id>s", { id: CGI.escape(id) }),
params: params,
opts: opts
)
end
# Deletes a Location object.
def delete(params = {}, opts = {})
request_stripe_object(
method: :delete,
path: format("/v1/terminal/locations/%<location>s", { location: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Returns a list of Location objects.
def self.list(filters = {}, opts = {})
request_stripe_object(
method: :get,
path: "/v1/terminal/locations",
params: filters,
opts: opts
)
end
# Updates a Location object by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
def self.update(id, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/terminal/locations/%<id>s", { id: CGI.escape(id) }),
params: params,
opts: opts
)
end
end
end
end