Class: Genderize::Io::Base
- Inherits:
-
Object
- Object
- Genderize::Io::Base
- Defined in:
- lib/genderize/io/base.rb
Direct Known Subclasses
Constant Summary collapse
- DEFAULT_HOST =
'https://api.genderize.io'
- HEADER_KEYS =
%w[ x_rate_limit_limit x_rate_limit_remaining x_rate_reset ].freeze
Instance Attribute Summary collapse
-
#country_id ⇒ Object
readonly
Returns the value of attribute country_id.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#language_id ⇒ Object
readonly
Returns the value of attribute language_id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name, host: DEFAULT_HOST, country_id: nil, language_id: nil) ⇒ Base
constructor
A new instance of Base.
- #url ⇒ Object
Constructor Details
#initialize(name, host: DEFAULT_HOST, country_id: nil, language_id: nil) ⇒ Base
Returns a new instance of Base.
17 18 19 20 21 22 23 |
# File 'lib/genderize/io/base.rb', line 17 def initialize(name, host: DEFAULT_HOST, country_id: nil, language_id: nil) @name = name @host = host @country_id = country_id @language_id = language_id @request = nil end |
Instance Attribute Details
#country_id ⇒ Object (readonly)
Returns the value of attribute country_id.
15 16 17 |
# File 'lib/genderize/io/base.rb', line 15 def country_id @country_id end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
15 16 17 |
# File 'lib/genderize/io/base.rb', line 15 def data @data end |
#host ⇒ Object (readonly)
Returns the value of attribute host.
15 16 17 |
# File 'lib/genderize/io/base.rb', line 15 def host @host end |
#language_id ⇒ Object (readonly)
Returns the value of attribute language_id.
15 16 17 |
# File 'lib/genderize/io/base.rb', line 15 def language_id @language_id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
15 16 17 |
# File 'lib/genderize/io/base.rb', line 15 def name @name end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
15 16 17 |
# File 'lib/genderize/io/base.rb', line 15 def request @request end |
Class Method Details
.determine(name, host: DEFAULT_HOST, country_id: nil, language_id: nil) ⇒ Object
25 26 27 28 29 |
# File 'lib/genderize/io/base.rb', line 25 def self.determine(name, host: DEFAULT_HOST, country_id: nil, language_id: nil) klass = new(name, host: host, country_id: country_id, language_id: language_id) klass.determine klass end |
Instance Method Details
#url ⇒ Object
31 32 33 34 |
# File 'lib/genderize/io/base.rb', line 31 def url connector = @host.include?('?') ? '&' : '?' "#{@host}#{connector}#{param_name}#{param_country_id}#{param_language_id}" end |