File: wips.rb

package info (click to toggle)
ruby-behance 0.6.1-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 1,344 kB
  • sloc: ruby: 715; makefile: 4
file content (75 lines) | stat: -rw-r--r-- 2,479 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# Work-in-progress endpoints
module Behance
  class Client
    module Wips
      # Public: Search for works-in-progress.
      #
      # options - The Hash with options that the API would expect:
      #           :q    - Free text query string.
      #           :page - The page number of the results, always starting
      #                   with 1.
      #           :sort - The order the results are returned in.
      #                   Possible values: comments (default), views,
      #                   last_item_added_date.
      #           :time - Limits the search by time.
      #                   Possible values: all, today (default), week, month.
      #
      # Examples
      #
      #   @client.wips
      #   @client.wips(time: "today", page: 2)
      #
      # Returns a Hash of wips in JSON format.
      def wips(options={})
        request("wips", options)["wips"]
      end

      # Public: Get information about a work in progress.
      #
      # wip_id - The ID (Integer) of a wip.
      #
      # Examples
      #
      #   @client.wip(69)
      #
      # Returns a wip in JSON format.
      def wip(wip_id)
        request("wips/#{wip_id}")["wip"]
      end

      # Public: Get information and contents of a revision of a
      # work in progress.
      #
      # wip_id      - The ID (Integer) from the work in progress to look for.
      # revision_id - The ID (Integer) from the revision to look for.
      #
      # Examples
      #
      #   @client.wip_revision(69, 133)
      #
      # Returns a work-in-progress revision in JSON format.
      def wip_revision(wip_id, revision_id)
        request("wips/#{wip_id}/#{revision_id}")["revision"]
      end

      # Public: Get comments on a revision of a work in progress.
      #
      # wip_id      - The ID (Integer) from the work in progress
      #               to look for.
      # revision_id - The ID (Integer) from the revision to look
      #               for.
      # options     - The Hash with options that the API would expect:
      #              :page - The page number of the results, always starting
      #                      with 1.
      #
      # Examples
      #
      #   @client.wip_revision_comments(69, 133)
      #
      # Returns a work-in-progress revision comments in JSON format.
      def wip_revision_comments(wip_id, revision_id, options={})
        request("wips/#{wip_id}/#{revision_id}/comments", options)["comments"]
      end
    end
  end
end