← ClaudeAtlas

ruby-modelslisted

Work with models from the PayPal Server SDK Ruby SDK. Load before building a request payload or mapping a response onto your own types. The class won't tell you how omitted and nil are told apart, which attribute names reach the wire, how a union is resolved, or what a model-free build gives you instead.
MuHamza30/paypal-api-plugin · ★ 0 · AI & Automation · score 70
Install: claude install-skill MuHamza30/paypal-api-plugin
# Working with models in an APIMatic Ruby SDK Models live in `lib/paypal_server_sdk/models/`, one class per model, each extending `PaypalServerSdk::BaseModel`. Most are plain data objects (covered in `ruby-calling-endpoints`); this skill covers the shapes that trip integrations up. ## Anatomy of a generated model Every model class declares the same members, and reading them answers most questions faster than guessing: | Member | What it tells you | | --- | --- | | `attr_accessor :{attribute}` | the Ruby attribute names, snake_cased from the spec | | `self.names` | the map from Ruby attribute name → **JSON wire name**. The two differ whenever the spec's name isn't snake_case | | `self.optionals` | which attributes may be omitted | | `self.nullables` | which attributes may be sent as JSON `null` | | `initialize` | the construction shape — see below | | `self.from_hash(hash)` | deserialization; the SDK calls it for you | | `to_hash` / `to_json` | serialization, inherited from `BaseModel` | | `to_s` / `inspect` | a readable dump of every attribute — the quickest way to see what you actually built | `initialize` comes in **one of two shapes, fixed when the SDK is generated**: positional arguments each with a default, or keyword arguments. **Open the model and read it** — do not copy the call style from another SDK: ```ruby # positional form PaypalServerSdk::{Model}.new({required_value}, {optional_value}) # keyword form PaypalServerSdk::{Model}.new({required_attr}: {required