Class: Tingee::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/tingee/configuration.rb

Overview

Injected credentials — set via Tingee.configure (e.g. from a Rails initializer); this layer never reads any credential store itself.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



10
11
12
# File 'lib/tingee/configuration.rb', line 10

def initialize
  @base_url = "https://open-api.tingee.vn"
end

Instance Attribute Details

#base_urlObject

shop_id: every VA this app creates is grouped under one Tingee shop (one shop per project). Optional: nil sends no shopId and Tingee auto-creates a throwaway shop per link.



8
9
10
# File 'lib/tingee/configuration.rb', line 8

def base_url
  @base_url
end

#client_idObject

shop_id: every VA this app creates is grouped under one Tingee shop (one shop per project). Optional: nil sends no shopId and Tingee auto-creates a throwaway shop per link.



8
9
10
# File 'lib/tingee/configuration.rb', line 8

def client_id
  @client_id
end

#secret_tokenObject

shop_id: every VA this app creates is grouped under one Tingee shop (one shop per project). Optional: nil sends no shopId and Tingee auto-creates a throwaway shop per link.



8
9
10
# File 'lib/tingee/configuration.rb', line 8

def secret_token
  @secret_token
end

#shop_idObject

shop_id: every VA this app creates is grouped under one Tingee shop (one shop per project). Optional: nil sends no shopId and Tingee auto-creates a throwaway shop per link.



8
9
10
# File 'lib/tingee/configuration.rb', line 8

def shop_id
  @shop_id
end

Instance Method Details

#validate!Object

Called when a client is built, not at load — a credential-less env still boots.

Raises:



15
16
17
18
19
# File 'lib/tingee/configuration.rb', line 15

def validate!
  return if client_id && secret_token

  raise Error.new("CONFIG", "Missing Tingee credentials (client_id, secret_token) — set them via Tingee.configure")
end