Class: Scanii::Target
- Inherits:
-
Object
- Object
- Scanii::Target
- Defined in:
- lib/scanii/target.rb
Overview
Scanii regional API endpoints.
Pass one of the predefined regional constants (e.g. US1) to Client#initialize via the endpoint: keyword. The constructor also accepts an arbitrary URL String for testing against scanii-cli or other local mocks:
Scanii::Client.new(key: "k", secret: "s", endpoint: Scanii::Target::US1)
Scanii::Client.new(key: "k", secret: "s", endpoint: Scanii::Target.new("http://localhost:4000"))
Scanii::Target::AUTO (latency-based routing) is intentionally not provided —customer data residency / chain-of-custody compliance requires an explicit regional choice.
Constant Summary collapse
- US1 =
new("https://api-us1.scanii.com").freeze
- EU1 =
new("https://api-eu1.scanii.com").freeze
- EU2 =
new("https://api-eu2.scanii.com").freeze
- AP1 =
new("https://api-ap1.scanii.com").freeze
- AP2 =
new("https://api-ap2.scanii.com").freeze
- CA1 =
new("https://api-ca1.scanii.com").freeze
Instance Attribute Summary collapse
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(url) ⇒ Target
constructor
A new instance of Target.
-
#to_s ⇒ Object
Coerce to String (the base URL).
Constructor Details
#initialize(url) ⇒ Target
Returns a new instance of Target.
21 22 23 24 25 |
# File 'lib/scanii/target.rb', line 21 def initialize(url) raise ArgumentError, "Target URL must be a non-empty String" if url.nil? || url.to_s.empty? @url = url.to_s end |
Instance Attribute Details
#url ⇒ Object (readonly)
Returns the value of attribute url.
18 19 20 |
# File 'lib/scanii/target.rb', line 18 def url @url end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
33 34 35 |
# File 'lib/scanii/target.rb', line 33 def ==(other) other.is_a?(Target) && other.url == @url end |
#hash ⇒ Object
39 40 41 |
# File 'lib/scanii/target.rb', line 39 def hash @url.hash end |
#to_s ⇒ Object
Coerce to String (the base URL). Lets Scanii::Target instances be used interchangeably with String URLs in endpoint:.
29 30 31 |
# File 'lib/scanii/target.rb', line 29 def to_s @url end |