#4 add mobile_send() and mobile_token() for SMS registration and login - #69
Open
bibonix wants to merge 1 commit into
Open
#4 add mobile_send() and mobile_token() for SMS registration and login#69bibonix wants to merge 1 commit into
bibonix wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue #4 asks for a mobile API so SDK callers can register and log into WTS without driving the website. The WTS server exposes the corresponding endpoints at
GET /mobile/sendandGET /mobile/tokeninzold-io/wts.zold.iounderfront/front_login.rb: the first delivers a four-digit confirmation SMS to an E.164 phone number, the second exchanges that code for the<login>-<token>string the rest of the SDK expects inZold::WTS.new(key). Neither endpoint requires theX-Zold-WTSheader, so they cannot be reached through an instance that already needs a key.This change adds two class methods on
Zold::WTSmirroring those endpoints:mobile_send(phone)issues the registration request withnoredirect=trueand returns the short status text the server sends back, whilemobile_token(phone, code)posts the confirmation and returns the ready-to-use API token. Both run the response through the sameX-Zold-Errorand status-code checks the instance methods apply viaclean. The matchingZold::WTS::Fake.mobile_sendandZold::WTS::Fake.mobile_tokenkeep the in-memory gateway usable in downstream tests. Four new minitest cases stub the endpoints withwebmockand exercise both the real and the fake implementations offline.Locally on Ruby 3.3 with the project
Gemfile:bundle exec rake testruns 12 tests with 14 assertions, 0 failures, 0 errors, and 91.51% line coverage.bundle exec rubocop lib/zold/wts.rb test/zold/test_wts.rbreports the same 16 offences master carries on the same files, none of them introduced by this diff. Therakeworkflow stays red on this branch because the rubocop step crashes insiderubocop-rspec_rails inject_defaults!, which is the pre-existing failure tracked in #68 and reproduces on every master commit since 7c79029.Closes #4