Class: Renshuu::Grammar
Overview
Model class for grammar entries.
Defined Under Namespace
Classes: Model
Instance Attribute Summary collapse
Class Method Summary
collapse
Methods included from Listable
#add_to_list, included, #remove_from_list
#add_to_schedule, included, #remove_from_schedule
Instance Attribute Details
#id ⇒ String
34
|
# File 'lib/renshuu/models/grammar.rb', line 34
attribute :id, Types::String
|
#meaning ⇒ Hash{String => String}
46
|
# File 'lib/renshuu/models/grammar.rb', line 46
attribute :meaning, Types::Hash.map(Types::String, Types::String)
|
#meaning_long ⇒ Hash{String => String}
50
|
# File 'lib/renshuu/models/grammar.rb', line 50
attribute :meaning_long, Types::Hash.map(Types::String, Types::String)
|
#models ⇒ Array<Model>
71
|
# File 'lib/renshuu/models/grammar.rb', line 71
attribute(:models, Types::Array.of(Model).default { [] })
|
80
|
# File 'lib/renshuu/models/grammar.rb', line 80
attribute? :presence, Presence
|
#title_english ⇒ String
38
|
# File 'lib/renshuu/models/grammar.rb', line 38
attribute :title_english, Types::String
|
#title_japanese ⇒ String
42
|
# File 'lib/renshuu/models/grammar.rb', line 42
attribute :title_japanese, Types::String
|
76
|
# File 'lib/renshuu/models/grammar.rb', line 76
attribute? :user_data, UserData
|
Class Method Details
Retrieves a grammar entry fom the dictionary.
27
28
29
|
# File 'lib/renshuu/models/grammar.rb', line 27
def self.get(id)
Renshuu.client.query(:get, "v1/grammar/#{id}").then { new(_1) }
end
|
.search(value) ⇒ Array<Grammar>
Searches the grammar dictionary.
16
17
18
19
|
# File 'lib/renshuu/models/grammar.rb', line 16
def self.search(value)
Renshuu.client.query(:get, 'v1/grammar/search', params: { value: })
.fetch(:grammar).map { new(_1) }
end
|