market_data 0.1.0 → 0.1.1

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: 90832f15badbd87495387f50f2a2912ff49bc877e20848a2b79e9841c8f02738
4
- data.tar.gz: f842fbc1b6f2f0d0c68fb3c761f451684f98b9fa3e8a95fd625d1697c0d89729
3
+ metadata.gz: 8a789c526a0c59a4986980a39f9069f1482f35b5b6b5a447e11ec65d3fae26bc
4
+ data.tar.gz: e4924d8db772dfd0e9eeaea07a5364550a93f2b2f59788254b4c7246defd80af
5
5
  SHA512:
6
- metadata.gz: 7836d423356d6252a3ced155dc1d0c68900a34211b0475bda6e1b974af436f570d2daf361c8574162bab17222bdf8f42663afa36cc144007dc5a5714a048a152
7
- data.tar.gz: e3d5f53b447845a4519cc447961e6ef2a2dc7f0e66bbee279cfe6b0b9458ec5235fb53143e80b6a3f2d3be9eb656df183db77c6fd61ad6bca5a3a4e1fd174ac4
6
+ metadata.gz: 923c8d9c20f0f240336a173bf72e31b1178ba4bc12917d9c82f661dfcb1dcb426516614d4ff777c49817de3534098e0425c2309a6e352d3fdb201e15c464eb7b
7
+ data.tar.gz: '01027894f69698156d2606d5f3c38ea582c1b14ef5899df51f7c8cfe06803bfa610532f45937a8fd931c73738c4e4cf1cb89c7eeb1732f520ec63bae78a9ccee'
data/CHANGELOG.md CHANGED
@@ -3,3 +3,8 @@
3
3
  ## [0.1.0] - 2024-09-11
4
4
 
5
5
  - Initial release
6
+
7
+ ## [0.1.1] - 2024-09-12
8
+
9
+ - Fix handling of snapshot parameter in bulk quotes method
10
+ - Rename fetch method to quote on Quote submodule. Quotes methods are no longer wrapped in parent module.
@@ -20,7 +20,7 @@ module MarketData
20
20
  end
21
21
  end
22
22
 
23
- def fetch(symbol, w52 = false)
23
+ def quote(symbol, w52 = false)
24
24
  path_hash = { host: MarketData.base_host, path: @@single + symbol }
25
25
  if w52
26
26
  path_hash[:query] = URI.encode_www_form({"52week" => true })
@@ -30,15 +30,18 @@ module MarketData
30
30
  end
31
31
 
32
32
  def bulk_quotes(symbols, snapshot = false)
33
- unless symbols.is_a?(Array) && symbols.size > 1
34
- raise BadParameterError.new("symbols must be a non-empty list")
35
- end
36
-
37
33
  path_hash = { host: MarketData.base_host, path: @@bulk }
38
- query_hash = { symbols: symbols.join(",") }
34
+ query_hash = {}
35
+
39
36
  if snapshot
40
37
  query_hash[:snapshot] = true
38
+ else
39
+ unless symbols.is_a?(Array) && symbols.size > 1
40
+ raise BadParameterError.new("symbols must be a non-empty list")
41
+ end
42
+ query_hash = { symbols: symbols.join(",") }
41
43
  end
44
+
42
45
  path_hash[:query] = URI.encode_www_form(query_hash)
43
46
 
44
47
  res = do_connect(get_uri path_hash)
@@ -48,7 +51,6 @@ module MarketData
48
51
  def self.map_quotes(quotes)
49
52
  h = Hash.new
50
53
  size = quotes[SYMBOL_RESPONSE_KEY].size
51
- p size
52
54
  for i in 0..(size - 1) do
53
55
  qquote = Quote.new(*quotes.except(STATUS_RESPONSE_KEY).values.map { |ar| ar[i] })
54
56
  h[quotes[SYMBOL_RESPONSE_KEY][i]] = !qquote.blank? ? qquote : nil
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MarketData
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
data/lib/market_data.rb CHANGED
@@ -13,10 +13,6 @@ module MarketData
13
13
  def initialize token
14
14
  @access_token = token
15
15
  end
16
-
17
- def quote(symbol)
18
- fetch(symbol)
19
- end
20
16
  end
21
17
 
22
18
  def self.base_host
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: market_data
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastián González
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-09-11 00:00:00.000000000 Z
11
+ date: 2024-09-12 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A Ruby client for the MarketData API.
14
14
  email: