Class: Send
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- Send
- Defined in:
- lib/schemas.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.from_dynamic!(d) ⇒ Object
3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 |
# File 'lib/schemas.rb', line 3284 def self.from_dynamic!(d) d = Types::Hash[d] new( access_count: d.fetch("accessCount"), access_id: d["accessId"], deletion_date: d.fetch("deletionDate"), disabled: d.fetch("disabled"), expiration_date: d["expirationDate"], file: d["file"] ? SendFile.from_dynamic!(d["file"]) : nil, hide_email: d.fetch("hideEmail"), id: d["id"], key: d.fetch("key"), max_access_count: d["maxAccessCount"], send_name: d.fetch("name"), notes: d["notes"], password: d["password"], revision_date: d.fetch("revisionDate"), text: d["text"] ? SendText.from_dynamic!(d["text"]) : nil, send_type: d.fetch("type"), ) end |
.from_json!(json) ⇒ Object
3306 3307 3308 |
# File 'lib/schemas.rb', line 3306 def self.from_json!(json) from_dynamic!(JSON.parse(json)) end |
Instance Method Details
#to_dynamic ⇒ Object
3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 |
# File 'lib/schemas.rb', line 3310 def to_dynamic { "accessCount" => access_count, "accessId" => access_id, "deletionDate" => deletion_date, "disabled" => disabled, "expirationDate" => expiration_date, "file" => file&.to_dynamic, "hideEmail" => hide_email, "id" => id, "key" => key, "maxAccessCount" => max_access_count, "name" => send_name, "notes" => notes, "password" => password, "revisionDate" => revision_date, "text" => text&.to_dynamic, "type" => send_type, } end |
#to_json(options = nil) ⇒ Object
3331 3332 3333 |
# File 'lib/schemas.rb', line 3331 def to_json( = nil) JSON.generate(to_dynamic, ) end |