Class: CAPTCHAResponse

Inherits:
Dry::Struct
  • Object
show all
Defined in:
lib/schemas.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_dynamic!(d) ⇒ Object



1735
1736
1737
1738
1739
1740
# File 'lib/schemas.rb', line 1735

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    site_key: d.fetch("siteKey"),
  )
end

.from_json!(json) ⇒ Object



1742
1743
1744
# File 'lib/schemas.rb', line 1742

def self.from_json!(json)
  from_dynamic!(JSON.parse(json))
end

Instance Method Details

#to_dynamicObject



1746
1747
1748
1749
1750
# File 'lib/schemas.rb', line 1746

def to_dynamic
  {
    "siteKey" => site_key,
  }
end

#to_json(options = nil) ⇒ Object



1752
1753
1754
# File 'lib/schemas.rb', line 1752

def to_json(options = nil)
  JSON.generate(to_dynamic, options)
end