Class: SCB::API::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/scb/api/config.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize {|_self| ... } ⇒ Config

Returns a new instance of Config.

Yields:

  • (_self)

Yield Parameters:



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/scb/api/config.rb', line 11

def initialize
  @api_host    = 'api.scb.se'
  @api_name    = 'OV0104'
  @api_version = 'v1/doris'
  @language    = 'sv'
  @database    = 'ssd'
  @http_client = SCB::HTTP
  @json_parser = JSON

  yield self if block_given?
end

Instance Attribute Details

#api_hostObject

Returns the value of attribute api_host.



8
9
10
# File 'lib/scb/api/config.rb', line 8

def api_host
  @api_host
end

#api_nameObject

Returns the value of attribute api_name.



8
9
10
# File 'lib/scb/api/config.rb', line 8

def api_name
  @api_name
end

#api_versionObject

Returns the value of attribute api_version.



8
9
10
# File 'lib/scb/api/config.rb', line 8

def api_version
  @api_version
end

#databaseObject

Returns the value of attribute database.



8
9
10
# File 'lib/scb/api/config.rb', line 8

def database
  @database
end

#http_clientObject

Returns the value of attribute http_client.



8
9
10
# File 'lib/scb/api/config.rb', line 8

def http_client
  @http_client
end

#json_parserObject

Returns the value of attribute json_parser.



8
9
10
# File 'lib/scb/api/config.rb', line 8

def json_parser
  @json_parser
end

#languageObject

Returns the value of attribute language.



8
9
10
# File 'lib/scb/api/config.rb', line 8

def language
  @language
end

Class Method Details

.language(language) ⇒ Object



27
28
29
# File 'lib/scb/api/config.rb', line 27

def self.language(language)
  new { |c| c.language = language }
end

Instance Method Details

#base_urlObject



23
24
25
# File 'lib/scb/api/config.rb', line 23

def base_url
  "http://#{api_host}/#{api_name}/#{api_version}/#{language}/#{database}"
end