Change summary
lib/sim.rb | 4 ++--
lib/sim_repo.rb | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
Detailed changes
@@ -11,8 +11,8 @@ class SIM
notes String
end
- def self.extract(**kwargs)
- kwargs = kwargs.transform_keys(&:to_sym)
+ def self.extract(kwargs)
+ kwargs = kwargs&.transform_keys(&:to_sym) || {}
new(kwargs.slice(
:iccid, :lpa_code, :remaining_usage_kb, :remaining_days, :notes
))
@@ -20,7 +20,7 @@ class SIMRepo
"apiKey" => CONFIG[:keepgo][:api_key],
"accessToken" => CONFIG[:keepgo][:access_token]
}
- ).then { |req| SIM.extract(**JSON.parse(req.response)["sim_card"]) }
+ ).then { |req| SIM.extract(JSON.parse(req.response)&.dig("sim_card")) }
end
def owned_by(customer)