SnoobyPlus 0.3 → 0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ {
2
+ "auth": {
3
+ },
4
+ "delay": 2
5
+ }
@@ -0,0 +1,32 @@
1
+ module Snooby
2
+
3
+ class Subreddit
4
+ include About, Posts, Comments, Compose
5
+
6
+ def initialize(name)
7
+ @name = name
8
+ @kind = 'subreddit'
9
+ end
10
+
11
+ def submit(title, content)
12
+ data = {:title => title, :sr => @name}
13
+ data[:kind] = content[/^https?:/] ? 'link' : 'self'
14
+ data[:"#{$& ? 'url' : 'text'}"] = content
15
+ Snooby.request Paths[:submit], data
16
+ end
17
+
18
+ # Alas, (un)subscribing by name alone doesn't work, so a separate call must
19
+ # be made to obtain the subreddit's id, thus the wait. Maybe cache this?
20
+ def subscribe(un = '')
21
+ sr = about['name']
22
+ Snooby.request Paths[:subscribe], :action => "#{un}sub", :sr => sr
23
+ end
24
+
25
+ def unsubscribe
26
+ subscribe 'un'
27
+ end
28
+
29
+ alias :sub :subscribe
30
+ alias :unsub :unsubscribe
31
+ end
32
+ end
data/lib/snoobyplus.rb CHANGED
@@ -6,7 +6,7 @@ CONFIG_FILE = '.snoobyplus/config.json'
6
6
  # Doesn't update if they already exist, but this might need to be fleshed out
7
7
  # a bit in future to merge values to be kept with new defaults in upgrades.
8
8
  unless File.exists? CONFIG_FILE
9
- puts "DataDir = #{$GEM_PATH}"
9
+ puts "DataDir = #{Gem.datadir('SnoobyPlus')}"
10
10
  DEFAULT_CONFIG = File.join((Gem.datadir('snoobyslus') ? Gem.datadir('snoobyplus') : RbConfig.datadir('snoobyplus')), 'config.json')
11
11
  %w[.snooby .snooby/cache].each { |dir| Dir.mkdir dir }
12
12
  File.open(CONFIG_FILE, 'w') { |file| file << File.read(DEFAULT_CONFIG) }
metadata CHANGED
@@ -1,53 +1,73 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: SnoobyPlus
3
- version: !ruby/object:Gem::Version
4
- version: '0.3'
3
+ version: !ruby/object:Gem::Version
4
+ hash: 3
5
5
  prerelease:
6
+ segments:
7
+ - 0
8
+ - 4
9
+ version: "0.4"
6
10
  platform: ruby
7
- authors:
11
+ authors:
8
12
  - King Bowser
9
13
  - andkerosine
10
14
  autorequire:
11
15
  bindir: bin
12
16
  cert_chain: []
13
- date: 2013-08-05 00:00:00.000000000 Z
17
+
18
+ date: 2013-08-05 00:00:00 Z
14
19
  dependencies: []
15
- description: All the features of Snooby, along with TopRisingNewControversial list
16
- grabbing.
20
+
21
+ description: All the features of Snooby, along with TopRisingNewControversial list grabbing.
17
22
  email: backseat.rapist@gmail.com
18
23
  executables: []
24
+
19
25
  extensions: []
26
+
20
27
  extra_rdoc_files: []
21
- files:
28
+
29
+ files:
22
30
  - lib/snoobyplus.rb
23
- - lib/snooby/actions.rb
24
- - lib/snooby/client.rb
25
31
  - lib/snooby/comment.rb
32
+ - lib/snooby/actions.rb
33
+ - lib/snooby/user.rb
26
34
  - lib/snooby/domain.rb
27
35
  - lib/snooby/post.rb
28
- - lib/snooby/user.rb
36
+ - lib/snooby/subreddit.rb
37
+ - lib/snooby/client.rb
38
+ - data/snooby/config.json
29
39
  homepage: https://github.com/KingBowser/snooby
30
40
  licenses: []
41
+
31
42
  post_install_message:
32
43
  rdoc_options: []
33
- require_paths:
44
+
45
+ require_paths:
34
46
  - lib
35
- required_ruby_version: !ruby/object:Gem::Requirement
47
+ required_ruby_version: !ruby/object:Gem::Requirement
36
48
  none: false
37
- requirements:
38
- - - ! '>='
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
- required_rubygems_version: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ hash: 3
53
+ segments:
54
+ - 0
55
+ version: "0"
56
+ required_rubygems_version: !ruby/object:Gem::Requirement
42
57
  none: false
43
- requirements:
44
- - - ! '>='
45
- - !ruby/object:Gem::Version
46
- version: '0'
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ hash: 3
62
+ segments:
63
+ - 0
64
+ version: "0"
47
65
  requirements: []
66
+
48
67
  rubyforge_project:
49
- rubygems_version: 1.8.25
68
+ rubygems_version: 1.8.15
50
69
  signing_key:
51
70
  specification_version: 3
52
71
  summary: All the features of Snooby, along with TopRisingNewControversial list grabbing.
53
72
  test_files: []
73
+