wordpress-wxr 0.5.1 → 0.73
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +4 -0
- data/lib/wordpress/wxr.rb +5 -0
- data/lib/wordpress/wxr/directory_listing.rb +109 -0
- data/lib/wordpress/wxr/directory_listings.rb +31 -0
- data/lib/wordpress/wxr/version.rb +1 -1
- data/wordpress-wxr.gemspec +2 -1
- metadata +27 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: cdda329bfca8cbec9f3907c67359e0bd1515da152a9991921b9f393b3a284e4f
|
4
|
+
data.tar.gz: b9c1c9ccf9a2b45db870a66a4d0faf715c4948afb08778f6bf247319cb9327cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 701d8d2e41aa0f476bbfb3992c3e34478df683edfa5214c0afb360977f0f7317298be44a04c3b9bbcefce08b95331ae1b0af7c3ff9596ec05915379fd5a9ee67
|
7
|
+
data.tar.gz: d7be5d074896b747b10bd84f1f735ea4a2525d1f17092cf2c91d04ac1a990fa3378d9f6f2010553ffb4afcf8195f0c4b09a99f7176f7b694c41d597c5e8a0010
|
data/README.md
CHANGED
data/lib/wordpress/wxr.rb
CHANGED
@@ -6,6 +6,7 @@ require 'wordpress/wxr/categories'
|
|
6
6
|
require 'wordpress/wxr/pages'
|
7
7
|
require 'wordpress/wxr/posts'
|
8
8
|
require 'wordpress/wxr/tags'
|
9
|
+
require 'wordpress/wxr/directory_listings'
|
9
10
|
require 'wordpress/wxr/version'
|
10
11
|
|
11
12
|
module Wordpress
|
@@ -46,5 +47,9 @@ module Wordpress
|
|
46
47
|
def tags
|
47
48
|
Tags.new(document, self)
|
48
49
|
end
|
50
|
+
|
51
|
+
def directory_listings
|
52
|
+
DirectoryListings.new(document, self)
|
53
|
+
end
|
49
54
|
end
|
50
55
|
end
|
@@ -0,0 +1,109 @@
|
|
1
|
+
require 'wordpress/wxr/item'
|
2
|
+
require 'php-serialize'
|
3
|
+
|
4
|
+
module Wordpress
|
5
|
+
class WXR
|
6
|
+
class DirectoryListing < Item
|
7
|
+
def content
|
8
|
+
node.xpath("wp:postmeta[wp:meta_key = 'company_details_0_company_bio']").at_xpath('wp:meta_value').try(:text)
|
9
|
+
end
|
10
|
+
|
11
|
+
def directory_name
|
12
|
+
node.xpath("wp:postmeta[wp:meta_key = 'directory_type']").at_xpath('wp:meta_value').try(:text)
|
13
|
+
end
|
14
|
+
|
15
|
+
def contact_name
|
16
|
+
node.xpath("wp:postmeta[wp:meta_key = 'contact_details_0_contact_name']").at_xpath('wp:meta_value').try(:text)
|
17
|
+
end
|
18
|
+
|
19
|
+
def contact_email
|
20
|
+
node.xpath("wp:postmeta[wp:meta_key = 'contact_details_0_email']").at_xpath('wp:meta_value').try(:text)
|
21
|
+
end
|
22
|
+
|
23
|
+
def contact_phone
|
24
|
+
node.xpath("wp:postmeta[wp:meta_key = 'contact_details_0_phone']").at_xpath('wp:meta_value').try(:text)
|
25
|
+
end
|
26
|
+
|
27
|
+
def country
|
28
|
+
unserialize('company_details_0_country_of_origin', 'country_name')
|
29
|
+
end
|
30
|
+
|
31
|
+
def state
|
32
|
+
unserialize('company_details_0_country_of_origin', 'state_name')
|
33
|
+
end
|
34
|
+
|
35
|
+
def city
|
36
|
+
unserialize('company_details_0_country_of_origin', 'city_name')
|
37
|
+
end
|
38
|
+
|
39
|
+
def website
|
40
|
+
node.xpath("wp:postmeta[wp:meta_key = 'company_details_0_company_website']").at_xpath('wp:meta_value').try(:text)
|
41
|
+
end
|
42
|
+
|
43
|
+
def years_established
|
44
|
+
node.xpath("wp:postmeta[wp:meta_key = 'company_details_0_number_of_years_established']").at_xpath('wp:meta_value').try(:text)
|
45
|
+
end
|
46
|
+
|
47
|
+
def founder
|
48
|
+
node.xpath("wp:postmeta[wp:meta_key = 'company_details_0_founder']").at_xpath('wp:meta_value').try(:text)
|
49
|
+
end
|
50
|
+
|
51
|
+
def ceo
|
52
|
+
node.xpath("wp:postmeta[wp:meta_key = 'company_details_0_ceo']").at_xpath('wp:meta_value').try(:text)
|
53
|
+
end
|
54
|
+
|
55
|
+
def coo
|
56
|
+
node.xpath("wp:postmeta[wp:meta_key = 'company_details_0_coo']").at_xpath('wp:meta_value').try(:text)
|
57
|
+
end
|
58
|
+
|
59
|
+
def cto
|
60
|
+
node.xpath("wp:postmeta[wp:meta_key = 'company_details_0_cto']").at_xpath('wp:meta_value').try(:text)
|
61
|
+
end
|
62
|
+
|
63
|
+
def cfo
|
64
|
+
node.xpath("wp:postmeta[wp:meta_key = 'company_details_0_cfo']").at_xpath('wp:meta_value').try(:text)
|
65
|
+
end
|
66
|
+
|
67
|
+
def annual_revenues
|
68
|
+
node.xpath("wp:postmeta[wp:meta_key = 'company_details_0_annual_revenues']").at_xpath('wp:meta_value').try(:text)
|
69
|
+
end
|
70
|
+
|
71
|
+
def market_segment
|
72
|
+
node.xpath("wp:postmeta[wp:meta_key = 'company_details_0_portal_market_segment']").at_xpath('wp:meta_value').try(:text)
|
73
|
+
end
|
74
|
+
|
75
|
+
def business_model
|
76
|
+
node.xpath("wp:postmeta[wp:meta_key = 'company_details_0_portal_business_model']").at_xpath('wp:meta_value').try(:text)
|
77
|
+
end
|
78
|
+
|
79
|
+
def market_coverage
|
80
|
+
node.xpath("wp:postmeta[wp:meta_key = 'company_details_0_portal_market_coverage']").at_xpath('wp:meta_value').try(:text)
|
81
|
+
end
|
82
|
+
|
83
|
+
def average_monthly_traffic
|
84
|
+
node.xpath("wp:postmeta[wp:meta_key = 'company_details_0_average_monthly_traffic']").at_xpath('wp:meta_value').try(:text)
|
85
|
+
end
|
86
|
+
|
87
|
+
def data_source
|
88
|
+
node.xpath("wp:postmeta[wp:meta_key = 'company_details_0_data_source']").at_xpath('wp:meta_value').try(:text)
|
89
|
+
end
|
90
|
+
|
91
|
+
def technology_platform
|
92
|
+
node.xpath("wp:postmeta[wp:meta_key = 'company_details_0_technology_platform']").at_xpath('wp:meta_value').try(:text)
|
93
|
+
end
|
94
|
+
|
95
|
+
private
|
96
|
+
|
97
|
+
def unserialize(xml_field_name, key)
|
98
|
+
return unless node.xpath("wp:postmeta[wp:meta_key = '#{xml_field_name}']").at_xpath('wp:meta_value')
|
99
|
+
serialized_php = node.xpath("wp:postmeta[wp:meta_key = '#{xml_field_name}']").at_xpath('wp:meta_value').text
|
100
|
+
begin
|
101
|
+
unserialized_php = PHP.unserialize(serialized_php)
|
102
|
+
!!unserialized_php[key] && !unserialized_php[key].empty? ? unserialized_php[key] : ''
|
103
|
+
rescue
|
104
|
+
''
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'wordpress/wxr/directory_listing'
|
2
|
+
|
3
|
+
module Wordpress
|
4
|
+
class WXR
|
5
|
+
class DirectoryListings
|
6
|
+
include Enumerable
|
7
|
+
|
8
|
+
attr_reader :document, :wxr
|
9
|
+
private :document, :wxr
|
10
|
+
|
11
|
+
def initialize(document, wxr)
|
12
|
+
@document = document
|
13
|
+
@wxr = wxr
|
14
|
+
end
|
15
|
+
|
16
|
+
def each
|
17
|
+
return enum_for(:each) unless block_given?
|
18
|
+
|
19
|
+
nodes.each do |node|
|
20
|
+
yield DirectoryListing.new(node, wxr)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def nodes
|
27
|
+
document.xpath("//item[wp:post_type = 'directory']")
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/wordpress-wxr.gemspec
CHANGED
@@ -22,6 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.add_development_dependency 'rake', '~> 10.0'
|
23
23
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
24
24
|
|
25
|
-
spec.add_runtime_dependency 'mail'
|
25
|
+
spec.add_runtime_dependency 'mail'
|
26
26
|
spec.add_runtime_dependency 'nokogiri'
|
27
|
+
spec.add_runtime_dependency 'php-serialize', '~> 1.2.0'
|
27
28
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wordpress-wxr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: '0.73'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ePublishing, inc.
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-10-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -56,16 +56,16 @@ dependencies:
|
|
56
56
|
name: mail
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: '0'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: nokogiri
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,7 +80,21 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
-
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: php-serialize
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 1.2.0
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 1.2.0
|
97
|
+
description:
|
84
98
|
email:
|
85
99
|
- development@ePublishing.com
|
86
100
|
executables: []
|
@@ -104,6 +118,8 @@ files:
|
|
104
118
|
- lib/wordpress/wxr/categories.rb
|
105
119
|
- lib/wordpress/wxr/category.rb
|
106
120
|
- lib/wordpress/wxr/comment.rb
|
121
|
+
- lib/wordpress/wxr/directory_listing.rb
|
122
|
+
- lib/wordpress/wxr/directory_listings.rb
|
107
123
|
- lib/wordpress/wxr/element.rb
|
108
124
|
- lib/wordpress/wxr/item.rb
|
109
125
|
- lib/wordpress/wxr/page.rb
|
@@ -118,7 +134,7 @@ homepage: https://bitbucket.org/epub_dev/wordpress-wxr
|
|
118
134
|
licenses:
|
119
135
|
- MIT
|
120
136
|
metadata: {}
|
121
|
-
post_install_message:
|
137
|
+
post_install_message:
|
122
138
|
rdoc_options: []
|
123
139
|
require_paths:
|
124
140
|
- lib
|
@@ -133,9 +149,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
133
149
|
- !ruby/object:Gem::Version
|
134
150
|
version: '0'
|
135
151
|
requirements: []
|
136
|
-
|
137
|
-
|
138
|
-
signing_key:
|
152
|
+
rubygems_version: 3.0.3
|
153
|
+
signing_key:
|
139
154
|
specification_version: 4
|
140
155
|
summary: Parse a WordPress XML file into separate Ruby objects.
|
141
156
|
test_files: []
|