piplrequest 0.0.6 → 0.0.7
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/lib/piplrequest.rb +23 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8fd3a935d8bb901be18fb00f750b4800e663eeb1
|
4
|
+
data.tar.gz: ffcdb99750ae841d6814ec7c2c0eb32a51170da7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fbf0aaf7b4692535ab1d39d260e3da51de6933a9289e59017a7f21ad90e367a76fb54c4f68dd0372f0321f902f7aa40db425fca1f5f1a6d30745a81d5c912e1f
|
7
|
+
data.tar.gz: 897f0af70c2031e7d48fb7067c7761f91c130b735754856cd787fc245be99230904a17e96f74b51cae6a5314f9c86167d48b8ce199c619b444fd22baa215b1c4
|
data/lib/piplrequest.rb
CHANGED
@@ -87,14 +87,30 @@ class PiplRequest
|
|
87
87
|
def gen_name(data_item)
|
88
88
|
return Pipl::Name.new(first: get_clean_name_content(data_item, :first),
|
89
89
|
last: get_clean_name_content(data_item, :last),
|
90
|
+
middle: get_clean_name_content(data_item, :middle),
|
90
91
|
raw: get_clean_name_content(data_item, :raw)
|
91
92
|
)
|
92
93
|
end
|
93
94
|
|
95
|
+
# Get the location
|
96
|
+
def gen_location(data_item)
|
97
|
+
city = get_field_content(data_item, :address, :city)
|
98
|
+
state = get_field_content(data_item, :address, :state)
|
99
|
+
country = get_field_content(data_item, :address, :country)
|
100
|
+
|
101
|
+
# Gen string for location
|
102
|
+
location_string = ""
|
103
|
+
location_string += city + ", "if city
|
104
|
+
location_string += state + ", " if state
|
105
|
+
location_string += country if country
|
106
|
+
|
107
|
+
location = geocode(location_string)
|
108
|
+
end
|
109
|
+
|
94
110
|
# Generate the URL
|
95
111
|
def gen_url(data_item)
|
96
|
-
|
97
|
-
|
112
|
+
url = get_field_content(data_item, :url, :url)
|
113
|
+
Pipl::Url.new(url: url, domain: @fields_to_use[:url][:domain]) if url
|
98
114
|
end
|
99
115
|
|
100
116
|
# Builds person model
|
@@ -102,20 +118,20 @@ class PiplRequest
|
|
102
118
|
# Initial gen and required fields
|
103
119
|
person = Pipl::Person.new
|
104
120
|
person.add_field(gen_name(data_item))
|
105
|
-
|
121
|
+
|
106
122
|
# Optional fields- only run if there
|
107
|
-
location =
|
123
|
+
location = gen_location(data_item)
|
108
124
|
person.add_field(location) if location
|
109
|
-
|
125
|
+
|
110
126
|
url = gen_url(data_item)
|
111
127
|
person.add_field(url) if url
|
112
|
-
|
128
|
+
|
113
129
|
return person
|
114
130
|
end
|
115
131
|
|
116
132
|
# Get content that should be put in field based on fields_to_use mapping
|
117
133
|
def get_field_content(data_item, field_category, field_name)
|
118
|
-
data_field = @fields_to_use[field_category][field_name]
|
134
|
+
data_field = @fields_to_use[field_category][field_name] if @fields_to_use[field_category]
|
119
135
|
|
120
136
|
# Merge multiple fields if provided
|
121
137
|
if data_field.is_a?(Array)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: piplrequest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- M. C. McGrath
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Gets data from Pipl
|
14
14
|
email: shidash@shidash.com
|