Sha256: 03051b703180b9514c62e46506b99dadc2c358d0e12209b6ad7d2b0ef7bcf28a

Contents?: true

Size: 899 Bytes

Versions: 2

Compression:

Stored size: 899 Bytes

Contents

require 'flattr/thing'

module Flattr
  class Client
    module Things

      def thing(id)
        thing = get("/rest/v2/things/#{id}")
        Flattr::Thing.new(thing)
      end

      def thing_new(url, opts = {})
        response = post("/rest/v2/things", opts.merge(:url => url))
        thing = get("/rest/v2/things/#{response[:id]}") 
        Flattr::Thing.new(thing)
      end

      def thing_update(id, opts = {})
        patch("/rest/v2/things/#{id}", opts)
        thing = get("/rest/v2/things/#{id}")
        Flattr::Thing.new(thing)
      end

      def thing_delete(id)
        thing = delete("/rest/v2/things/#{id}")
        true
      end

      def search(query = {})
        result = get("/rest/v2/things/search")
        result
      end

      def lookup(url)
        thing = get("/rest/v2/things/lookup/?q=#{url}")
        Flattr::Thing.new(thing)
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
flattr-0.2.2 lib/flattr/client/things.rb
flattr-0.2.1 lib/flattr/client/things.rb