producthunt 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +15 -0
  2. data/lib/producthunt.rb +35 -0
  3. metadata +72 -0
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MTIxMzg5MmY2YjQzNmI0Y2Q0MjNjYmRjYWIyZDZhZTczZDIyNTFhYg==
5
+ data.tar.gz: !binary |-
6
+ MTgwOTVjNWUwMGRlNjRlYzMzMjliZWJkY2E4MTkyZDhiM2M2Yjg2ZA==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ MmIzMzU1ZjgxNGJkNWIxYjYwOTk1OWZlMzAxNjBmOTFjMjEzNzc1MDIyNmU3
10
+ N2RiNDEyMTgxYmE5YTNlMjIxYWNjNGE4ZDE3MzJhNjljNTk5NjlmMDZlNTNi
11
+ MmYxNjVmYTQyOGFhZGE2ODZjYWFlNGYxYjYyZjA2YjBjMTUyMzA=
12
+ data.tar.gz: !binary |-
13
+ Mjk1MWNmMjk2OTE0ZDc1ZjA5ZjA2N2IwYWUyOGYyNWE4YWRiZDRlNmJlNTNh
14
+ ZjU4OWNjZjU0NzQ1MmI5NmI5ODViMTQ2YWVhNTZlOTIwYWVjYTA1OWYxNTg2
15
+ YzJlNjE4ZTA5N2QyMDcxOTIxYWIwODc2MGI3ZWYwNWRjNTRiZDA=
@@ -0,0 +1,35 @@
1
+ module ProductHunt
2
+ class Post
3
+
4
+ require 'json'
5
+ require 'rest-client'
6
+
7
+ # Get today's products
8
+ #
9
+ # Example:
10
+ # >> posts = ProductHunt::Post.get_today
11
+ # >> puts posts.inspect
12
+ # => [{"title"=>"Wealthfront", "votes"=>10, "user"=>{"username"=>"hunterwalk", "name"=>"Hunter Walk"}, "rank"=>2, "tagline"=>"Automated, low cost investment service", "comment_count"=>"3", "permalink"=>"/posts/wealthfront", "url"=>"https://www.wealthfront.com/"}, ... ]
13
+ def self.get_today
14
+ url = "http://hook-api.herokuapp.com/today"
15
+ res = RestClient.get url
16
+ return JSON.parse(res)
17
+ end
18
+
19
+ # Get comments for any post
20
+ #
21
+ # Example:
22
+ # >> comments = ProductHunt::Post.get_comments("/posts/splashbase")
23
+ # >> puts comments
24
+ # => {"status"=>"success", "post"=>{"title"=>"Wealthfront", "votes"=>10, "user"=>{"username"=>"hunterwalk", "name"=>"Hunter Walk"}, "rank"=>1, "tagline"=>"Automated, low cost investment service", "comment_count"=>"3", "permalink"=>"/posts/wealthfront", "url"=>"https://www.wealthfront.com/"}, "comments"=>[{"index"=>1, "user"=>{"username"=>"hunterwalk", "name"=>"Hunter Walk"}, "timestamp"=>"6h ago", "comment"=>"\n \n CEO is the awesome @adamnash - maybe he'll leap in here and answer any questions\n ", "comment_html"=>"\n \n CEO is the awesome <a href=\"https://twitter.com/adamnash\">@adamnash</a> - maybe he'll leap in here and answer any questions\n "}, ...
25
+ #
26
+ # Arguments:
27
+ # permalink: (String)
28
+ def self.get_comments(permalink)
29
+ url = "http://hook-api.herokuapp.com#{permalink}"
30
+ res = RestClient.get url
31
+ return JSON.parse(res)
32
+ end
33
+
34
+ end
35
+ end
metadata ADDED
@@ -0,0 +1,72 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: producthunt
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - D
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-06-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: json
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: 1.8.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 1.8.1
27
+ - !ruby/object:Gem::Dependency
28
+ name: rest-client
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: 1.6.7
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: 1.6.7
41
+ description: ProductHunt gem for Hook ProductHunt REST API.
42
+ email: demo@rubygems.org
43
+ executables: []
44
+ extensions: []
45
+ extra_rdoc_files: []
46
+ files:
47
+ - lib/producthunt.rb
48
+ homepage: https://rubygems.org/gems/example
49
+ licenses:
50
+ - MIT
51
+ metadata: {}
52
+ post_install_message:
53
+ rdoc_options: []
54
+ require_paths:
55
+ - lib
56
+ required_ruby_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ! '>='
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ required_rubygems_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ requirements: []
67
+ rubyforge_project:
68
+ rubygems_version: 2.2.2
69
+ signing_key:
70
+ specification_version: 4
71
+ summary: ProductHunt gem for Hook ProductHunt REST API.
72
+ test_files: []