R3c 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +2 -0
- data/lib/r3c.rb +63 -0
- data/lib/r3c/r3c.rb +84 -0
- data/lib/r3c/version.rb +6 -0
- metadata +109 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0a4d10a11e19764968eb40ce20592e7ab72b422b
|
4
|
+
data.tar.gz: 60b7e01cde66d6506f2f0c22b5f2ab046dc00f1e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ead89d7d34aa79be805ab6d8f0f38ae7d9d316c7ff41d58ec4cd9c1484d0f7d4d39dd7598e0c0af7fd58396c03011d443a6d0bbb9c5e97ac1727e43085fd0c6b
|
7
|
+
data.tar.gz: 4a0e12b55ef45ef0ae5bc8f8fe1ed668146bb0e0cba1844f6aa4d819e0cab1cb77753ef1c5de4581d69ae66e5b49a2014ec8247c310ee487106ada0ffd64fd5f
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Paolo Freuli
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
data/lib/r3c.rb
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
require "r3c/r3c"
|
2
|
+
require "r3c/version"
|
3
|
+
|
4
|
+
|
5
|
+
module R3c
|
6
|
+
|
7
|
+
|
8
|
+
def self.upload(file)
|
9
|
+
require "rest-client"
|
10
|
+
require "json"
|
11
|
+
response = RestClient.post("#{R3c::BaseEntity.site}/uploads.json?key=#{R3c::BaseEntity.headers['X-Redmine-API-Key']}", file, {:multipart => true, :content_type => 'application/octet-stream'})
|
12
|
+
puts response.inspect.to_s
|
13
|
+
token = JSON.parse(response)['upload']['token']
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
def self.version
|
18
|
+
VERSION
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.site site
|
22
|
+
R3c::BaseEntity.set_site(site)
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.format format
|
26
|
+
R3c::BaseEntity.set_format(format)
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.auth auth
|
30
|
+
R3c::BaseEntity.auth auth
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def self.method_missing(m, *args, &block)
|
37
|
+
puts "Called method #{m} on R3c"
|
38
|
+
ref_class="R3c::#{self.camelize(m)}"
|
39
|
+
Object.const_get(ref_class)
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.camelize(m)
|
43
|
+
m.to_s.split('_').collect(&:capitalize).join
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
|
49
|
+
#~ R3c.site('http://localhost:3000/')
|
50
|
+
#~ R3c.format(:xml)
|
51
|
+
|
52
|
+
#~ R3c.auth({api: {key: '8091d55257c4c90b6d56e83322622cb5f4ecee64'}})
|
53
|
+
|
54
|
+
#~ file = File.read('c:\windows-version.txt')
|
55
|
+
#~ puts file.inspect.to_s
|
56
|
+
#~ token = R3c.upload file
|
57
|
+
#~ puts token
|
58
|
+
|
59
|
+
#~ issue_params= {"project_id"=> 1, "subject"=> "This is the subject"}
|
60
|
+
|
61
|
+
#~ issue_params["uploads"]= [{"upload"=>{"token"=> token, "filename"=> "R3c.gemspec", "description"=> "a gemspec", "content_type"=> "text/plain"}}]
|
62
|
+
#~ issue= R3c.issue.create(issue_params )
|
63
|
+
|
data/lib/r3c/r3c.rb
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
require "activeresource"
|
2
|
+
|
3
|
+
|
4
|
+
module R3c
|
5
|
+
|
6
|
+
class BaseEntity < ActiveResource::Base
|
7
|
+
|
8
|
+
self.format = :json
|
9
|
+
|
10
|
+
def self.set_site(url)
|
11
|
+
self.site= url
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.set_format(format)
|
15
|
+
self.format= format
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.auth(params)
|
19
|
+
if params[:api]
|
20
|
+
self.api_key(params[:api][:key])
|
21
|
+
elsif params[:basic_auth]
|
22
|
+
self.basic_auth(params[:basic_auth])
|
23
|
+
else
|
24
|
+
raise "Exception"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
def self.api_key(api_key)
|
30
|
+
self.headers['X-Redmine-API-Key'] = api_key
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.basic_aut(params)
|
34
|
+
self.user= params[:user]
|
35
|
+
self.password= params[:password]
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.to_s
|
39
|
+
{format: self.format, site: self.site, api_key: self.headers['X-Redmine-API-Key'] , user: self.user, password: self.password}
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
class Project<BaseEntity
|
45
|
+
end
|
46
|
+
|
47
|
+
class Issue<BaseEntity
|
48
|
+
end
|
49
|
+
|
50
|
+
class Wiki<BaseEntity
|
51
|
+
end
|
52
|
+
|
53
|
+
class Tracker<BaseEntity
|
54
|
+
end
|
55
|
+
|
56
|
+
class Priority<BaseEntity
|
57
|
+
end
|
58
|
+
|
59
|
+
class CustomField<BaseEntity
|
60
|
+
end
|
61
|
+
|
62
|
+
class User<BaseEntity
|
63
|
+
end
|
64
|
+
|
65
|
+
class Group<BaseEntity
|
66
|
+
end
|
67
|
+
|
68
|
+
class Role<BaseEntity
|
69
|
+
end
|
70
|
+
|
71
|
+
class TimeEntry<BaseEntity
|
72
|
+
end
|
73
|
+
|
74
|
+
class Journal<BaseEntity
|
75
|
+
end
|
76
|
+
|
77
|
+
class Upload<BaseEntity
|
78
|
+
end
|
79
|
+
|
80
|
+
class Attachment<BaseEntity
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
84
|
+
|
data/lib/r3c/version.rb
ADDED
metadata
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: R3c
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Paolo Freuli
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-07-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activeresource
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4.1'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 4.1.0
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '4.1'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 4.1.0
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: rest-client
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: 2.0.0
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 2.0.0
|
43
|
+
type: :runtime
|
44
|
+
prerelease: false
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: 2.0.0
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 2.0.0
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: json
|
55
|
+
requirement: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - "~>"
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: 1.8.3
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 1.8.3
|
63
|
+
type: :runtime
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 1.8.3
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: 1.8.3
|
73
|
+
description: |2
|
74
|
+
Redmine Rest Client writte in Ruby.
|
75
|
+
email: paolo.freuli@gmail.com
|
76
|
+
executables: []
|
77
|
+
extensions: []
|
78
|
+
extra_rdoc_files: []
|
79
|
+
files:
|
80
|
+
- LICENSE
|
81
|
+
- README.md
|
82
|
+
- lib/r3c.rb
|
83
|
+
- lib/r3c/r3c.rb
|
84
|
+
- lib/r3c/version.rb
|
85
|
+
homepage: http://github.com//R3c
|
86
|
+
licenses:
|
87
|
+
- MIT
|
88
|
+
metadata: {}
|
89
|
+
post_install_message:
|
90
|
+
rdoc_options: []
|
91
|
+
require_paths:
|
92
|
+
- lib
|
93
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
requirements: []
|
104
|
+
rubyforge_project:
|
105
|
+
rubygems_version: 2.4.5.1
|
106
|
+
signing_key:
|
107
|
+
specification_version: 4
|
108
|
+
summary: Rest Redmine Ruby Client
|
109
|
+
test_files: []
|