Class: Card
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- Card
- Defined in:
- lib/schemas.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.from_dynamic!(d) ⇒ Object
2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 |
# File 'lib/schemas.rb', line 2686 def self.from_dynamic!(d) d = Types::Hash[d] new( brand: d["brand"], cardholder_name: d["cardholderName"], code: d["code"], exp_month: d["expMonth"], exp_year: d["expYear"], number: d["number"], ) end |
.from_json!(json) ⇒ Object
2698 2699 2700 |
# File 'lib/schemas.rb', line 2698 def self.from_json!(json) from_dynamic!(JSON.parse(json)) end |
Instance Method Details
#to_dynamic ⇒ Object
2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 |
# File 'lib/schemas.rb', line 2702 def to_dynamic { "brand" => brand, "cardholderName" => cardholder_name, "code" => code, "expMonth" => exp_month, "expYear" => exp_year, "number" => number, } end |
#to_json(options = nil) ⇒ Object
2713 2714 2715 |
# File 'lib/schemas.rb', line 2713 def to_json( = nil) JSON.generate(to_dynamic, ) end |