megam_gogs 0.1.0 → 0.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7e37ef1937006bbf48a238650a66dbe79e54a0fb
4
- data.tar.gz: 25c5ff746fc72387568a3a4770d62188f0a845af
3
+ metadata.gz: e7e0025cdd7d1b01837b2d833a68979930972901
4
+ data.tar.gz: 1d5933d348d2807f6549ea025fe97f994d4b313e
5
5
  SHA512:
6
- metadata.gz: 7b766b05abce6555a3b30e1e9c270dcf3fa40edcc68f3276614f24e42938d3cb4b857a69987bdf9d8b79921e1286a4ad24ef0e510922fb8a2164cdc6ec88b47c
7
- data.tar.gz: 0880166220a67ef51004e8dd83392555f2413e65a7a0a30f1cbd9e25c02d9bfd20a424c6cd61d684a5441b10eeabc398236b2cd53b28bddaa822aadfb1d1dfed
6
+ metadata.gz: f216d2c53855c1f6ea6dde34345c152eb6f5a095a61ff6a8ee109a4f351c4adf2b78e45e88b38f96af4b6c6205e8caacaf6a6c6314acd77d960357e8de5e8ed9
7
+ data.tar.gz: a2267d1bc619dd147b3042ceed1bb90fb025f82c277af87c5f827689ab62352c20d8c115f61d05670e21510741f2ebd9e620585952e98bfe3be02c731cf7c5b6
data/lib/megam/gogs.rb CHANGED
@@ -75,30 +75,58 @@ def request(params,&block)
75
75
  text.msg("> #{pkey}: #{pvalue}")
76
76
  end
77
77
 
78
+ if params[:token].nil?
79
+
80
+
78
81
  @uname = params[:username]
79
82
  @pass = params[:password]
80
83
  @cred = "#{@uname}:#{@pass}"
81
- @tokens = params[:token]
82
84
  @final_cred64 = Base64.encode64(@cred)
85
+
83
86
  @final_hash = { :creds => "Basic #{@final_cred64}" }
84
- @final_token = {:token => "token #{@tokens}"}
85
- response = connection.request(dummy_params, &block)
86
- puts response.inspect
87
+
88
+ response = connection_repo.request(dummy_params, &block)
89
+
90
+ puts response.inspect
91
+ text.msg("END(#{(Time.now - start).to_s}s)")
92
+ # reset (non-persistent) connection
93
+ @connection_repo.reset
94
+
95
+ else
96
+
97
+ @tokens = params[:token]
98
+ @final_token = { :token => "token #{@tokens}"}
99
+ response = connection_token.request(dummy_params, &block)
100
+
101
+ puts response.inspect
87
102
  text.msg("END(#{(Time.now - start).to_s}s)")
88
103
  # reset (non-persistent) connection
89
- @connection.reset
104
+ @connection_token.reset
105
+
106
+
107
+
108
+
109
+ end
110
+
90
111
  response
91
112
 
92
113
  end
93
114
 
94
115
 
95
116
  #Make a lazy connection.
96
- def connection
117
+ def connection_repo
97
118
  @options[:path] =API_REST + @options[:path]
98
119
  #headers_hash = encode_header(@options)
99
120
 
100
- @options[:headers] = HEADERS.merge({ AUTH_PREFIX => @final_hash[:creds],
101
- AUTH_PREFIX => @final_token[:token]}).merge(@options[:headers])
121
+ @options[:headers] = HEADERS.merge({
122
+ AUTH_PREFIX => @final_hash[:creds],
123
+
124
+ }).merge(@options[:headers])
125
+
126
+
127
+
128
+ puts @options[:headers]
129
+ puts "UNAMUNAUNAMUNAMUNAMUNAM"
102
130
 
103
131
  text.msg("HTTP Request Data:")
104
132
  text.msg("> HTTP #{@options[:scheme]}://#{@options[:host]}")
@@ -115,6 +143,37 @@ def connection
115
143
  @connection
116
144
  end
117
145
 
146
+
147
+ def connection_token
148
+ @options[:path] =API_REST + @options[:path]
149
+ #headers_hash = encode_header(@options)
150
+
151
+ @options[:headers] = HEADERS.merge({
152
+ AUTH_PREFIX => @final_token[:token],
153
+
154
+ }).merge(@options[:headers])
155
+
156
+ puts @options[:headers]
157
+ puts "TESTESTESTESTSETESTSETESTESTESTES"
158
+
159
+ text.msg("HTTP Request Data:")
160
+ text.msg("> HTTP #{@options[:scheme]}://#{@options[:host]}")
161
+ @options.each do |key, value|
162
+ text.msg("> #{key}: #{value}")
163
+ end
164
+ text.msg("End HTTP Request Data.")
165
+ if @options[:scheme] == "https"
166
+ @connection = Excon.new("#{@options[:scheme]}://#{@options[:host]}",@options)
167
+ else
168
+ Excon.defaults[:ssl_verify_peer] = false
169
+ @connection = Excon.new("#{@options[:scheme]}://#{@options[:host]}:3000",@options)
170
+ end
171
+ @connection
172
+ end
173
+
174
+
175
+
176
+
118
177
  =begin
119
178
  def encode_header(cmd_parms)
120
179
 
@@ -1,5 +1,5 @@
1
1
  module Megam
2
2
  class Gogs
3
- VERSION = "0.1.0"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
data/test/test_repo.rb CHANGED
@@ -3,7 +3,7 @@ require 'nokogiri'
3
3
 
4
4
  class TestGogs < MiniTest::Unit::TestCase
5
5
  def test_getrepos
6
- token = 'f39f10eda64a14fe23a3ff2ad2afdb480162d379'
6
+ token = '4760a3130da97bf258d8be4d55ac8165ba7a3e55'
7
7
  response =megams.get_repos(token)
8
8
  assert_raises(ArgumentError)
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: megam_gogs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Raj Thilak,Kishorekumar Neelamegam, Thomas Alrin, Yeshwanth Kumar
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-09 00:00:00.000000000 Z
11
+ date: 2015-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: highline