R3c 0.0.3 → 0.0.4

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: e338f77879fe87b862fd7bbc1ddf58ecffd11554
4
- data.tar.gz: 48c4a04d339f1eae9f2225d9123aac7fead3318a
3
+ metadata.gz: c5d98b58e1b25b336f2078cb732f26c98c07d4ad
4
+ data.tar.gz: ba048f1fa52c46b5263cf7ffb58eb5d3f17e0cbb
5
5
  SHA512:
6
- metadata.gz: e8febb087e31d9d15a298ec8c35bf7dcb1816724b05a8307e0ff632c4fafefc5c0d060b6e7303c2232abe927f47aa64bebe5cad7b5e1fd4f0c2e80dc05644f7f
7
- data.tar.gz: 78d8abb8a41a0cab81df43461ede9de529e047ae6c936dda2944144cf9853618292621d3498c600b5324e20815aff347c0d9c4814d6c4c7ef2789c69a126e5d7
6
+ metadata.gz: 1945e5a63f32404e7c66017c766519a91fd17e206aaba461e9cb5b91db8644162b60d30e2132ae5be6e83bb27f5cac6d1e5ce4dc8a743f034c2d3a01cbcda158
7
+ data.tar.gz: 7cc1d1c4d94baee5928f2972f59eaacc02f42237d0b274c8e77efce0dba46a625f6d7b9642efc1624ea375afc408cdb4ebe73555092b0256056c13dbb460d5bd
data/lib/r3c.rb CHANGED
@@ -1,19 +1,28 @@
1
1
  require "r3c/r3c"
2
2
  require "r3c/version"
3
-
3
+ require "rest-client"
4
+ require "json"
4
5
 
5
6
  module R3c
6
7
 
7
8
 
8
9
  def self.upload(file)
9
- require "rest-client"
10
- require "json"
11
10
  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
11
  token = JSON.parse(response)['upload']['token']
14
12
  end
15
13
 
16
-
14
+ def self.add_watcher(issue_id, user_id)
15
+ #POST /issues/[id]/watchers.[format]
16
+ response = RestClient.post("#{R3c::BaseEntity.site}/issues/#{issue_id}/watchers.xml?key=#{R3c::BaseEntity.headers['X-Redmine-API-Key']}", {user_id: user_id})
17
+ end
18
+
19
+ def self.remove_watcher(issue_id, user_id)
20
+ #DELETE /issues/[id]/watchers/[user_id].[format]
21
+ response = RestClient.delete("#{R3c::BaseEntity.site}/issues/#{issue_id}/watchers/#{user_id}.xml?key=#{R3c::BaseEntity.headers['X-Redmine-API-Key']}")
22
+ end
23
+
24
+
25
+
17
26
  def self.version
18
27
  VERSION
19
28
  end
@@ -46,10 +55,10 @@ end
46
55
  end
47
56
 
48
57
 
49
- #~ R3c.site('http://localhost:3000/')
50
- #~ R3c.format(:xml)
58
+ R3c.site('http://localhost:3000/')
59
+ R3c.format(:xml)
51
60
 
52
- #~ R3c.auth({api: {key: '8091d55257c4c90b6d56e83322622cb5f4ecee64'}})
61
+ R3c.auth({api: {key: '8091d55257c4c90b6d56e83322622cb5f4ecee64'}})
53
62
 
54
63
  #~ file = File.read('c:\windows-version.txt')
55
64
  #~ puts file.inspect.to_s
@@ -5,7 +5,7 @@ module R3c
5
5
 
6
6
  class BaseEntity < ActiveResource::Base
7
7
 
8
- self.format = :json
8
+ self.format = :xml
9
9
 
10
10
  def self.set_site(url)
11
11
  self.site= url
@@ -1,5 +1,5 @@
1
1
  module R3c
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
4
4
 
5
5
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: R3c
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paolo Freuli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-09 00:00:00.000000000 Z
11
+ date: 2016-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activeresource