Class: RandomOrgHttpApi::Generator
- Inherits:
-
Object
- Object
- RandomOrgHttpApi::Generator
show all
- Includes:
- Configuration
- Defined in:
- lib/random_org_http_api/generator.rb
Constant Summary
Configuration::DEFAULT_QUERY_PARAMS, Configuration::DOMAIN, Configuration::INTEGER_QUERY_KEYS, Configuration::INTEGER_QUERY_TEMPLATE, Configuration::SEQUENCE_QUERY_KEYS, Configuration::SEQUENCE_QUERY_TEMPLATE, Configuration::STRING_QUERY_KEYS, Configuration::STRING_QUERY_TEMPLATE
Instance Method Summary
collapse
Instance Method Details
#generate_integers(params = {}) ⇒ Object
6
7
8
9
|
# File 'lib/random_org_http_api/generator.rb', line 6
def generate_integers(params = {})
integers_query = query('integer', params)
request(DOMAIN, integers_query)
end
|
#generate_sequence(params = {}) ⇒ Object
16
17
18
19
|
# File 'lib/random_org_http_api/generator.rb', line 16
def generate_sequence(params = {})
sequence_query = query('sequence', params)
request(DOMAIN, sequence_query)
end
|
#generate_strings(params = {}) ⇒ Object
11
12
13
14
|
# File 'lib/random_org_http_api/generator.rb', line 11
def generate_strings(params = {})
strings_query = query('string', params)
request(DOMAIN, strings_query)
end
|
#quota ⇒ Object
22
23
24
25
|
# File 'lib/random_org_http_api/generator.rb', line 22
def quota
quota_query = "/quota/?ip=#{ip}&format=plain"
request(DOMAIN, quota_query).first.to_i
end
|