Sha256: 080b5fdda38f354e1262343a18e55101ca2d26fd3b3feaf376b64771873af1bf
Contents?: true
Size: 1.02 KB
Versions: 8
Compression:
Stored size: 1.02 KB
Contents
class Muddyit::Sites < Muddyit::Base # create a new sites object # not a muddyit:generic as it doesn't need the method missing loader # # Params : # # * muddyit (Required) # a muddyit::base instance # def initialize(muddyit) @muddyit = muddyit end # find a specific site # # Params # * type (Required) # one of :all or a site token # def find(type, options = {}) raise 'no type specified' unless type if type.is_a? Symbol case type when :all api_url = "/sites/" response = @muddyit.send_request(api_url, :get, options) sites = [] response.each { |site| sites.push Muddyit::Sites::Site.new(@muddyit, site['site']) } return sites else raise 'invalid type specified' end elsif type.is_a? String api_url = "/sites/#{type}" response = @muddyit.send_request(api_url, :get, options) return Muddyit::Sites::Site.new(@muddyit, response['site']) else raise 'invalid type specified' end end end
Version data entries
8 entries across 8 versions & 2 rubygems