dbcoverflow 0.0.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 (4) hide show
  1. checksums.yaml +7 -0
  2. data/bin/dbcoverflow +4 -0
  3. data/lib/dbcoverflow.rb +25 -0
  4. metadata +61 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f09f5b2f87e8f0575fbc6d6017aa93d66ca14b24
4
+ data.tar.gz: 6da322884406eecf5e0022ee692999cfce547d4b
5
+ SHA512:
6
+ metadata.gz: 9e717c612c21f65307f6b29bdbfa184c44f8060cc9ec7c0f6c00330b98274d94412eac10f9d589647ae55b4bba3a3b4750fc66aed96b3aecc3b615586e9cb514
7
+ data.tar.gz: 4cf61a0d2529f62652d3c996fb1290905bed34796dba68c6d7d106abcff374955c543592f8322aee63a084058153e922e9d53743761a4cd0ce5835d470a77025
data/bin/dbcoverflow ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'dbcoverflow'
4
+ DBCOverflow.new(ARGV[0], ARGV[1]).new_question(ARGV[2], ARGV[3])
@@ -0,0 +1,25 @@
1
+ require 'httparty'
2
+
3
+ class DBCOverflow
4
+ include HTTParty
5
+
6
+ base_uri 'http://limitless-shelf-12376.herokuapp.com'
7
+
8
+ def initialize(u, p)
9
+ response = self.class.get('/')
10
+ response = self.class.post(
11
+ '/users',
12
+ :body => { :username => u, :password => p },
13
+ :headers => {'Cookie' => response.headers['Set-Cookie']}
14
+ )
15
+ @response = response
16
+ @cookie = response.request.options[:headers]['Cookie']
17
+ end
18
+
19
+ def new_question(title, content)
20
+ options = {:query => {:title => title, :content => content} }
21
+ options.merge!({:headers => {"Cookie" => @cookie, 'Content-Type' => 'application/x-www-form-urlencoded'}})
22
+ self.class.post('/questions', options)
23
+ end
24
+
25
+ end
metadata ADDED
@@ -0,0 +1,61 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dbcoverflow
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Andrew Lee
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-06-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: httparty
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: 0.13.7
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 0.13.7
27
+ description: A gem which can post new question to my Stack Overflow clone deployed
28
+ on Heroku.
29
+ email: adam7924adam@gmail.com
30
+ executables:
31
+ - dbcoverflow
32
+ extensions: []
33
+ extra_rdoc_files: []
34
+ files:
35
+ - bin/dbcoverflow
36
+ - lib/dbcoverflow.rb
37
+ homepage: http://rubygems.org/gems/dbcoverflow
38
+ licenses:
39
+ - MIT
40
+ metadata: {}
41
+ post_install_message:
42
+ rdoc_options: []
43
+ require_paths:
44
+ - lib
45
+ required_ruby_version: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ required_rubygems_version: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ requirements: []
56
+ rubyforge_project:
57
+ rubygems_version: 2.4.5.1
58
+ signing_key:
59
+ specification_version: 4
60
+ summary: DBC Overflow
61
+ test_files: []