publicstorage 1.1.0 → 1.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f797ad8918b9cea8da35957e83b8bbf56ab02f1bfae95ee24a0fe1a316d1117d
4
- data.tar.gz: e2a976a36b0fc0d5edefde19c7234b778257341abc9c9507029bac2d6e31f1e3
3
+ metadata.gz: 24f5bb4366cb716cf259fb43e0df167617389a71bbcffa20c2e3534c588b06c1
4
+ data.tar.gz: 5b3be4bad58043fdfe30dee4067935bfc2346b778c967231155b670490a08d70
5
5
  SHA512:
6
- metadata.gz: eb338e5697de874ba118f47828d19ed3ed817cd136aac67372064fcea2dabde722c34cb39924b55e91bbbca3802b8469b7caf6a5fef5fa64abf559a2c2e38090
7
- data.tar.gz: 8ed743ff4a0a59deefe92064d62345d6deaaceb860e597583758b8e7d18eac6f0db6b12f67ef0324212882ef1fea14009501b2ab0566d139241ae4d78d60f7eb
6
+ metadata.gz: e117b9fa84c46cbae5a14756cb4f5926a6a1405a91be4963c112fbe2c22d71f8090a33df5ad4b7c9a9126c64c09b524caaa01a1e10c58975d98b5ee593f22a4e
7
+ data.tar.gz: 15e95167c0d18276093a62594d95c13b9d2be48276541045c3b683b14748fbe65f38d43e58aeb609e75c3dc98cd82dc688d54d8a22aeb7ebbc514d4dd5e90dbd
@@ -5,6 +5,9 @@ module PublicStorage
5
5
  class Facility
6
6
  SITEMAP_URL = 'https://www.publicstorage.com/sitemap_0-product.xml'
7
7
 
8
+ DEFAULT_PHONE = '1-800-742-8048'
9
+ DEFAULT_EMAIL = 'customerservice@publicstorage.com'
10
+
8
11
  PRICE_SELECTOR = '.units-results-section .unit-list-group .unit-list-item'
9
12
  LD_SELECTOR = 'script[type="application/ld+json"]'
10
13
 
@@ -14,10 +17,22 @@ module PublicStorage
14
17
  # @return [Integer]
15
18
  attr_accessor :id
16
19
 
20
+ # @attribute [rw] url
21
+ # @return [String]
22
+ attr_accessor :url
23
+
17
24
  # @attribute [rw] name
18
25
  # @return [String]
19
26
  attr_accessor :name
20
27
 
28
+ # @attribute [rw] phone
29
+ # @return [String]
30
+ attr_accessor :phone
31
+
32
+ # @attribute [rw] email
33
+ # @return [String]
34
+ attr_accessor :email
35
+
21
36
  # @attribute [rw] address
22
37
  # @return [Address]
23
38
  attr_accessor :address
@@ -40,13 +55,13 @@ module PublicStorage
40
55
  # @return [Facility]
41
56
  def self.fetch(url:)
42
57
  document = Crawler.html(url:)
43
- parse(document:)
58
+ parse(url:, document:)
44
59
  end
45
60
 
46
61
  # @param document [NokoGiri::XML::Document]
47
62
  #
48
63
  # @return [Facility]
49
- def self.parse(document:)
64
+ def self.parse(url:, document:)
50
65
  data = parse_ld(document:)
51
66
  id = Integer(data['url'].match(ID_REGEX)[:id])
52
67
  name = data['name']
@@ -55,7 +70,7 @@ module PublicStorage
55
70
 
56
71
  prices = document.css(PRICE_SELECTOR).map { |element| Price.parse(element:) }
57
72
 
58
- new(id:, name:, address:, geocode:, prices:)
73
+ new(id:, url:, name:, address:, geocode:, prices:)
59
74
  end
60
75
 
61
76
  # @param document [NokoGiri::XML::Document]
@@ -81,23 +96,31 @@ module PublicStorage
81
96
  end
82
97
 
83
98
  # @param id [String]
99
+ # @param url [String]
84
100
  # @param name [String]
85
101
  # @param address [Address]
86
102
  # @param geocode [Geocode]
87
103
  # @param prices [Array<Price>]
88
- def initialize(id:, name:, address:, geocode:, prices:)
104
+ def initialize(id:, url:, name:, address:, geocode:, phone: DEFAULT_PHONE, email: DEFAULT_EMAIL, prices: [])
89
105
  @id = id
106
+ @url = url
90
107
  @name = name
91
108
  @address = address
92
109
  @geocode = geocode
110
+ @phone = phone
111
+ @email = email
93
112
  @prices = prices
94
113
  end
95
114
 
96
115
  # @return [String]
97
116
  def inspect
98
117
  props = [
118
+ "id=#{@id.inspect}",
119
+ "url=#{@url.inspect}",
99
120
  "address=#{@address.inspect}",
100
121
  "geocode=#{@geocode.inspect}",
122
+ "phone=#{@phone.inspect}",
123
+ "email=#{@email.inspect}",
101
124
  "prices=#{@prices.inspect}"
102
125
  ]
103
126
  "#<#{self.class.name} #{props.join(' ')}>"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PublicStorage
4
- VERSION = '1.1.0'
4
+ VERSION = '1.2.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: publicstorage
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Sylvestre
@@ -100,8 +100,8 @@ licenses:
100
100
  metadata:
101
101
  rubygems_mfa_required: 'true'
102
102
  homepage_uri: https://github.com/ksylvest/publicstorage
103
- source_code_uri: https://github.com/ksylvest/publicstorage/tree/v1.1.0
104
- changelog_uri: https://github.com/ksylvest/publicstorage/releases/tag/v1.1.0
103
+ source_code_uri: https://github.com/ksylvest/publicstorage/tree/v1.2.0
104
+ changelog_uri: https://github.com/ksylvest/publicstorage/releases/tag/v1.2.0
105
105
  documentation_uri: https://publicstorage.ksylvest.com/
106
106
  post_install_message:
107
107
  rdoc_options: []