Class: Bling::Config
- Inherits:
-
Object
- Object
- Bling::Config
- Defined in:
- lib/bling/config.rb
Instance Attribute Summary collapse
-
#api_key ⇒ String
The api key supplied by Bling service.
-
#api_url ⇒ String
readonly
The base API url.
Instance Method Summary collapse
-
#default_language ⇒ Symbol
The default language of API params.
-
#default_language=(language) ⇒ Object
The default language if set to english lib will translate to portuguese before actually make request.
-
#initialize ⇒ Config
constructor
A new instance of Config.
-
#response_format ⇒ Symbol
The response format from Bling, can be :xml or :json (default).
-
#response_format=(response_format) ⇒ Object
Set response format from Bling, can be :xml or :json (default).
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
4 5 6 7 |
# File 'lib/bling/config.rb', line 4 def initialize @api_url = 'https://bling.com.br/Api/v2/' @response_format = :json end |
Instance Attribute Details
#api_key ⇒ String
The api key supplied by Bling service.
12 13 14 |
# File 'lib/bling/config.rb', line 12 def api_key @api_key end |
#api_url ⇒ String (readonly)
The base API url
24 25 26 |
# File 'lib/bling/config.rb', line 24 def api_url @api_url end |
Instance Method Details
#default_language ⇒ Symbol
The default language of API params
45 46 47 |
# File 'lib/bling/config.rb', line 45 def default_language @default_language || :en end |
#default_language=(language) ⇒ Object
The default language if set to english lib will translate to portuguese before actually make request. Default to :en
37 38 39 40 |
# File 'lib/bling/config.rb', line 37 def default_language=(language) raise ArgumentError unless [:en, :pt].include?(language.to_sym) @default_language = language.to_sym end |
#response_format ⇒ Symbol
The response format from Bling, can be :xml or :json (default).
29 30 31 |
# File 'lib/bling/config.rb', line 29 def response_format @response_format || :json end |
#response_format=(response_format) ⇒ Object
Set response format from Bling, can be :xml or :json (default).
17 18 19 |
# File 'lib/bling/config.rb', line 17 def response_format=(response_format) @response_format = response_format.to_sym end |