How t-k/gmo-payment-ruby works
Project Overview
• Project Type: This is a Ruby client library (a gem) for interacting with the GMO Payment Platform.
• Purpose: The library abstracts various GMO Payment API endpoints (e.g., ShopAPI, SiteAPI, ShopAndSiteAPI, RemittanceAPI) so that developers can integrate payment processing and related functions easily into their Ruby applications.
Main Components
a. Core Library Components:
• GMO Module: At the top level, the “GMO” module encapsulates the overall functionality.
• API Classes: Individuals like Payment::ShopAPI, Payment::SiteAPI, Payment::ShopAndSiteAPI, and Payment::RemittanceAPI (found under lib/gmo/) that are responsible for different aspects of payment transactions.
• Common Utilities:
• lib/gmo/http_services.rb – handles HTTP requests to GMO servers.
• lib/gmo/json.rb – takes care of serialization/deserialization.
• lib/gmo/errors.rb – defines custom error handling.
• lib/gmo/const.rb – holds constants representing configuration values or API endpoints.
• lib/gmo/version.rb – handles versioning.
b. Testing and Quality Assurance Components:
• Spec Directory: Contains RSpec tests (e.g., spec/gmo/api_spec.rb, others) that validate behavior.
• Fixtures/VCR Cassettes: Recorded interactions with the GMO Payment API (stored in fixtures/vcr_cassettes) to simulate HTTP responses in tests.
• Autotest Scripts: Simple testing automation (e.g., autotest/discover.rb) to improve developer productivity.
• CI/CD Setup: The GitHub Actions workflow file .github/workflows/ruby.yml indicates that continuous integration is in place.
c. External Interaction Points:
Relationships & Interactions
• From the Client application (or library consumer) into the API classes (e.g., GMO::Payment::ShopAPI).
• From the API classes to the HTTP Services for making API calls.
• From the HTTP Services outward to the external GMO Payment Platform.
• Error handling flow from the HTTP response to GMO::Errors and then to the client.
• Test interactions: Show that during development/testing, the spec suite uses VCR fixtures to simulate these external interactions.