wordpress-wxr 0.5.1 → 0.5.2
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/wordpress/wxr.rb +5 -0
- data/lib/wordpress/wxr/directory_listing.rb +104 -0
- data/lib/wordpress/wxr/directory_listings.rb +31 -0
- data/lib/wordpress/wxr/version.rb +1 -1
- data/wordpress-wxr.gemspec +1 -0
- metadata +19 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca849d840d5742c4224586ca255abcabccc5d68a
|
4
|
+
data.tar.gz: 008077700d75be02a58e6f65d9906d4700f13151
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f647aa4f3a5fb7b75dc362c26a4082df2311b20832e18943f3f0a6fcc937fd7b83e6210d82bdf75d12302fd558d700d9a355e7b571f697f4d5ece68963bf1b0
|
7
|
+
data.tar.gz: 8c210f3f26a04cec693c681591bd577e1574a48904c856858da1f36f93b16d2792576924ab761cc023370cf8f057b12c2c87c2d94bd774335e49cecaf84d8b23
|
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,104 @@
|
|
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').text
|
9
|
+
end
|
10
|
+
|
11
|
+
def directory_name
|
12
|
+
node.xpath("//wp:postmeta[wp:meta_key = 'directory_type']").at_xpath('wp:meta_value').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').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').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').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').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').text
|
45
|
+
end
|
46
|
+
|
47
|
+
def founder
|
48
|
+
node.xpath("//wp:postmeta[wp:meta_key = 'company_details_0_founder']").at_xpath('wp:meta_value').text
|
49
|
+
end
|
50
|
+
|
51
|
+
def ceo
|
52
|
+
node.xpath("//wp:postmeta[wp:meta_key = 'company_details_0_ceo']").at_xpath('wp:meta_value').text
|
53
|
+
end
|
54
|
+
|
55
|
+
def coo
|
56
|
+
node.xpath("//wp:postmeta[wp:meta_key = 'company_details_0_coo']").at_xpath('wp:meta_value').text
|
57
|
+
end
|
58
|
+
|
59
|
+
def cto
|
60
|
+
node.xpath("//wp:postmeta[wp:meta_key = 'company_details_0_cto']").at_xpath('wp:meta_value').text
|
61
|
+
end
|
62
|
+
|
63
|
+
def cfo
|
64
|
+
node.xpath("//wp:postmeta[wp:meta_key = 'company_details_0_cfo']").at_xpath('wp:meta_value').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').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').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').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').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').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').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').text
|
93
|
+
end
|
94
|
+
|
95
|
+
private
|
96
|
+
|
97
|
+
def unserialize(xml_field_name, key)
|
98
|
+
serialized_php = node.xpath("//wp:postmeta[wp:meta_key = '#{xml_field_name}']").at_xpath('wp:meta_value').text
|
99
|
+
unserialized_php = PHP.unserialize(serialized_php)
|
100
|
+
!!unserialized_php[key] && !unserialized_php[key].empty? ? unserialized_php[key] : ''
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
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
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.5.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ePublishing, inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-03-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
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: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
83
97
|
description:
|
84
98
|
email:
|
85
99
|
- development@ePublishing.com
|
@@ -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
|
@@ -134,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
134
150
|
version: '0'
|
135
151
|
requirements: []
|
136
152
|
rubyforge_project:
|
137
|
-
rubygems_version: 2.2.
|
153
|
+
rubygems_version: 2.2.3
|
138
154
|
signing_key:
|
139
155
|
specification_version: 4
|
140
156
|
summary: Parse a WordPress XML file into separate Ruby objects.
|