assembla 0.7.3

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.
data/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ config.yml
2
+ pkg/
data/README.textile ADDED
@@ -0,0 +1,40 @@
1
+ h1. assembla - command line access toy your assembla.com spaces
2
+
3
+ p. This gem is a Ruby client that lets you use command line to preform some common assembla tasks, like getting filtered list of tickets, adding new ticket or changeing tickets metadata.
4
+
5
+ h2. USAGE
6
+
7
+ p. After you install the gem you need to create ~/.assembla config file with following data:
8
+
9
+ p{background:#888}. url: "https://www.assembla.com/spaces/YOUR_SPACE_NAME/tickets"
10
+ user: USERNAME
11
+ password: PASSWORD
12
+ me: MEANING_THE_PERSON_TO_WHOM_THE_TICKETS_ARE_ASSIGNED
13
+
14
+ h2. INSTALATION
15
+
16
+ p{background:#888}. gem install a2smbla
17
+
18
+ h2. LICENSE
19
+
20
+ The MIT License
21
+
22
+ Copyright (c) 2009 Ignacy Moryc
23
+
24
+ Permission is hereby granted, free of charge, to any person obtaining a copy
25
+ of this software and associated documentation files (the "Software"), to deal
26
+ in the Software without restriction, including without limitation the rights
27
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
28
+ copies of the Software, and to permit persons to whom the Software is
29
+ furnished to do so, subject to the following conditions:
30
+
31
+ The above copyright notice and this permission notice shall be included in
32
+ all copies or substantial portions of the Software.
33
+
34
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
35
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
36
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
37
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
38
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
39
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
40
+ THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,55 @@
1
+ require 'rake'
2
+
3
+ begin
4
+ require 'jeweler'
5
+ Jeweler::Tasks.new do |gemspec|
6
+ gemspec.name = "assembla"
7
+ gemspec.summary = "Command line access to assembla"
8
+ gemspec.description = "This gem provides access to assembla tickets. It supports listing, creating and modyfing functionality"
9
+ gemspec.email = "imoryc@gmail.com"
10
+ gemspec.homepage = "http://github.com/ignacy/assembla"
11
+ gemspec.authors = ["Ignacy Moryc"]
12
+ gemspec.add_dependency('hpricot', '>= 0.8.1')
13
+ end
14
+ rescue LoadError
15
+ puts "Jeweler not available. Install it with: sudo gem install jeweler"
16
+ end
17
+
18
+ ############################
19
+
20
+ require 'spec/rake/spectask'
21
+
22
+ desc "Run all specs"
23
+ Spec::Rake::SpecTask.new('spec') do |t|
24
+ t.spec_opts = ['--colour --format progress --loadby mtime --reverse']
25
+ t.spec_files = FileList['spec/*_spec.rb']
26
+ end
27
+
28
+ desc "Print specdocs"
29
+ Spec::Rake::SpecTask.new(:doc) do |t|
30
+ t.spec_opts = ["--format", "specdoc", "--dry-run"]
31
+ t.spec_files = FileList['spec/*_spec.rb']
32
+ end
33
+
34
+ desc "Run all examples with RCov"
35
+ Spec::Rake::SpecTask.new('rcov') do |t|
36
+ t.spec_files = FileList['spec/*_spec.rb']
37
+ t.rcov = true
38
+ t.rcov_opts = ['--exclude', 'examples']
39
+ end
40
+
41
+ task :default => :spec
42
+
43
+ ############################
44
+
45
+ require 'rake/rdoctask'
46
+
47
+ Rake::RDocTask.new do |t|
48
+ t.rdoc_dir = 'rdoc'
49
+ t.title = "assembla, command line assembla.com client"
50
+ t.options << '--line-numbers' << '--inline-source' << '-A cattr_accessor=object'
51
+ t.options << '--charset' << 'utf-8'
52
+ t.rdoc_files.include('README.textile')
53
+ t.rdoc_files.include('lib/assembla.rb')
54
+ end
55
+
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.7.3
data/assembla.gemspec ADDED
@@ -0,0 +1,67 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{assembla}
8
+ s.version = "0.7.3"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Ignacy Moryc"]
12
+ s.date = %q{2010-02-14}
13
+ s.default_executable = %q{ass}
14
+ s.description = %q{This gem provides access to assembla tickets. It supports listing, creating and modyfing functionality}
15
+ s.email = %q{imoryc@gmail.com}
16
+ s.executables = ["ass"]
17
+ s.extra_rdoc_files = [
18
+ "README.textile"
19
+ ]
20
+ s.files = [
21
+ ".gitignore",
22
+ "README.textile",
23
+ "Rakefile",
24
+ "VERSION",
25
+ "assembla.gemspec",
26
+ "bin/ass",
27
+ "config_default.yml",
28
+ "lib/assembla.rb",
29
+ "lib/extensions.rb",
30
+ "lib/interpreter.rb",
31
+ "lib/ticket.rb",
32
+ "rdoc/classes/AssEmBlr.html",
33
+ "rdoc/created.rid",
34
+ "rdoc/files/README_textile.html",
35
+ "rdoc/files/lib/assembla_rb.html",
36
+ "rdoc/fr_class_index.html",
37
+ "rdoc/fr_file_index.html",
38
+ "rdoc/fr_method_index.html",
39
+ "rdoc/index.html",
40
+ "rdoc/rdoc-style.css",
41
+ "spec/assembla_spec.rb",
42
+ "spec/mock.html",
43
+ "spec/test_config.yml"
44
+ ]
45
+ s.homepage = %q{http://github.com/ignacy/assembla}
46
+ s.rdoc_options = ["--charset=UTF-8"]
47
+ s.require_paths = ["lib"]
48
+ s.rubygems_version = %q{1.3.5}
49
+ s.summary = %q{Command line access to assembla}
50
+ s.test_files = [
51
+ "spec/assembla_spec.rb"
52
+ ]
53
+
54
+ if s.respond_to? :specification_version then
55
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
56
+ s.specification_version = 3
57
+
58
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
59
+ s.add_runtime_dependency(%q<hpricot>, [">= 0.8.1"])
60
+ else
61
+ s.add_dependency(%q<hpricot>, [">= 0.8.1"])
62
+ end
63
+ else
64
+ s.add_dependency(%q<hpricot>, [">= 0.8.1"])
65
+ end
66
+ end
67
+
data/bin/ass ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
4
+
5
+ require 'assembla'
6
+
7
+ @assem = AssEmBlr.new
8
+ @assem.print(@assem.find_my_active_tickets)
@@ -0,0 +1,5 @@
1
+ # This is skeleton config file - set values and rename it to config.yml
2
+ url: "https://www.assembla.com/spaces/YOUR_SPACE_NAME/tickets"
3
+ user: USERNAME
4
+ password: PASSWORD
5
+ me: MEANING_THE_PERSON_TO_WHOM_THE_TICKETS_ARE_ASSIGNED
data/lib/assembla.rb ADDED
@@ -0,0 +1,101 @@
1
+ # This program allows you to use command line to perform
2
+ # your typical assembla.com tasks. USing it you can check
3
+ # for new tickets, change status, reasign them or create new ones
4
+ #
5
+ # Author:: Ignacy Moryc (mailto:imoryc@gmail.com)
6
+ # License:: MIT
7
+ #
8
+ # This is the main program class
9
+
10
+
11
+ require 'open-uri'
12
+ require 'net/http'
13
+ require 'rubygems'
14
+ require 'hpricot'
15
+ require File.dirname(__FILE__) + '/ticket'
16
+ require File.dirname(__FILE__) + '/interpreter'
17
+
18
+ $:.unshift File.join(File.dirname(__FILE__), *%w[..])
19
+
20
+ class AssEmBlr
21
+
22
+ attr_accessor :page, :parsed, :url, :user, :password
23
+
24
+ # This metod requires for the config file to be present
25
+ def initialize(config_file = "~/.assembla")
26
+ config = YAML::parse( File.open(File.expand_path(config_file)))
27
+ @url = config["url"].value
28
+ @user = config["user"].value
29
+ @password = config["password"].value
30
+ @me = config["me"].value
31
+
32
+ (@url =~ /http/) ? \
33
+ self.page = Hpricot(open(@url, :http_basic_authentication=>[@user, @password])) \
34
+ : self.page = Hpricot(open(@url))
35
+
36
+ tickets
37
+ end
38
+
39
+ # This method parsess all active tickets in your Assembla space
40
+ def tickets
41
+ all = All.new
42
+ self.parsed = all.evaluate(self.page)
43
+ end
44
+
45
+ def print_tickets
46
+ puts_title_line
47
+ self.parsed.each do |ticket|
48
+ puts ticket.to_s
49
+ end
50
+ end
51
+
52
+ def find_assigned_to(to = @me)
53
+ ass = AssignedTo.new
54
+ assigned_to = ass.evaluate(self.parsed, to)
55
+ end
56
+
57
+ def find_my_active_tickets
58
+ ass = find_assigned_to(@me)
59
+ new = find_with_status("New")
60
+ accepted = find_with_status("Accepted")
61
+ (accepted + new + ass).uniq
62
+ end
63
+
64
+ def find_with_status(status = "New")
65
+ st = Status.new
66
+ active = st.evaluate(self.parsed, status)
67
+ end
68
+
69
+ def print(tickets)
70
+ puts_title_line
71
+ tickets.each { |t| puts t.to_s }
72
+ end
73
+
74
+ def find_id(id)
75
+ result = Id.new
76
+ result.evaluate(self.parsed, id)
77
+ end
78
+
79
+ def update_ticket_to_new(id)
80
+ space = @url.gsub(/https:\/\/www\.assembla.com(.+)/, '\1')
81
+ url = space + '/' + id.to_s
82
+ puts url
83
+ request = Net::HTTP::Put.new(url, initheader = {'Content-Type' => 'application/xml', 'Accept' => 'application/xml'})
84
+ request.body = "<ticket><status type='integer'>0</status></ticket>"
85
+ request.basic_auth @user, @password
86
+ Net::HTTP.start("www.assembla.com", 80 ) do |http|
87
+ response = http.request(request)
88
+ puts response
89
+ end
90
+ end
91
+
92
+ private
93
+
94
+ # This is a helper method for printing table header
95
+ def puts_title_line
96
+ puts
97
+ puts " ID | Assigned to: | Status | Summary "
98
+ puts "---------------------------------------------------------------------------"
99
+ end
100
+
101
+ end
data/lib/extensions.rb ADDED
@@ -0,0 +1,7 @@
1
+ # Useful functionality that didn't belong anywhere else
2
+ class Object
3
+ def returning(value)
4
+ yield(value)
5
+ value
6
+ end
7
+ end
@@ -0,0 +1,42 @@
1
+ require File.dirname(__FILE__) + '/extensions'
2
+
3
+ class Expression
4
+
5
+ end
6
+
7
+ class All < Expression
8
+ def evaluate(page)
9
+ returning result = [] do
10
+ (page/"tr.ticket_row").each do |ticket|
11
+ result.push Ticket.new((ticket/"td.number/a").first.inner_html,
12
+ (ticket/"td.summary/a").first.inner_html,
13
+ (ticket/"td.status/a").first.inner_html,
14
+ (ticket/"td.assigned_to_id/a").first.inner_html)
15
+ end
16
+ end
17
+ end
18
+ end
19
+
20
+ class Status < Expression
21
+ def evaluate(tickets, status)
22
+ returning result = [] do
23
+ tickets.each { |t| result.push(t) if t.status == status }
24
+ end
25
+ end
26
+ end
27
+
28
+ class Id < Expression
29
+ def evaluate(tickets, id)
30
+ returning result = [] do
31
+ tickets.each { |t| result.push(t) if t.id == id }
32
+ end
33
+ end
34
+ end
35
+
36
+ class AssignedTo < Expression
37
+ def evaluate(tickets, to)
38
+ returning result = [] do
39
+ tickets.each { |t| result.push(t) if t.assigned_to == to }
40
+ end
41
+ end
42
+ end
data/lib/ticket.rb ADDED
@@ -0,0 +1,25 @@
1
+ # This program allows you to use command line to perform
2
+ # your typical assembla.com tasks. USing it you can check
3
+ # for new tickets, change status, reasign them or create new ones
4
+ #
5
+ # Author:: Ignacy Moryc (mailto:imoryc@gmail.com)
6
+ # License:: MIT
7
+ #
8
+ # This is the ticket class responsible for
9
+ # describing the ticket object.
10
+
11
+ class Ticket
12
+ attr_accessor :id, :summary, :status, :assigned_to
13
+
14
+ def initialize(id, summary, status, assigned_to)
15
+ self.id = id.to_i
16
+ self.summary = summary
17
+ self.status = status
18
+ self.assigned_to = assigned_to
19
+ end
20
+
21
+ def to_s
22
+ "#{self.id.to_s.center(5)}|#{self.assigned_to.center(18)}|#{self.status.to_s.center(10)}| #{self.summary} \n"
23
+ end
24
+
25
+ end
@@ -0,0 +1,408 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Class: AssEmBlr</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Class</strong></td>
53
+ <td class="class-name-in-header">AssEmBlr</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../files/lib/assembla_rb.html">
59
+ lib/assembla.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ <tr class="top-aligned-row">
66
+ <td><strong>Parent:</strong></td>
67
+ <td>
68
+ Object
69
+ </td>
70
+ </tr>
71
+ </table>
72
+ </div>
73
+ <!-- banner header -->
74
+
75
+ <div id="bodyContent">
76
+
77
+
78
+
79
+ <div id="contextContent">
80
+
81
+
82
+
83
+ </div>
84
+
85
+ <div id="method-list">
86
+ <h3 class="section-bar">Methods</h3>
87
+
88
+ <div class="name-list">
89
+ <a href="#M000004">find_assigned_to</a>&nbsp;&nbsp;
90
+ <a href="#M000008">find_id</a>&nbsp;&nbsp;
91
+ <a href="#M000005">find_my_active_tickets</a>&nbsp;&nbsp;
92
+ <a href="#M000006">find_with_status</a>&nbsp;&nbsp;
93
+ <a href="#M000001">new</a>&nbsp;&nbsp;
94
+ <a href="#M000007">print</a>&nbsp;&nbsp;
95
+ <a href="#M000003">print_tickets</a>&nbsp;&nbsp;
96
+ <a href="#M000002">tickets</a>&nbsp;&nbsp;
97
+ <a href="#M000009">update_ticets_status</a>&nbsp;&nbsp;
98
+ </div>
99
+ </div>
100
+
101
+ </div>
102
+
103
+
104
+ <!-- if includes -->
105
+
106
+ <div id="section">
107
+
108
+
109
+
110
+
111
+
112
+ <div id="attribute-list">
113
+ <h3 class="section-bar">Attributes</h3>
114
+
115
+ <div class="name-list">
116
+ <table>
117
+ <tr class="top-aligned-row context-row">
118
+ <td class="context-item-name">page</td>
119
+ <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
120
+ <td class="context-item-desc"></td>
121
+ </tr>
122
+ <tr class="top-aligned-row context-row">
123
+ <td class="context-item-name">parsed</td>
124
+ <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
125
+ <td class="context-item-desc"></td>
126
+ </tr>
127
+ <tr class="top-aligned-row context-row">
128
+ <td class="context-item-name">password</td>
129
+ <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
130
+ <td class="context-item-desc"></td>
131
+ </tr>
132
+ <tr class="top-aligned-row context-row">
133
+ <td class="context-item-name">url</td>
134
+ <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
135
+ <td class="context-item-desc"></td>
136
+ </tr>
137
+ <tr class="top-aligned-row context-row">
138
+ <td class="context-item-name">user</td>
139
+ <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
140
+ <td class="context-item-desc"></td>
141
+ </tr>
142
+ </table>
143
+ </div>
144
+ </div>
145
+
146
+
147
+
148
+ <!-- if method_list -->
149
+ <div id="methods">
150
+ <h3 class="section-bar">Public Class methods</h3>
151
+
152
+ <div id="method-M000001" class="method-detail">
153
+ <a name="M000001"></a>
154
+
155
+ <div class="method-heading">
156
+ <a href="#M000001" class="method-signature">
157
+ <span class="method-name">new</span><span class="method-args">()</span>
158
+ </a>
159
+ </div>
160
+
161
+ <div class="method-description">
162
+ <p>
163
+ This metod requires for the config file to be present
164
+ </p>
165
+ <p><a class="source-toggle" href="#"
166
+ onclick="toggleCode('M000001-source');return false;">[Source]</a></p>
167
+ <div class="method-source-code" id="M000001-source">
168
+ <pre>
169
+ <span class="ruby-comment cmt"># File lib/assembla.rb, line 26</span>
170
+ 26: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>
171
+ 27: <span class="ruby-identifier">config</span> = <span class="ruby-constant">YAML</span><span class="ruby-operator">::</span><span class="ruby-identifier">parse</span>( <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-value str">&quot;~/.assembla&quot;</span>)))
172
+ 28: <span class="ruby-ivar">@url</span> = <span class="ruby-identifier">config</span>[<span class="ruby-value str">&quot;url&quot;</span>].<span class="ruby-identifier">value</span>
173
+ 29: <span class="ruby-ivar">@user</span> = <span class="ruby-identifier">config</span>[<span class="ruby-value str">&quot;user&quot;</span>].<span class="ruby-identifier">value</span>
174
+ 30: <span class="ruby-ivar">@password</span> = <span class="ruby-identifier">config</span>[<span class="ruby-value str">&quot;password&quot;</span>].<span class="ruby-identifier">value</span>
175
+ 31: <span class="ruby-ivar">@me</span> = <span class="ruby-identifier">config</span>[<span class="ruby-value str">&quot;me&quot;</span>].<span class="ruby-identifier">value</span>
176
+ 32: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">page</span> = <span class="ruby-constant">Hpricot</span>(<span class="ruby-identifier">open</span>(<span class="ruby-ivar">@url</span>, <span class="ruby-identifier">:http_basic_authentication=</span><span class="ruby-operator">&gt;</span>[<span class="ruby-ivar">@user</span>, <span class="ruby-ivar">@password</span>]))
177
+ 33: <span class="ruby-identifier">tickets</span>
178
+ 34: <span class="ruby-keyword kw">end</span>
179
+ </pre>
180
+ </div>
181
+ </div>
182
+ </div>
183
+
184
+ <h3 class="section-bar">Public Instance methods</h3>
185
+
186
+ <div id="method-M000004" class="method-detail">
187
+ <a name="M000004"></a>
188
+
189
+ <div class="method-heading">
190
+ <a href="#M000004" class="method-signature">
191
+ <span class="method-name">find_assigned_to</span><span class="method-args">(to = @me)</span>
192
+ </a>
193
+ </div>
194
+
195
+ <div class="method-description">
196
+ <p><a class="source-toggle" href="#"
197
+ onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
198
+ <div class="method-source-code" id="M000004-source">
199
+ <pre>
200
+ <span class="ruby-comment cmt"># File lib/assembla.rb, line 49</span>
201
+ 49: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">find_assigned_to</span>(<span class="ruby-identifier">to</span> = <span class="ruby-ivar">@me</span>)
202
+ 50: <span class="ruby-identifier">ass</span> = <span class="ruby-constant">AssignedTo</span>.<span class="ruby-identifier">new</span>
203
+ 51: <span class="ruby-identifier">assigned_to</span> = <span class="ruby-identifier">ass</span>.<span class="ruby-identifier">evaluate</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">parsed</span>, <span class="ruby-identifier">to</span>)
204
+ 52: <span class="ruby-keyword kw">end</span>
205
+ </pre>
206
+ </div>
207
+ </div>
208
+ </div>
209
+
210
+ <div id="method-M000008" class="method-detail">
211
+ <a name="M000008"></a>
212
+
213
+ <div class="method-heading">
214
+ <a href="#M000008" class="method-signature">
215
+ <span class="method-name">find_id</span><span class="method-args">(id)</span>
216
+ </a>
217
+ </div>
218
+
219
+ <div class="method-description">
220
+ <p><a class="source-toggle" href="#"
221
+ onclick="toggleCode('M000008-source');return false;">[Source]</a></p>
222
+ <div class="method-source-code" id="M000008-source">
223
+ <pre>
224
+ <span class="ruby-comment cmt"># File lib/assembla.rb, line 71</span>
225
+ 71: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">find_id</span>(<span class="ruby-identifier">id</span>)
226
+ 72: <span class="ruby-identifier">result</span> = <span class="ruby-constant">Id</span>.<span class="ruby-identifier">new</span>
227
+ 73: <span class="ruby-identifier">found</span> = <span class="ruby-identifier">result</span>.<span class="ruby-identifier">evaluate</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">parsed</span>, <span class="ruby-constant">Id</span>)
228
+ 74: <span class="ruby-keyword kw">end</span>
229
+ </pre>
230
+ </div>
231
+ </div>
232
+ </div>
233
+
234
+ <div id="method-M000005" class="method-detail">
235
+ <a name="M000005"></a>
236
+
237
+ <div class="method-heading">
238
+ <a href="#M000005" class="method-signature">
239
+ <span class="method-name">find_my_active_tickets</span><span class="method-args">()</span>
240
+ </a>
241
+ </div>
242
+
243
+ <div class="method-description">
244
+ <p><a class="source-toggle" href="#"
245
+ onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
246
+ <div class="method-source-code" id="M000005-source">
247
+ <pre>
248
+ <span class="ruby-comment cmt"># File lib/assembla.rb, line 54</span>
249
+ 54: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">find_my_active_tickets</span>
250
+ 55: <span class="ruby-identifier">ass</span> = <span class="ruby-identifier">find_assigned_to</span>(<span class="ruby-ivar">@me</span>)
251
+ 56: <span class="ruby-identifier">new</span> = <span class="ruby-identifier">find_with_status</span>(<span class="ruby-value str">&quot;New&quot;</span>)
252
+ 57: <span class="ruby-identifier">accepted</span> = <span class="ruby-identifier">find_with_status</span>(<span class="ruby-value str">&quot;Accepted&quot;</span>)
253
+ 58: (<span class="ruby-identifier">accepted</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">new</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">ass</span>).<span class="ruby-identifier">uniq</span>
254
+ 59: <span class="ruby-keyword kw">end</span>
255
+ </pre>
256
+ </div>
257
+ </div>
258
+ </div>
259
+
260
+ <div id="method-M000006" class="method-detail">
261
+ <a name="M000006"></a>
262
+
263
+ <div class="method-heading">
264
+ <a href="#M000006" class="method-signature">
265
+ <span class="method-name">find_with_status</span><span class="method-args">(status = &quot;New&quot;)</span>
266
+ </a>
267
+ </div>
268
+
269
+ <div class="method-description">
270
+ <p><a class="source-toggle" href="#"
271
+ onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
272
+ <div class="method-source-code" id="M000006-source">
273
+ <pre>
274
+ <span class="ruby-comment cmt"># File lib/assembla.rb, line 61</span>
275
+ 61: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">find_with_status</span>(<span class="ruby-identifier">status</span> = <span class="ruby-value str">&quot;New&quot;</span>)
276
+ 62: <span class="ruby-identifier">st</span> = <span class="ruby-constant">Status</span>.<span class="ruby-identifier">new</span>
277
+ 63: <span class="ruby-identifier">active</span> = <span class="ruby-identifier">st</span>.<span class="ruby-identifier">evaluate</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">parsed</span>, <span class="ruby-identifier">status</span>)
278
+ 64: <span class="ruby-keyword kw">end</span>
279
+ </pre>
280
+ </div>
281
+ </div>
282
+ </div>
283
+
284
+ <div id="method-M000007" class="method-detail">
285
+ <a name="M000007"></a>
286
+
287
+ <div class="method-heading">
288
+ <a href="#M000007" class="method-signature">
289
+ <span class="method-name">print</span><span class="method-args">(tickets)</span>
290
+ </a>
291
+ </div>
292
+
293
+ <div class="method-description">
294
+ <p><a class="source-toggle" href="#"
295
+ onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
296
+ <div class="method-source-code" id="M000007-source">
297
+ <pre>
298
+ <span class="ruby-comment cmt"># File lib/assembla.rb, line 66</span>
299
+ 66: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">print</span>(<span class="ruby-identifier">tickets</span>)
300
+ 67: <span class="ruby-identifier">puts_title_line</span>
301
+ 68: <span class="ruby-identifier">tickets</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">t</span><span class="ruby-operator">|</span> <span class="ruby-identifier">puts</span> <span class="ruby-identifier">t</span>.<span class="ruby-identifier">to_s</span> }
302
+ 69: <span class="ruby-keyword kw">end</span>
303
+ </pre>
304
+ </div>
305
+ </div>
306
+ </div>
307
+
308
+ <div id="method-M000003" class="method-detail">
309
+ <a name="M000003"></a>
310
+
311
+ <div class="method-heading">
312
+ <a href="#M000003" class="method-signature">
313
+ <span class="method-name">print_tickets</span><span class="method-args">()</span>
314
+ </a>
315
+ </div>
316
+
317
+ <div class="method-description">
318
+ <p><a class="source-toggle" href="#"
319
+ onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
320
+ <div class="method-source-code" id="M000003-source">
321
+ <pre>
322
+ <span class="ruby-comment cmt"># File lib/assembla.rb, line 42</span>
323
+ 42: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">print_tickets</span>
324
+ 43: <span class="ruby-identifier">puts_title_line</span>
325
+ 44: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">parsed</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ticket</span><span class="ruby-operator">|</span>
326
+ 45: <span class="ruby-identifier">puts</span> <span class="ruby-identifier">ticket</span>.<span class="ruby-identifier">to_s</span>
327
+ 46: <span class="ruby-keyword kw">end</span>
328
+ 47: <span class="ruby-keyword kw">end</span>
329
+ </pre>
330
+ </div>
331
+ </div>
332
+ </div>
333
+
334
+ <div id="method-M000002" class="method-detail">
335
+ <a name="M000002"></a>
336
+
337
+ <div class="method-heading">
338
+ <a href="#M000002" class="method-signature">
339
+ <span class="method-name">tickets</span><span class="method-args">()</span>
340
+ </a>
341
+ </div>
342
+
343
+ <div class="method-description">
344
+ <p>
345
+ This method parsess all active <a href="AssEmBlr.html#M000002">tickets</a>
346
+ in your Assembla space
347
+ </p>
348
+ <p><a class="source-toggle" href="#"
349
+ onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
350
+ <div class="method-source-code" id="M000002-source">
351
+ <pre>
352
+ <span class="ruby-comment cmt"># File lib/assembla.rb, line 37</span>
353
+ 37: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">tickets</span>
354
+ 38: <span class="ruby-identifier">all</span> = <span class="ruby-constant">All</span>.<span class="ruby-identifier">new</span>
355
+ 39: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">parsed</span> = <span class="ruby-identifier">all</span>.<span class="ruby-identifier">evaluate</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">page</span>)
356
+ 40: <span class="ruby-keyword kw">end</span>
357
+ </pre>
358
+ </div>
359
+ </div>
360
+ </div>
361
+
362
+ <div id="method-M000009" class="method-detail">
363
+ <a name="M000009"></a>
364
+
365
+ <div class="method-heading">
366
+ <a href="#M000009" class="method-signature">
367
+ <span class="method-name">update_ticets_status</span><span class="method-args">(id, status)</span>
368
+ </a>
369
+ </div>
370
+
371
+ <div class="method-description">
372
+ <p>
373
+ Change ticket state
374
+ </p>
375
+ <p><a class="source-toggle" href="#"
376
+ onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
377
+ <div class="method-source-code" id="M000009-source">
378
+ <pre>
379
+ <span class="ruby-comment cmt"># File lib/assembla.rb, line 77</span>
380
+ 77: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">update_ticets_status</span>(<span class="ruby-identifier">id</span>, <span class="ruby-identifier">status</span>)
381
+ 78: <span class="ruby-identifier">sess</span> = <span class="ruby-constant">Patron</span><span class="ruby-operator">::</span><span class="ruby-constant">Session</span>.<span class="ruby-identifier">new</span>
382
+ 79: <span class="ruby-identifier">sess</span>.<span class="ruby-identifier">username</span> = <span class="ruby-ivar">@user</span>
383
+ 80: <span class="ruby-identifier">sess</span>.<span class="ruby-identifier">password</span> = <span class="ruby-ivar">@password</span>
384
+ 81: <span class="ruby-identifier">sess</span>.<span class="ruby-identifier">timeout</span> = <span class="ruby-value">10</span>
385
+ 82: <span class="ruby-identifier">sess</span>.<span class="ruby-identifier">base_url</span> = <span class="ruby-ivar">@url</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/https/</span>, <span class="ruby-value str">&quot;http&quot;</span>)
386
+ 83: <span class="ruby-identifier">sess</span>.<span class="ruby-identifier">headers</span>[<span class="ruby-value str">'Accept'</span>] = <span class="ruby-value str">'application/xml'</span>
387
+ 84: <span class="ruby-identifier">sess</span>.<span class="ruby-identifier">headers</span>[<span class="ruby-value str">'Content-Type'</span>] = <span class="ruby-value str">'application/xml'</span>
388
+ 85: <span class="ruby-identifier">res</span> = <span class="ruby-identifier">sess</span>.<span class="ruby-identifier">put</span>(<span class="ruby-node">&quot;/#{id}&quot;</span>, <span class="ruby-node">&quot;&lt;ticket&gt;&lt;status type='integer'&gt;#{status}&lt;/status&gt;&lt;/ticket&gt;&quot;</span>)
389
+ 86: <span class="ruby-identifier">puts</span> <span class="ruby-identifier">res</span>.<span class="ruby-identifier">body</span>
390
+ 87: <span class="ruby-keyword kw">end</span>
391
+ </pre>
392
+ </div>
393
+ </div>
394
+ </div>
395
+
396
+
397
+ </div>
398
+
399
+
400
+ </div>
401
+
402
+
403
+ <div id="validator-badges">
404
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
405
+ </div>
406
+
407
+ </body>
408
+ </html>