Sha256: ea7d378e05ded60bc608955ae0393d49ed780a29b85ec4e731dc3f3748d1443f
Contents?: true
Size: 625 Bytes
Versions: 3
Compression:
Stored size: 625 Bytes
Contents
module Imuze class GetGenres < Struct.new(:global_options) require 'uri' require 'net/http' require 'json' def self.call(*args) new(*args).call end def call response = http.request(get_request) JSON.parse(response.read_body) end private def url @url ||= URI('http://joplin.imuze.io/genres') end def http @http ||= Net::HTTP.new(url.host, url.port) end def get_request request = Net::HTTP::Get.new(url) request['content-type'] = 'application/json' request['cache-control'] = 'no-cache' request end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
imuzer-0.0.4 | lib/imuze/get_genres.rb |
imuzer-0.0.3 | lib/imuze/get_genres.rb |
imuzer-0.0.2 | lib/imuze/get_genres.rb |