Class: Wikidata::DataValues::CommonsMedia
- Inherits:
-
Value
- Object
- HashedObject
- Value
- Wikidata::DataValues::CommonsMedia
- Defined in:
- lib/wikidata/datavalues/commons_media.rb
Instance Attribute Summary
Attributes inherited from HashedObject
Instance Method Summary collapse
Methods inherited from Value
Methods inherited from HashedObject
Constructor Details
This class inherits a constructor from Wikidata::HashedObject
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Wikidata::HashedObject
Instance Method Details
#resolve! ⇒ Object
9 10 11 12 13 14 |
# File 'lib/wikidata/datavalues/commons_media.rb', line 9 def resolve! query = {image: data_hash.imagename, thumbwidth: 150} puts "Getting: #{query}".yellow if Wikidata.verbose? r = HTTParty.get('http://tools.wmflabs.org/magnus-toolserver/commonsapi.php', {query: query}) @data_hash = Hashie::Mash.new(r['response'].merge({imagename: data_hash.imagename})) end |
#to_s ⇒ Object
5 6 7 |
# File 'lib/wikidata/datavalues/commons_media.rb', line 5 def to_s data_hash.imagename end |