book-value 0.0.3 → 0.0.4

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: ed291369351306ff8e17eba798235e353214752282ae1b9b48a5174366664ba6
4
- data.tar.gz: a34bf2c5abdd71e46237096ee49199619bf0f7c033c4a32b049f72d61b24cfe2
3
+ metadata.gz: 8b2d13c166936168c1b4042f0b14aee46decf8a62306bdf8f89034ca2ec3cc44
4
+ data.tar.gz: 76b81b257574bc634ea5f4ab171eceec490c53131e115e115dd95cda9c7a23c9
5
5
  SHA512:
6
- metadata.gz: e20a91c25c2975525f2f10cd29d07ce39832b9bd4569d812fc600fa77e43c05108c1523981a13e3e723459b42c0e349cdbf2d0f04994dd41ffc0efea3fa64b2b
7
- data.tar.gz: 017ad5d8a9757fd8433b154d5869162c271c2b43bb6c8457d2722d0cda76c2fe6f94f1c1a57eb4bf3bac146bd8eed8c4a1ffe20092ec4369e1561c8c7f2402c7
6
+ metadata.gz: 9ac3663a9f2c625a9b6ada1b4846b883165b533c0128e0988dda223263621333b6950d050681dea0e4712a741dcf7c550d4f7f77049cdd8273acea29c628bd17
7
+ data.tar.gz: e847aebdd63bfd45c68b1e9320391410741984e3f2c8f61d320143409719afde93b72bd0160dbf6826c417f2e6751fa8dd21f568a313325d853d59ec879a37bb
@@ -40,31 +40,32 @@ module BookValue
40
40
 
41
41
  # TODO: Fix model to try `-`
42
42
  def car_features(make, model)
43
+ checkbox_options = {}
44
+
43
45
  process_model(model) do |model_name|
44
46
  raw_page = authorise_and_send(http_method: :get, command: "calculate/#{make.downcase}/#{model_name}")
45
47
  next if raw_page == {}
46
48
 
47
49
  doc = Nokogiri::HTML(raw_page['body'])
48
50
 
49
- checkbox_options = {}
50
-
51
51
  doc.css(".list-group li div").each do |checkbox|
52
52
  input_of_child = checkbox.children.find { |child| child.name == 'input' }
53
53
  label_of_child = checkbox.children.find { |child| child.name == 'label' }
54
54
 
55
55
  checkbox_options[input_of_child[:name]] = label_of_child.children.first.to_s
56
56
  end
57
-
58
- return checkbox_options
59
57
  end
58
+
59
+ checkbox_options
60
60
  end
61
61
 
62
62
  # Features are just the list of features
63
63
  # condition_score is between 1-10, 10 is perfect, 1 is bad
64
64
  def get_book_value(make, model, features, mileage, year, condition_score = 10)
65
- process_model(model) do |model_name|
66
- feature_params = ""
65
+ output = ''
66
+ feature_params = ''
67
67
 
68
+ process_model(model) do |model_name|
68
69
  features.each do |feature_id|
69
70
  feature_params = "#{feature_params}#{feature_id}=on&"
70
71
  end
@@ -82,8 +83,11 @@ module BookValue
82
83
  book_value_page = HTTParty.post(book_value_url, body: "condition_score=#{condition_score}")
83
84
 
84
85
  doc = Nokogiri::HTML(book_value_page.body)
85
- return doc.at('h4').text
86
+
87
+ output = doc.at('h4').text
86
88
  end
89
+
90
+ output
87
91
  end
88
92
 
89
93
  private
@@ -1,3 +1,3 @@
1
1
  module BookValue
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: book-value
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - trex22