schwab_rb 0.9.0 → 0.9.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4886933bb9c99f66735ff9503b0904ac55a605e653550d413713c8d33e412a79
4
- data.tar.gz: d4f9476eeb6f97b00d890295e1edb6002c0780f4c34eb1b321d2355d55853e6a
3
+ metadata.gz: 04505f39521ec9ea419c4a0a0a90000758ecd2b2ee112fb49f0a3557004b3d21
4
+ data.tar.gz: 8fbdaf07886c79942573a3e1b3249a6be66ae7c3fdc6b9be23161d50c450f0df
5
5
  SHA512:
6
- metadata.gz: 7998b7bbbfac20de7e62b3dc2ccc6472be8a19b2956f2a2f93c1fbd441c0ff0e5713004f27cc96b6b27286aead9457a16aca4d92a62411ea1a662a6f67d9f49f
7
- data.tar.gz: e911c3bf6958b4dc0858669e0f38795466a4abf6d202805f6f12fa19ec6a991b1819b8743c682b89e12908595cb856ca8a15bea4b1011a4d6549f9a4a40feb6b
6
+ metadata.gz: 21580fbeb51a9d336dd0913eeb51048fb718c02c79f63dbd509fa3a02262e531ad012cd6ac0a9f05f0eacf7ac3c7f34d6f4404ddbf24b52c4bb5fcfdb8eef4bf
7
+ data.tar.gz: 30277381c65d9ffaf180d3ef6e579c47f0b53fc12356652a0a982ea6a42acc8f26c5238ef819fe5b720fb079ca574254861bd5ac7a6c47aaafc7ed46245f6311
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ### Fixed
4
+ - CLI `login` no longer reads from `ARGF` at the browser prompt, which prevented `schwab_rb login` from opening the browser when command arguments were present
5
+ - `OptionExpirationChain` now accepts both string-keyed and symbol-keyed hashes, matching `BaseClient#get_option_expiration_chain`
6
+
3
7
  ### Added
4
8
  - CLI `sample` command for saving single-expiration option chain snapshots as CSV or JSON
5
9
  - `--root` option for filtering sampled contracts by option root and using that root in output filenames
@@ -70,6 +70,7 @@ module SchwabRb
70
70
  enforce_enums: false,
71
71
  callback_timeout: 300.0,
72
72
  interactive: true,
73
+ input: $stdin,
73
74
  requested_browser: nil
74
75
  )
75
76
  token_path = SchwabRb::PathSupport.expand_path(token_path)
@@ -130,7 +131,7 @@ module SchwabRb
130
131
 
131
132
  if interactive
132
133
  puts "Press ENTER to open the browser..."
133
- gets
134
+ input.gets
134
135
  end
135
136
 
136
137
  open_browser(requested_browser, auth_context.authorization_url)
@@ -12,8 +12,8 @@ module SchwabRb
12
12
  end
13
13
 
14
14
  def initialize(data)
15
- @expiration_list = data["expirationList"]&.map { |expiration_data| Expiration.new(expiration_data) } || []
16
- @status = data["status"]
15
+ @expiration_list = Array(fetch_value(data, "expirationList")).map { |expiration_data| Expiration.new(expiration_data) }
16
+ @status = fetch_value(data, "status")
17
17
  end
18
18
 
19
19
  def to_h
@@ -70,17 +70,25 @@ module SchwabRb
70
70
 
71
71
  include Enumerable
72
72
 
73
+ private
74
+
75
+ def fetch_value(data, key)
76
+ data[key] || data[key.to_sym]
77
+ end
78
+
79
+ public
80
+
73
81
  class Expiration
74
82
  attr_reader :expiration_date, :days_to_expiration, :expiration_type,
75
83
  :settlement_type, :option_roots, :standard
76
84
 
77
85
  def initialize(data)
78
- @expiration_date = data["expirationDate"]
79
- @days_to_expiration = data["daysToExpiration"]
80
- @expiration_type = data["expirationType"]
81
- @settlement_type = data["settlementType"]
82
- @option_roots = data["optionRoots"]
83
- @standard = data["standard"]
86
+ @expiration_date = fetch_value(data, "expirationDate")
87
+ @days_to_expiration = fetch_value(data, "daysToExpiration")
88
+ @expiration_type = fetch_value(data, "expirationType")
89
+ @settlement_type = fetch_value(data, "settlementType")
90
+ @option_roots = fetch_value(data, "optionRoots")
91
+ @standard = fetch_value(data, "standard")
84
92
  end
85
93
 
86
94
  def to_h
@@ -129,6 +137,12 @@ module SchwabRb
129
137
  def expires_tomorrow?
130
138
  @days_to_expiration == 1
131
139
  end
140
+
141
+ private
142
+
143
+ def fetch_value(data, key)
144
+ data[key] || data[key.to_sym]
145
+ end
132
146
  end
133
147
  end
134
148
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SchwabRb
4
- VERSION = "0.9.0"
4
+ VERSION = "0.9.2"
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: schwab_rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joseph Platta
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2026-04-10 00:00:00.000000000 Z
10
+ date: 2026-04-13 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: async