genderapi 1.0.3 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +84 -3
- data/lib/genderapi/client.rb +65 -1
- data/lib/genderapi/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 37dbdf8388b98f265d98ac47a00be36fffba6fd5c7b1580827caebfb7ad24f34
|
4
|
+
data.tar.gz: 2fb4c652c1e4c3deba6dd3e455d8d781c180f8a254d38b97590e549f27f1848d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 762244904c3ff5fa25f6a822d96f9c713c7864962a7e3e0ab2e37fe8d5783023e6a36b1d02e4b1fca258e93e176041cb4b01373795c9bcfae1fb38b24391875c
|
7
|
+
data.tar.gz: 86aaf648984d64cd832f3da1c9b0098705c3c2e9a0d061e122b9b41986cfcec3f37fbfaa065bfce8611348512f53d7ca8f5c0ecb57c969fac3e08cbe00072e69
|
data/README.md
CHANGED
@@ -44,7 +44,7 @@ result = api.get_gender_by_name(name: "Michael")
|
|
44
44
|
puts result
|
45
45
|
|
46
46
|
# With askToAI set to true
|
47
|
-
result = api.get_gender_by_name(name: "李雷",
|
47
|
+
result = api.get_gender_by_name(name: "李雷", ask_to_ai: true)
|
48
48
|
puts result
|
49
49
|
```
|
50
50
|
|
@@ -57,7 +57,7 @@ result = api.get_gender_by_email(email: "michael.smith@example.com")
|
|
57
57
|
puts result
|
58
58
|
|
59
59
|
# With askToAI set to true
|
60
|
-
result = api.get_gender_by_email(email: "michael.smith@example.com",
|
60
|
+
result = api.get_gender_by_email(email: "michael.smith@example.com", ask_to_ai: true)
|
61
61
|
puts result
|
62
62
|
```
|
63
63
|
|
@@ -70,7 +70,49 @@ result = api.get_gender_by_username(username: "michael_dev")
|
|
70
70
|
puts result
|
71
71
|
|
72
72
|
# With askToAI set to true
|
73
|
-
result = api.get_gender_by_username(username: "michael_dev",
|
73
|
+
result = api.get_gender_by_username(username: "michael_dev", ask_to_ai: true)
|
74
|
+
puts result
|
75
|
+
```
|
76
|
+
|
77
|
+
---
|
78
|
+
|
79
|
+
### 🔹 Get Gender by Name (Bulk)
|
80
|
+
|
81
|
+
```ruby
|
82
|
+
bulk_data = [
|
83
|
+
{ name: "Andrea", country: "DE", id: "123" },
|
84
|
+
{ name: "andrea", country: "IT", id: "456" }
|
85
|
+
]
|
86
|
+
|
87
|
+
result = api.get_gender_by_name_bulk(data: bulk_data)
|
88
|
+
puts result
|
89
|
+
```
|
90
|
+
|
91
|
+
---
|
92
|
+
|
93
|
+
### 🔹 Get Gender by Email (Bulk)
|
94
|
+
|
95
|
+
```ruby
|
96
|
+
bulk_data = [
|
97
|
+
{ email: "john@example.com", country: "US", id: "abc123" },
|
98
|
+
{ email: "maria@domain.de", country: "DE", id: "def456" }
|
99
|
+
]
|
100
|
+
|
101
|
+
result = api.get_gender_by_email_bulk(data: bulk_data)
|
102
|
+
puts result
|
103
|
+
```
|
104
|
+
|
105
|
+
---
|
106
|
+
|
107
|
+
### 🔹 Get Gender by Username (Bulk)
|
108
|
+
|
109
|
+
```ruby
|
110
|
+
bulk_data = [
|
111
|
+
{ username: "johnwhite", country: "US", id: "u001" },
|
112
|
+
{ username: "maria2025", country: "DE", id: "u002" }
|
113
|
+
]
|
114
|
+
|
115
|
+
result = api.get_gender_by_username_bulk(data: bulk_data)
|
74
116
|
puts result
|
75
117
|
```
|
76
118
|
|
@@ -114,6 +156,45 @@ All API methods accept parameters as keyword arguments. All fields are optional
|
|
114
156
|
|
115
157
|
---
|
116
158
|
|
159
|
+
### Name Lookup (Bulk)
|
160
|
+
|
161
|
+
| Parameter | Type | Required | Description |
|
162
|
+
|--------------------|----------|----------|-------------|
|
163
|
+
| data | Array<Hash> | Yes | Array of objects containing name, optional country, and optional id. Limit is 100 records per request. |
|
164
|
+
|
165
|
+
Each object in the data array may include:
|
166
|
+
- `name`: The name to analyze (required).
|
167
|
+
- `country`: Two-letter country code (optional).
|
168
|
+
- `id`: Custom identifier to correlate input/output (optional).
|
169
|
+
|
170
|
+
---
|
171
|
+
|
172
|
+
### Email Lookup (Bulk)
|
173
|
+
|
174
|
+
| Parameter | Type | Required | Description |
|
175
|
+
|--------------------|----------|----------|-------------|
|
176
|
+
| data | Array<Hash> | Yes | Array of objects containing email, optional country, and optional id. Limit is 50 records per request. |
|
177
|
+
|
178
|
+
Each object in the data array may include:
|
179
|
+
- `email`: The email address to analyze (required).
|
180
|
+
- `country`: Two-letter country code (optional).
|
181
|
+
- `id`: Custom identifier to correlate input/output (optional).
|
182
|
+
|
183
|
+
---
|
184
|
+
|
185
|
+
### Username Lookup (Bulk)
|
186
|
+
|
187
|
+
| Parameter | Type | Required | Description |
|
188
|
+
|--------------------|----------|----------|-------------|
|
189
|
+
| data | Array<Hash> | Yes | Array of objects containing username, optional country, and optional id. Limit is 50 records per request. |
|
190
|
+
|
191
|
+
Each object in the data array may include:
|
192
|
+
- `username`: The username to analyze (required).
|
193
|
+
- `country`: Two-letter country code (optional).
|
194
|
+
- `id`: Custom identifier to correlate input/output (optional).
|
195
|
+
|
196
|
+
---
|
197
|
+
|
117
198
|
## ✅ API Response
|
118
199
|
|
119
200
|
Example JSON response for all endpoints:
|
data/lib/genderapi/client.rb
CHANGED
@@ -97,6 +97,71 @@ module GenderAPI
|
|
97
97
|
_post_request("/api/username", payload)
|
98
98
|
end
|
99
99
|
|
100
|
+
##
|
101
|
+
# Bulk determine gender from multiple personal names.
|
102
|
+
#
|
103
|
+
# Allows sending up to 100 name records in a single request.
|
104
|
+
# Useful for high-volume batch processing where performance
|
105
|
+
# and cost efficiency are critical.
|
106
|
+
#
|
107
|
+
# Each name object can contain:
|
108
|
+
# - name [String] The personal name to analyze. (Required)
|
109
|
+
# - country [String, nil] Optional two-letter country code (e.g. "US").
|
110
|
+
# - id [String, Integer, nil] Optional custom identifier to correlate input and output.
|
111
|
+
#
|
112
|
+
# @param data [Array<Hash>] Array of name data hashes.
|
113
|
+
#
|
114
|
+
# @return [Hash] JSON response as a Ruby Hash.
|
115
|
+
#
|
116
|
+
def get_gender_by_name_bulk(data:)
|
117
|
+
payload = { data: data }
|
118
|
+
_post_request("/api/name/multi/country", payload)
|
119
|
+
end
|
120
|
+
|
121
|
+
##
|
122
|
+
# Bulk determine gender from multiple email addresses.
|
123
|
+
#
|
124
|
+
# Allows sending up to 50 email records in a single request.
|
125
|
+
# This method is designed for scenarios such as bulk database
|
126
|
+
# cleaning, analytics, or personalization tasks where email
|
127
|
+
# data is available and high throughput is required.
|
128
|
+
#
|
129
|
+
# Each email object can contain:
|
130
|
+
# - email [String] The email address to analyze. (Required)
|
131
|
+
# - country [String, nil] Optional two-letter country code (e.g. "US").
|
132
|
+
# - id [String, Integer, nil] Optional custom identifier to correlate input and output.
|
133
|
+
#
|
134
|
+
# @param data [Array<Hash>] Array of email data hashes.
|
135
|
+
#
|
136
|
+
# @return [Hash] JSON response as a Ruby Hash.
|
137
|
+
#
|
138
|
+
def get_gender_by_email_bulk(data:)
|
139
|
+
payload = { data: data }
|
140
|
+
_post_request("/api/email/multi/country", payload)
|
141
|
+
end
|
142
|
+
|
143
|
+
##
|
144
|
+
# Bulk determine gender from multiple social media usernames.
|
145
|
+
#
|
146
|
+
# Allows sending up to 50 username records in a single request.
|
147
|
+
# Useful for bulk social media analytics, profiling, or
|
148
|
+
# marketing segmentation tasks where usernames are the primary
|
149
|
+
# identifier and high performance is required.
|
150
|
+
#
|
151
|
+
# Each username object can contain:
|
152
|
+
# - username [String] The social media username to analyze. (Required)
|
153
|
+
# - country [String, nil] Optional two-letter country code (e.g. "US").
|
154
|
+
# - id [String, Integer, nil] Optional custom identifier to correlate input and output.
|
155
|
+
#
|
156
|
+
# @param data [Array<Hash>] Array of username data hashes.
|
157
|
+
#
|
158
|
+
# @return [Hash] JSON response as a Ruby Hash.
|
159
|
+
#
|
160
|
+
def get_gender_by_username_bulk(data:)
|
161
|
+
payload = { data: data }
|
162
|
+
_post_request("/api/username/multi/country", payload)
|
163
|
+
end
|
164
|
+
|
100
165
|
private
|
101
166
|
|
102
167
|
##
|
@@ -127,7 +192,6 @@ module GenderAPI
|
|
127
192
|
if [500, 502, 503, 504, 408].include?(response.code)
|
128
193
|
raise "GenderAPI Server Error or Timeout: HTTP #{response.code} - #{response.body}"
|
129
194
|
else
|
130
|
-
# Try parsing JSON response
|
131
195
|
begin
|
132
196
|
parse_json(response.body)
|
133
197
|
rescue JSON::ParserError
|
data/lib/genderapi/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: genderapi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Onur Ozturk
|
@@ -74,7 +74,7 @@ licenses:
|
|
74
74
|
metadata:
|
75
75
|
source_code_uri: https://github.com/GenderAPI/genderapi-ruby
|
76
76
|
changelog_uri: https://github.com/GenderAPI/genderapi-ruby/blob/main/CHANGELOG.md
|
77
|
-
documentation_uri: https://rubydoc.info/gems/genderapi
|
77
|
+
documentation_uri: https://rubydoc.info/gems/genderapi/1.0.4
|
78
78
|
post_install_message:
|
79
79
|
rdoc_options: []
|
80
80
|
require_paths:
|