File: project.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 (74 lines) | stat: -rw-r--r-- 3,064 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
# Projects Endpoints.
module Behance
  class Client
    module Project
      # Public: Search for projects.
      #
      # options - The Hash with options that the API would expect:
      #           :q           - Free text query string.
      #           :sort        - The order the results are returned in.
      #                          Possible values: featured_date (default),
      #                          appreciations, views, comments, published_date.
      #           :time        - Limits the search by time.
      #                          Possible values: all (default), today, week,
      #                          month.
      #           :field       - Limits the search by creative field.
      #                          Accepts a URL-encoded field name from the list
      #                          of defined creative fields.
      #           :country     - Limits the search by a 2-letter FIPS country
      #                          code.
      #           :state       - Limits the search by state or province name.
      #           :city        - Limits the search by city name.
      #           :page        - The page number of the results, always starting
      #                          with 1.
      #           :tags        - Limits the search by tags. Accepts one tag name
      #                          or a pipe-separated list of tag names.
      #           :color_hex   - Limit results to an RGB hex value (without #)
      #           :color_range - How closely to match the requested color_hex,
      #                          in color shades (default: 20) [0-255]
      #           :license     - Filter by creative license.
      #                          Acronyms found here:
      #                          http://creativecommons.org/licenses/
      #
      # Examples
      #
      #   @client.projects
      #   @client.projects(q: "Freelance", state: "CA", field: "Branding")
      #
      # Returns an array of projects in JSON format.
      def projects(options={})
        request("projects", options)["projects"]
      end

      # Public: Get the information and content of a project.
      #
      # project_id - the ID (Integer) of the project.
      #
      # Examples
      #
      #   @client.project(1123)
      #
      # Returns a single project in JSON format.
      def project(project_id)
        request("projects/#{project_id}")["project"]
      end

      # Public: Get the comments for a project
      #
      # project_id - The ID (Integer) of the project.
      # options    - The Hash with options that the API would expect:
      #              :page - The page number of the results, always starting
      #                      with 1.
      #
      # Examples
      #
      #   @client.project_comments(1)
      #   @client.project_comments(1, page: 1)
      #
      # Returns an array of project comments in JSON format.
      def project_comments(project_id, options={})
        request("projects/#{project_id}/comments", options)["comments"]
      end
    end
  end
end