cubesmart 0.3.0 → 0.4.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: 3e26402813c2f507a7a4902766a26821194de2f1c9c2d31ef633b2138c45e2f5
4
- data.tar.gz: 91628c2ca652fc5be1788d4616652b82483863ab3b0bc3107cf7f3b9861cac51
3
+ metadata.gz: '04490c967861512d4d25fd09f917727d68f6d49f67b8c8c3c6c6cb35e49c0eec'
4
+ data.tar.gz: 35323ecbb630e3124f67aa1b424a7bf9c87e9d27a48a3790238c314548b1eadc
5
5
  SHA512:
6
- metadata.gz: e1f88ebc04f150dc9cbf0d590e01f05245be3a3a323d31526b6f5cdd6f445b38ad66c2cf7a0f77847ba20c62c364b58a1fd9db1bb87ee2fd8d610f0fc30f53cc
7
- data.tar.gz: 04f620cbfe554d8ecaeb77e363ad7a31c506a954c86deec4f6ad597af182c39c42340667f202fe9a7880740d4c4525c657368813d8a9bd6d6751aea8398db3ca
6
+ metadata.gz: a217dd096b6923431d7282a06fb581b87dc660d2b3c94ee778a6531c855390d314dd04846e649887b312e2da18a7f60418461bc7d74b7c91d0c2550102dff6e8
7
+ data.tar.gz: e50bda05ca0c0944682c1c759ffff34dd32042a9739d527f55de1d7d8826893d3dcfa5fd4ecd066893052bd7f1512617b3b6a02e99e404fdf81b2cc06e1dcc4e
@@ -22,6 +22,10 @@ module CubeSmart
22
22
  # @return [String]
23
23
  attr_accessor :id
24
24
 
25
+ # @attribute [rw] url
26
+ # @return [String]
27
+ attr_accessor :url
28
+
25
29
  # @attribute [rw] name
26
30
  # @return [String]
27
31
  attr_accessor :name
@@ -56,22 +60,23 @@ module CubeSmart
56
60
  # @return [Facility]
57
61
  def self.fetch(url:)
58
62
  document = Crawler.html(url:)
59
- parse(document:)
63
+ parse(url:, document:)
60
64
  end
61
65
 
66
+ # @param url [String]
62
67
  # @param document [Nokogiri::HTML::Document]
63
68
  #
64
69
  # @return [Facility]
65
- def self.parse(document:)
70
+ def self.parse(url:, document:)
66
71
  data = parse_json_ld(document:)
67
72
 
68
- id = data['url'].match(ID_REGEX)[:id]
73
+ id = ID_REGEX.match(url)[:id]
69
74
  name = data['name']
70
75
  address = Address.parse(data: data['address'])
71
76
  geocode = Geocode.parse(data: data['geo'])
72
77
  prices = document.css(PRICE_SELECTOR).map { |element| Price.parse(element: element) }
73
78
 
74
- new(id:, name:, address:, geocode:, prices:)
79
+ new(id:, url:, name:, address:, geocode:, prices:)
75
80
  end
76
81
 
77
82
  # @param document [Nokogiri::HTML::Document]
@@ -85,14 +90,16 @@ module CubeSmart
85
90
  end
86
91
 
87
92
  # @param id [String]
93
+ # @param url [String]
88
94
  # @param name [String]
89
95
  # @param address [Address]
90
96
  # @param geocode [Geocode]
91
97
  # @param phone [String]
92
98
  # @param email [String]
93
99
  # @param prices [Array<Price>]
94
- def initialize(id:, name:, address:, geocode:, phone: DEFAULT_PHONE, email: DEFAULT_EMAIL, prices: [])
100
+ def initialize(id:, url:, name:, address:, geocode:, phone: DEFAULT_PHONE, email: DEFAULT_EMAIL, prices: [])
95
101
  @id = id
102
+ @url = url
96
103
  @name = name
97
104
  @address = address
98
105
  @geocode = geocode
@@ -105,6 +112,7 @@ module CubeSmart
105
112
  def inspect
106
113
  props = [
107
114
  "id=#{@id.inspect}",
115
+ "url=#{@url.inspect}",
108
116
  "address=#{@address.inspect}",
109
117
  "geocode=#{@geocode.inspect}",
110
118
  "phone=#{@phone.inspect}",
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CubeSmart
4
- VERSION = '0.3.0'
4
+ VERSION = '0.4.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cubesmart
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Sylvestre