writeit-rails 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/.gitignore +19 -0
- data/.rspec +4 -0
- data/.travis.yml +12 -0
- data/Gemfile +11 -0
- data/Gemfile.lock +108 -0
- data/LICENSE +202 -0
- data/README.md +10 -0
- data/lib/models/message.rb +65 -0
- data/lib/models/writeitinstance.rb +35 -0
- data/lib/writeit-rails.rb +2 -0
- data/rakefile +9 -0
- data/spec/message_model_spec.rb +121 -0
- data/spec/spec_helper.rb +21 -0
- data/spec/writeitinstance_spec.rb +58 -0
- data/start-local-writeit.bash +54 -0
- data/update_writeit_data.sh +26 -0
- data/writeit-rails.gemspec +12 -0
- data/writeit_example_data.yaml +470 -0
- metadata +61 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9b211e7ed61b2879cf4906c6fc9a2161fc2dbb75
|
4
|
+
data.tar.gz: 8508369da2dff9cbd2c14e19348f9c160470fc73
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2a8e6973549ffe846f316cc62d350f5016ae5696d0341b1f47ceaad4353d5d6efb9b24900a8e9c80bb1a63fe40dc2939e4b135ceafa80c0970a5284bcd0fbf6d
|
7
|
+
data.tar.gz: 9680d24490401f304414f753107524c5476fdc6173cb3a13bbc9043aea6b0f778cb876e9b3607d532c298ce178b014f979ec9e447ecee5c614678af6da5d4398
|
data/.gitignore
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
*.rbc
|
2
|
+
*.sassc
|
3
|
+
.sass-cache
|
4
|
+
capybara-*.html
|
5
|
+
.rvmrc
|
6
|
+
/.bundle
|
7
|
+
/vendor/bundle
|
8
|
+
/log/*
|
9
|
+
/tmp/*
|
10
|
+
/db/*.sqlite3
|
11
|
+
/public/system/*
|
12
|
+
/coverage/
|
13
|
+
/spec/tmp/*
|
14
|
+
**.orig
|
15
|
+
rerun.txt
|
16
|
+
pickle-email-*.html
|
17
|
+
.project
|
18
|
+
config/initializers/secret_token.rb
|
19
|
+
writeit_local_for_testing
|
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,108 @@
|
|
1
|
+
GEM
|
2
|
+
remote: https://rubygems.org/
|
3
|
+
specs:
|
4
|
+
actionmailer (4.0.0)
|
5
|
+
actionpack (= 4.0.0)
|
6
|
+
mail (~> 2.5.3)
|
7
|
+
actionpack (4.0.0)
|
8
|
+
activesupport (= 4.0.0)
|
9
|
+
builder (~> 3.1.0)
|
10
|
+
erubis (~> 2.7.0)
|
11
|
+
rack (~> 1.5.2)
|
12
|
+
rack-test (~> 0.6.2)
|
13
|
+
activemodel (4.0.0)
|
14
|
+
activesupport (= 4.0.0)
|
15
|
+
builder (~> 3.1.0)
|
16
|
+
activerecord (4.0.0)
|
17
|
+
activemodel (= 4.0.0)
|
18
|
+
activerecord-deprecated_finders (~> 1.0.2)
|
19
|
+
activesupport (= 4.0.0)
|
20
|
+
arel (~> 4.0.0)
|
21
|
+
activerecord-deprecated_finders (1.0.3)
|
22
|
+
activesupport (4.0.0)
|
23
|
+
i18n (~> 0.6, >= 0.6.4)
|
24
|
+
minitest (~> 4.2)
|
25
|
+
multi_json (~> 1.3)
|
26
|
+
thread_safe (~> 0.1)
|
27
|
+
tzinfo (~> 0.3.37)
|
28
|
+
arel (4.0.1)
|
29
|
+
atomic (1.1.14)
|
30
|
+
builder (3.1.4)
|
31
|
+
coveralls (0.7.0)
|
32
|
+
multi_json (~> 1.3)
|
33
|
+
rest-client
|
34
|
+
simplecov (>= 0.7)
|
35
|
+
term-ansicolor
|
36
|
+
thor
|
37
|
+
diff-lcs (1.2.5)
|
38
|
+
erubis (2.7.0)
|
39
|
+
hike (1.2.3)
|
40
|
+
i18n (0.6.9)
|
41
|
+
mail (2.5.4)
|
42
|
+
mime-types (~> 1.16)
|
43
|
+
treetop (~> 1.4.8)
|
44
|
+
mime-types (1.25)
|
45
|
+
minitest (4.7.5)
|
46
|
+
multi_json (1.8.2)
|
47
|
+
polyglot (0.3.3)
|
48
|
+
rack (1.5.2)
|
49
|
+
rack-test (0.6.2)
|
50
|
+
rack (>= 1.0)
|
51
|
+
rails (4.0.0)
|
52
|
+
actionmailer (= 4.0.0)
|
53
|
+
actionpack (= 4.0.0)
|
54
|
+
activerecord (= 4.0.0)
|
55
|
+
activesupport (= 4.0.0)
|
56
|
+
bundler (>= 1.3.0, < 2.0)
|
57
|
+
railties (= 4.0.0)
|
58
|
+
sprockets-rails (~> 2.0.0)
|
59
|
+
railties (4.0.0)
|
60
|
+
actionpack (= 4.0.0)
|
61
|
+
activesupport (= 4.0.0)
|
62
|
+
rake (>= 0.8.7)
|
63
|
+
thor (>= 0.18.1, < 2.0)
|
64
|
+
rake (10.1.1)
|
65
|
+
rest-client (1.6.7)
|
66
|
+
mime-types (>= 1.16)
|
67
|
+
rspec (2.14.1)
|
68
|
+
rspec-core (~> 2.14.0)
|
69
|
+
rspec-expectations (~> 2.14.0)
|
70
|
+
rspec-mocks (~> 2.14.0)
|
71
|
+
rspec-core (2.14.7)
|
72
|
+
rspec-expectations (2.14.4)
|
73
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
74
|
+
rspec-mocks (2.14.4)
|
75
|
+
simplecov (0.7.1)
|
76
|
+
multi_json (~> 1.0)
|
77
|
+
simplecov-html (~> 0.7.1)
|
78
|
+
simplecov-html (0.7.1)
|
79
|
+
sprockets (2.10.0)
|
80
|
+
hike (~> 1.2)
|
81
|
+
multi_json (~> 1.0)
|
82
|
+
rack (~> 1.0)
|
83
|
+
tilt (~> 1.1, != 1.3.0)
|
84
|
+
sprockets-rails (2.0.0)
|
85
|
+
actionpack (>= 3.0)
|
86
|
+
activesupport (>= 3.0)
|
87
|
+
sprockets (~> 2.8)
|
88
|
+
term-ansicolor (1.2.2)
|
89
|
+
tins (~> 0.8)
|
90
|
+
thor (0.18.1)
|
91
|
+
thread_safe (0.1.3)
|
92
|
+
atomic
|
93
|
+
tilt (1.4.1)
|
94
|
+
tins (0.12.0)
|
95
|
+
treetop (1.4.15)
|
96
|
+
polyglot
|
97
|
+
polyglot (>= 0.3.1)
|
98
|
+
tzinfo (0.3.38)
|
99
|
+
|
100
|
+
PLATFORMS
|
101
|
+
ruby
|
102
|
+
|
103
|
+
DEPENDENCIES
|
104
|
+
coveralls
|
105
|
+
rails (= 4.0.0)
|
106
|
+
rake
|
107
|
+
rspec
|
108
|
+
rspec-core
|
data/LICENSE
ADDED
@@ -0,0 +1,202 @@
|
|
1
|
+
Apache License
|
2
|
+
Version 2.0, January 2004
|
3
|
+
http://www.apache.org/licenses/
|
4
|
+
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
6
|
+
|
7
|
+
1. Definitions.
|
8
|
+
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
11
|
+
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
13
|
+
the copyright owner that is granting the License.
|
14
|
+
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
16
|
+
other entities that control, are controlled by, or are under common
|
17
|
+
control with that entity. For the purposes of this definition,
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
19
|
+
direction or management of such entity, whether by contract or
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
22
|
+
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
24
|
+
exercising permissions granted by this License.
|
25
|
+
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
27
|
+
including but not limited to software source code, documentation
|
28
|
+
source, and configuration files.
|
29
|
+
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
31
|
+
transformation or translation of a Source form, including but
|
32
|
+
not limited to compiled object code, generated documentation,
|
33
|
+
and conversions to other media types.
|
34
|
+
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
36
|
+
Object form, made available under the License, as indicated by a
|
37
|
+
copyright notice that is included in or attached to the work
|
38
|
+
(an example is provided in the Appendix below).
|
39
|
+
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
46
|
+
the Work and Derivative Works thereof.
|
47
|
+
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
49
|
+
the original version of the Work and any modifications or additions
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
61
|
+
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
64
|
+
subsequently incorporated within the Work.
|
65
|
+
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
72
|
+
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
78
|
+
where such license applies only to those patent claims licensable
|
79
|
+
by such Contributor that are necessarily infringed by their
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
82
|
+
institute patent litigation against any entity (including a
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
85
|
+
or contributory patent infringement, then any patent licenses
|
86
|
+
granted to You under this License for that Work shall terminate
|
87
|
+
as of the date such litigation is filed.
|
88
|
+
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
91
|
+
modifications, and in Source or Object form, provided that You
|
92
|
+
meet the following conditions:
|
93
|
+
|
94
|
+
(a) You must give any other recipients of the Work or
|
95
|
+
Derivative Works a copy of this License; and
|
96
|
+
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
98
|
+
stating that You changed the files; and
|
99
|
+
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
102
|
+
attribution notices from the Source form of the Work,
|
103
|
+
excluding those notices that do not pertain to any part of
|
104
|
+
the Derivative Works; and
|
105
|
+
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
108
|
+
include a readable copy of the attribution notices contained
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
111
|
+
of the following places: within a NOTICE text file distributed
|
112
|
+
as part of the Derivative Works; within the Source form or
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
114
|
+
within a display generated by the Derivative Works, if and
|
115
|
+
wherever such third-party notices normally appear. The contents
|
116
|
+
of the NOTICE file are for informational purposes only and
|
117
|
+
do not modify the License. You may add Your own attribution
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
120
|
+
that such additional attribution notices cannot be construed
|
121
|
+
as modifying the License.
|
122
|
+
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
124
|
+
may provide additional or different license terms and conditions
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
128
|
+
the conditions stated in this License.
|
129
|
+
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
133
|
+
this License, without any additional terms or conditions.
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
135
|
+
the terms of any separate license agreement you may have executed
|
136
|
+
with Licensor regarding such Contributions.
|
137
|
+
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
140
|
+
except as required for reasonable and customary use in describing the
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
142
|
+
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
152
|
+
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
158
|
+
incidental, or consequential damages of any character arising as a
|
159
|
+
result of this License or out of the use or inability to use the
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
162
|
+
other commercial damages or losses), even if such Contributor
|
163
|
+
has been advised of the possibility of such damages.
|
164
|
+
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
168
|
+
or other liability obligations and/or rights consistent with this
|
169
|
+
License. However, in accepting such obligations, You may act only
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
174
|
+
of your accepting any such warranty or additional liability.
|
175
|
+
|
176
|
+
END OF TERMS AND CONDITIONS
|
177
|
+
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
179
|
+
|
180
|
+
To apply the Apache License to your work, attach the following
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "{}"
|
182
|
+
replaced with your own identifying information. (Don't include
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
184
|
+
comment syntax for the file format. We also recommend that a
|
185
|
+
file or class name and description of purpose be included on the
|
186
|
+
same "printed page" as the copyright notice for easier
|
187
|
+
identification within third-party archives.
|
188
|
+
|
189
|
+
Copyright {yyyy} {name of copyright owner}
|
190
|
+
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
192
|
+
you may not use this file except in compliance with the License.
|
193
|
+
You may obtain a copy of the License at
|
194
|
+
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
196
|
+
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
200
|
+
See the License for the specific language governing permissions and
|
201
|
+
limitations under the License.
|
202
|
+
|
data/README.md
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
writeit-rails
|
2
|
+
=============
|
3
|
+
[![Build Status](https://travis-ci.org/ciudadanointeligente/writeit-rails.png?branch=master)](https://travis-ci.org/ciudadanointeligente/writeit-rails)
|
4
|
+
[![Coverage Status](https://coveralls.io/repos/ciudadanointeligente/writeit-rails/badge.png)](https://coveralls.io/r/ciudadanointeligente/writeit-rails)
|
5
|
+
|
6
|
+
|
7
|
+
Write-it api client build for rails
|
8
|
+
|
9
|
+
There is no documentation yet, but please contact lab@ciudadanointeligente.org in order to get help.
|
10
|
+
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'active_record'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
class Message
|
5
|
+
attr_accessor :subject
|
6
|
+
attr_accessor :content
|
7
|
+
attr_accessor :writeitinstance
|
8
|
+
attr_accessor :recipients
|
9
|
+
attr_accessor :remote_uri
|
10
|
+
attr_accessor :remote_id
|
11
|
+
attr_accessor :author_name
|
12
|
+
attr_accessor :author_email
|
13
|
+
|
14
|
+
def validate
|
15
|
+
|
16
|
+
wrong_recipients = self.recipients.nil?
|
17
|
+
if not wrong_recipients
|
18
|
+
wrong_recipients = not(self.recipients.any?)
|
19
|
+
end
|
20
|
+
raise ArgumentError, 'No recipients, please add some first' unless not wrong_recipients
|
21
|
+
|
22
|
+
validates_author_name = self.author_name.blank?
|
23
|
+
raise ArgumentError, 'No author, set it first' unless not validates_author_name
|
24
|
+
|
25
|
+
validates_instance = self.writeitinstance.nil?
|
26
|
+
raise ArgumentError, 'No instance, please set one first' unless not validates_instance
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
def push_to_api
|
31
|
+
validate
|
32
|
+
|
33
|
+
data = {
|
34
|
+
:author_name => self.author_name,
|
35
|
+
:author_email => self.author_email,
|
36
|
+
:subject => self.subject,
|
37
|
+
:content => self.content,
|
38
|
+
:writeitinstance => self.writeitinstance.url,
|
39
|
+
:persons => self.recipients
|
40
|
+
}
|
41
|
+
authorization = 'ApiKey %{username}:%{api_key}' % {
|
42
|
+
:username => self.writeitinstance.username,
|
43
|
+
:api_key => self.writeitinstance.api_key,
|
44
|
+
}
|
45
|
+
url = self.writeitinstance.base_url + '/api/v1/message/'
|
46
|
+
|
47
|
+
request = RestClient::Request.new(
|
48
|
+
:method => :post,
|
49
|
+
:url => url,
|
50
|
+
:headers => {
|
51
|
+
:accept => :json,
|
52
|
+
:authorization => authorization,
|
53
|
+
},
|
54
|
+
:payload => data.to_json
|
55
|
+
)
|
56
|
+
request.processed_headers["Content-Type"] = 'application/json'
|
57
|
+
response = request.execute
|
58
|
+
data = JSON.parse(response.body)
|
59
|
+
self.remote_id = data['id']
|
60
|
+
self.remote_uri = data['resource_uri']
|
61
|
+
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
class WriteItInstance
|
2
|
+
attr_accessor :url
|
3
|
+
attr_accessor :base_url
|
4
|
+
attr_accessor :username
|
5
|
+
attr_accessor :api_key
|
6
|
+
attr_reader :errors
|
7
|
+
|
8
|
+
|
9
|
+
def validate
|
10
|
+
authorization = 'ApiKey %{username}:%{api_key}' % {
|
11
|
+
:username => self.username,
|
12
|
+
:api_key => self.api_key,
|
13
|
+
}
|
14
|
+
|
15
|
+
url = self.base_url + "/api/v1" + self.url
|
16
|
+
request = RestClient::Request.new(
|
17
|
+
:method => :get,
|
18
|
+
:url => url,
|
19
|
+
:headers => {
|
20
|
+
:accept => :json,
|
21
|
+
:authorization => authorization,
|
22
|
+
}
|
23
|
+
)
|
24
|
+
|
25
|
+
#RestClient::ResourceNotFound
|
26
|
+
begin
|
27
|
+
request.execute
|
28
|
+
rescue Exception => e
|
29
|
+
@errors = [e.message]
|
30
|
+
|
31
|
+
return false
|
32
|
+
end
|
33
|
+
return true
|
34
|
+
end
|
35
|
+
end
|
data/rakefile
ADDED
@@ -0,0 +1,121 @@
|
|
1
|
+
require 'models/message'
|
2
|
+
require "models/writeitinstance"
|
3
|
+
require "spec_helper"
|
4
|
+
require 'json'
|
5
|
+
|
6
|
+
describe Message do
|
7
|
+
context "with attributes" do
|
8
|
+
it "has author_name, author_email,subject, remote_id, remote_uri and content" do
|
9
|
+
message = Message.new
|
10
|
+
message.subject = "Hey this is a subject"
|
11
|
+
message.content = "Hey this is a content"
|
12
|
+
message.author_name = "Fiera feroz"
|
13
|
+
message.author_email = "fiera@ciudadanointeligente.org"
|
14
|
+
message.remote_id = 1
|
15
|
+
message.remote_uri = "/message/1/"
|
16
|
+
message.subject.should eql "Hey this is a subject"
|
17
|
+
message.content.should eql "Hey this is a content"
|
18
|
+
message.remote_id.should eql 1
|
19
|
+
message.remote_uri.should eql "/message/1/"
|
20
|
+
end
|
21
|
+
it "can have a writeitinstance" do
|
22
|
+
message = Message.new
|
23
|
+
message.subject = "subject"
|
24
|
+
message.content = "content"
|
25
|
+
writeitinstance = WriteItInstance.new
|
26
|
+
writeitinstance.url = '/instances/1/'
|
27
|
+
|
28
|
+
message.writeitinstance = writeitinstance
|
29
|
+
|
30
|
+
message.writeitinstance.should eql writeitinstance
|
31
|
+
end
|
32
|
+
it "can have recipients" do
|
33
|
+
message = Message.new
|
34
|
+
message.recipients = ['recipient 1']
|
35
|
+
message.recipients.should_not be_nil
|
36
|
+
message.recipients[0].should eql 'recipient 1'
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
context "Interacting through the API" do
|
41
|
+
before(:each) do
|
42
|
+
@writeitinstance = WriteItInstance.new
|
43
|
+
@writeitinstance.url = '/api/v1/instance/1/'
|
44
|
+
@writeitinstance.base_url = 'http://127.0.0.1.xip.io:3001'
|
45
|
+
@writeitinstance.username = 'admin'
|
46
|
+
@writeitinstance.api_key = 'a'
|
47
|
+
end
|
48
|
+
it "pushes to the API" do
|
49
|
+
message = Message.new
|
50
|
+
message.subject = "this is the subject"
|
51
|
+
message.content = "this is the content"
|
52
|
+
message.author_name = "Fiera"
|
53
|
+
message.author_email = "fiera@ciudadanointeligente.org"
|
54
|
+
message.writeitinstance = @writeitinstance
|
55
|
+
message.recipients = ['http://localhost:3002/api/persons/5008048c7a317e126400046d', 'http://localhost:3002/api/persons/500804717a317e126400005e']
|
56
|
+
message.push_to_api
|
57
|
+
|
58
|
+
|
59
|
+
message.remote_id.should_not be_nil
|
60
|
+
message.remote_uri.should_not be_nil
|
61
|
+
|
62
|
+
#Here comes the biggest assert
|
63
|
+
response = RestClient.get @writeitinstance.base_url + message.remote_uri ,
|
64
|
+
{:params => {:format => 'json',
|
65
|
+
'username' => @writeitinstance.username,
|
66
|
+
'api_key' => @writeitinstance.api_key}}
|
67
|
+
response.code.should equal 200
|
68
|
+
created_message = JSON.parse(response.body)
|
69
|
+
created_message['content'].should eql "this is the content"
|
70
|
+
created_message['subject'].should eql "this is the subject"
|
71
|
+
created_message['author_name'].should eql "Fiera"
|
72
|
+
created_message['author_email'].should eql "fiera@ciudadanointeligente.org"
|
73
|
+
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
77
|
+
context "Validation" do
|
78
|
+
it "raises error when no recipients" do
|
79
|
+
message = Message.new
|
80
|
+
message.subject = "this is the subject"
|
81
|
+
message.content = "this is the content"
|
82
|
+
message.author_name = "Fiera"
|
83
|
+
message.author_email = "fiera@ciudadanointeligente.org"
|
84
|
+
message.writeitinstance = @writeitinstance
|
85
|
+
|
86
|
+
#I haven't even created the recipients thing
|
87
|
+
|
88
|
+
expect { message.push_to_api }.to raise_error(ArgumentError, "No recipients, please add some first")
|
89
|
+
|
90
|
+
#look empty
|
91
|
+
message.recipients = []
|
92
|
+
|
93
|
+
expect { message.push_to_api }.to raise_error(ArgumentError, "No recipients, please add some first")
|
94
|
+
|
95
|
+
end
|
96
|
+
it "raises an error when there is no author" do
|
97
|
+
message = Message.new
|
98
|
+
message.subject = "this is the subject"
|
99
|
+
message.content = "this is the content"
|
100
|
+
message.writeitinstance = @writeitinstance
|
101
|
+
message.recipients = ['http://localhost:3002/api/persons/5008048c7a317e126400046d',
|
102
|
+
'http://localhost:3002/api/persons/500804717a317e126400005e']
|
103
|
+
|
104
|
+
expect { message.push_to_api }.to raise_error(ArgumentError, "No author, set it first")
|
105
|
+
end
|
106
|
+
it "raises an error when there is no writeitinstance" do
|
107
|
+
message = Message.new
|
108
|
+
message.subject = "this is the subject"
|
109
|
+
message.content = "this is the content"
|
110
|
+
message.author_name = "Fiera"
|
111
|
+
message.author_email = "fiera@ciudadanointeligente.org"
|
112
|
+
message.recipients = ['http://localhost:3002/api/persons/5008048c7a317e126400046d',
|
113
|
+
'http://localhost:3002/api/persons/500804717a317e126400005e']
|
114
|
+
|
115
|
+
expect { message.push_to_api }.to raise_error(ArgumentError, "No instance, please set one first")
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
end
|
120
|
+
|
121
|
+
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# Require this file using `require "spec_helper"` to ensure that it is only
|
4
|
+
# loaded once.
|
5
|
+
#
|
6
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
7
|
+
RSpec.configure do |config|
|
8
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
9
|
+
config.run_all_when_everything_filtered = true
|
10
|
+
config.filter_run :focus
|
11
|
+
|
12
|
+
# Run specs in random order to surface order dependencies. If you find an
|
13
|
+
# order dependency and want to debug it, you can fix the order by providing
|
14
|
+
# the seed, which is printed after each run.
|
15
|
+
# --seed 1234
|
16
|
+
config.order = 'random'
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
require 'coveralls'
|
21
|
+
Coveralls.wear!
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require "models/writeitinstance"
|
2
|
+
require "spec_helper"
|
3
|
+
|
4
|
+
describe WriteItInstance do
|
5
|
+
context "The creation" do
|
6
|
+
it "has a url wich references the remote instance" do
|
7
|
+
writeitinstance = WriteItInstance.new
|
8
|
+
writeitinstance.url = '/instances/1/'
|
9
|
+
writeitinstance.base_url = 'http://localhost:3001'
|
10
|
+
writeitinstance.username = 'username'
|
11
|
+
writeitinstance.api_key = 'api_key'
|
12
|
+
writeitinstance.base_url.should eql 'http://localhost:3001'
|
13
|
+
writeitinstance.url.should eql '/instances/1/'
|
14
|
+
writeitinstance.username.should eql 'username'
|
15
|
+
writeitinstance.api_key.should eql 'api_key'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
context "Validation" do
|
19
|
+
it "passes when the instance exists" do
|
20
|
+
writeitinstance = WriteItInstance.new
|
21
|
+
#this instance does not exist
|
22
|
+
writeitinstance.url = '/instance/1/'
|
23
|
+
#this instance does not exist
|
24
|
+
writeitinstance.base_url = 'http://localhost:3001'
|
25
|
+
writeitinstance.username = 'admin'
|
26
|
+
writeitinstance.api_key = 'a'
|
27
|
+
|
28
|
+
writeitinstance.validate().should be true
|
29
|
+
|
30
|
+
end
|
31
|
+
it "fails when the instance does not exist" do
|
32
|
+
writeitinstance = WriteItInstance.new
|
33
|
+
#this instance does not exist
|
34
|
+
writeitinstance.url = '/instances/2/'
|
35
|
+
#this instance does not exist
|
36
|
+
writeitinstance.base_url = 'http://localhost:3001'
|
37
|
+
writeitinstance.username = 'admin'
|
38
|
+
writeitinstance.api_key = 'a'
|
39
|
+
|
40
|
+
writeitinstance.validate().should be false
|
41
|
+
writeitinstance.errors.should include("404 Resource Not Found")
|
42
|
+
end
|
43
|
+
|
44
|
+
it "fails when it is not the owner" do
|
45
|
+
writeitinstance = WriteItInstance.new
|
46
|
+
#this instance does not exist
|
47
|
+
writeitinstance.url = '/instance/1/'
|
48
|
+
#this instance does not exist
|
49
|
+
writeitinstance.base_url = 'http://localhost:3001'
|
50
|
+
#wrong user and api_key
|
51
|
+
writeitinstance.username = 'adminaa'
|
52
|
+
writeitinstance.api_key = 'aaa'
|
53
|
+
|
54
|
+
writeitinstance.validate().should be false
|
55
|
+
writeitinstance.errors.should include("401 Unauthorized")
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
set -e
|
4
|
+
|
5
|
+
# this script will fetch a copy of writeit and start it running locally.
|
6
|
+
# Assumes that nodejs is installed, and that mongodb is running locally and allows
|
7
|
+
# databases to be created without auth.
|
8
|
+
#
|
9
|
+
# Requirements for a RedHat/CentOS/Fedora machine:
|
10
|
+
# $sudo yum install python-virtualenv
|
11
|
+
#
|
12
|
+
# This is not a robust way to run the api, it is intended for local dev and for
|
13
|
+
# testing on travis-ci.
|
14
|
+
|
15
|
+
|
16
|
+
# just checkout the master branch
|
17
|
+
# http://stackoverflow.com/a/7349740/5349
|
18
|
+
export DIR=writeit_local_for_testing
|
19
|
+
export BRANCH=master
|
20
|
+
export REMOTE_REPO=https://github.com/ciudadanointeligente/write-it.git
|
21
|
+
export PORT=3001
|
22
|
+
export VIRTUALENV=writeit_for_testing
|
23
|
+
|
24
|
+
if [ ! -e $DIR ]; then mkdir $DIR; fi
|
25
|
+
cd $DIR;
|
26
|
+
|
27
|
+
# If needed clone the repo
|
28
|
+
if [ ! -e done.txt ]; then
|
29
|
+
git init;
|
30
|
+
git remote add -t $BRANCH -f origin $REMOTE_REPO;
|
31
|
+
git checkout $BRANCH;
|
32
|
+
|
33
|
+
# set up the environment
|
34
|
+
virtualenv $VIRTUALENV
|
35
|
+
source $VIRTUALENV/bin/activate
|
36
|
+
pip install -r requirements.txt
|
37
|
+
python manage.py syncdb --noinput
|
38
|
+
python manage.py migrate --noinput
|
39
|
+
python manage.py loaddata ../writeit_example_data.yaml
|
40
|
+
|
41
|
+
touch done.txt;
|
42
|
+
else
|
43
|
+
git pull origin $BRANCH
|
44
|
+
source $VIRTUALENV/bin/activate
|
45
|
+
pip install -r requirements.txt
|
46
|
+
fi
|
47
|
+
|
48
|
+
|
49
|
+
# Run the server in the background. Send access logging to file.
|
50
|
+
python manage.py runserver $PORT > writeit_access.log &
|
51
|
+
|
52
|
+
# give it a chance to start and then print out the url to it
|
53
|
+
sleep 2
|
54
|
+
echo "Service should now be running on http://localhost:$PORT/en/"
|
@@ -0,0 +1,26 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
set -e
|
4
|
+
|
5
|
+
export DIR=writeit_local_for_testing
|
6
|
+
export VIRTUALENV=writeit_for_testing
|
7
|
+
export YAML_FILE_NAME="$1"
|
8
|
+
|
9
|
+
cd $DIR;
|
10
|
+
source $VIRTUALENV/bin/activate;
|
11
|
+
|
12
|
+
export YAML_FILE_NAME="$1";
|
13
|
+
|
14
|
+
if [ ! -e current_data.txt ]; then touch current_data.txt; fi
|
15
|
+
|
16
|
+
CURRENT_DATA=`cat current_data.txt`;
|
17
|
+
|
18
|
+
if [ "$CURRENT_DATA" != "$YAML_FILE_NAME" ]
|
19
|
+
then
|
20
|
+
echo "$YAML_FILE_NAME" > current_data.txt;
|
21
|
+
python manage.py flush --noinput
|
22
|
+
python manage.py loaddata $YAML_FILE_NAME;
|
23
|
+
|
24
|
+
else
|
25
|
+
echo "$CURRENT_DATA and $YAML_FILE_NAME are equal";
|
26
|
+
fi
|
@@ -0,0 +1,12 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = 'writeit-rails'
|
3
|
+
s.version = '0.0.1'
|
4
|
+
s.date = '2013-12-22'
|
5
|
+
s.summary = "This Gem provides a basic api client for Write-it"
|
6
|
+
s.description = "A simple hello world gem"
|
7
|
+
s.authors = ["Fundación Ciudadano Inteligente"]
|
8
|
+
s.email = 'lab@ciudadanointeligente.org'
|
9
|
+
s.files = `git ls-files`.split("\n")
|
10
|
+
s.homepage = 'http://rubygems.org/gems/writeit-rails'
|
11
|
+
s.license = 'Apache License, Version 2.0'
|
12
|
+
end
|
@@ -0,0 +1,470 @@
|
|
1
|
+
- fields: {domain: '127.0.0.1.xip.io:3001', name: '127.0.0.1.xip.io:3001'}
|
2
|
+
model: sites.site
|
3
|
+
pk: 1
|
4
|
+
- fields: {codename: add_permission, content_type: 1, name: Can add permission}
|
5
|
+
model: auth.permission
|
6
|
+
pk: 1
|
7
|
+
- fields: {codename: change_permission, content_type: 1, name: Can change permission}
|
8
|
+
model: auth.permission
|
9
|
+
pk: 2
|
10
|
+
- fields: {codename: delete_permission, content_type: 1, name: Can delete permission}
|
11
|
+
model: auth.permission
|
12
|
+
pk: 3
|
13
|
+
- fields: {codename: add_group, content_type: 2, name: Can add group}
|
14
|
+
model: auth.permission
|
15
|
+
pk: 4
|
16
|
+
- fields: {codename: change_group, content_type: 2, name: Can change group}
|
17
|
+
model: auth.permission
|
18
|
+
pk: 5
|
19
|
+
- fields: {codename: delete_group, content_type: 2, name: Can delete group}
|
20
|
+
model: auth.permission
|
21
|
+
pk: 6
|
22
|
+
- fields: {codename: add_user, content_type: 3, name: Can add user}
|
23
|
+
model: auth.permission
|
24
|
+
pk: 7
|
25
|
+
- fields: {codename: change_user, content_type: 3, name: Can change user}
|
26
|
+
model: auth.permission
|
27
|
+
pk: 8
|
28
|
+
- fields: {codename: delete_user, content_type: 3, name: Can delete user}
|
29
|
+
model: auth.permission
|
30
|
+
pk: 9
|
31
|
+
- fields: {codename: add_contenttype, content_type: 4, name: Can add content type}
|
32
|
+
model: auth.permission
|
33
|
+
pk: 10
|
34
|
+
- fields: {codename: change_contenttype, content_type: 4, name: Can change content
|
35
|
+
type}
|
36
|
+
model: auth.permission
|
37
|
+
pk: 11
|
38
|
+
- fields: {codename: delete_contenttype, content_type: 4, name: Can delete content
|
39
|
+
type}
|
40
|
+
model: auth.permission
|
41
|
+
pk: 12
|
42
|
+
- fields: {codename: add_session, content_type: 5, name: Can add session}
|
43
|
+
model: auth.permission
|
44
|
+
pk: 13
|
45
|
+
- fields: {codename: change_session, content_type: 5, name: Can change session}
|
46
|
+
model: auth.permission
|
47
|
+
pk: 14
|
48
|
+
- fields: {codename: delete_session, content_type: 5, name: Can delete session}
|
49
|
+
model: auth.permission
|
50
|
+
pk: 15
|
51
|
+
- fields: {codename: add_site, content_type: 6, name: Can add site}
|
52
|
+
model: auth.permission
|
53
|
+
pk: 16
|
54
|
+
- fields: {codename: change_site, content_type: 6, name: Can change site}
|
55
|
+
model: auth.permission
|
56
|
+
pk: 17
|
57
|
+
- fields: {codename: delete_site, content_type: 6, name: Can delete site}
|
58
|
+
model: auth.permission
|
59
|
+
pk: 18
|
60
|
+
- fields: {codename: add_pluginpoint, content_type: 7, name: Can add plugin point}
|
61
|
+
model: auth.permission
|
62
|
+
pk: 19
|
63
|
+
- fields: {codename: change_pluginpoint, content_type: 7, name: Can change plugin
|
64
|
+
point}
|
65
|
+
model: auth.permission
|
66
|
+
pk: 20
|
67
|
+
- fields: {codename: delete_pluginpoint, content_type: 7, name: Can delete plugin
|
68
|
+
point}
|
69
|
+
model: auth.permission
|
70
|
+
pk: 21
|
71
|
+
- fields: {codename: add_plugin, content_type: 8, name: Can add plugin}
|
72
|
+
model: auth.permission
|
73
|
+
pk: 22
|
74
|
+
- fields: {codename: change_plugin, content_type: 8, name: Can change plugin}
|
75
|
+
model: auth.permission
|
76
|
+
pk: 23
|
77
|
+
- fields: {codename: delete_plugin, content_type: 8, name: Can delete plugin}
|
78
|
+
model: auth.permission
|
79
|
+
pk: 24
|
80
|
+
- fields: {codename: add_migrationhistory, content_type: 9, name: Can add migration
|
81
|
+
history}
|
82
|
+
model: auth.permission
|
83
|
+
pk: 25
|
84
|
+
- fields: {codename: change_migrationhistory, content_type: 9, name: Can change migration
|
85
|
+
history}
|
86
|
+
model: auth.permission
|
87
|
+
pk: 26
|
88
|
+
- fields: {codename: delete_migrationhistory, content_type: 9, name: Can delete migration
|
89
|
+
history}
|
90
|
+
model: auth.permission
|
91
|
+
pk: 27
|
92
|
+
- fields: {codename: add_logentry, content_type: 10, name: Can add log entry}
|
93
|
+
model: auth.permission
|
94
|
+
pk: 28
|
95
|
+
- fields: {codename: change_logentry, content_type: 10, name: Can change log entry}
|
96
|
+
model: auth.permission
|
97
|
+
pk: 29
|
98
|
+
- fields: {codename: delete_logentry, content_type: 10, name: Can delete log entry}
|
99
|
+
model: auth.permission
|
100
|
+
pk: 30
|
101
|
+
- fields: {codename: add_writeitinstance, content_type: 11, name: Can add write it
|
102
|
+
instance}
|
103
|
+
model: auth.permission
|
104
|
+
pk: 31
|
105
|
+
- fields: {codename: change_writeitinstance, content_type: 11, name: Can change write
|
106
|
+
it instance}
|
107
|
+
model: auth.permission
|
108
|
+
pk: 32
|
109
|
+
- fields: {codename: delete_writeitinstance, content_type: 11, name: Can delete write
|
110
|
+
it instance}
|
111
|
+
model: auth.permission
|
112
|
+
pk: 33
|
113
|
+
- fields: {codename: add_membership, content_type: 12, name: Can add membership}
|
114
|
+
model: auth.permission
|
115
|
+
pk: 34
|
116
|
+
- fields: {codename: change_membership, content_type: 12, name: Can change membership}
|
117
|
+
model: auth.permission
|
118
|
+
pk: 35
|
119
|
+
- fields: {codename: delete_membership, content_type: 12, name: Can delete membership}
|
120
|
+
model: auth.permission
|
121
|
+
pk: 36
|
122
|
+
- fields: {codename: add_messagerecord, content_type: 13, name: Can add message record}
|
123
|
+
model: auth.permission
|
124
|
+
pk: 37
|
125
|
+
- fields: {codename: change_messagerecord, content_type: 13, name: Can change message
|
126
|
+
record}
|
127
|
+
model: auth.permission
|
128
|
+
pk: 38
|
129
|
+
- fields: {codename: delete_messagerecord, content_type: 13, name: Can delete message
|
130
|
+
record}
|
131
|
+
model: auth.permission
|
132
|
+
pk: 39
|
133
|
+
- fields: {codename: add_message, content_type: 14, name: Can add message}
|
134
|
+
model: auth.permission
|
135
|
+
pk: 40
|
136
|
+
- fields: {codename: change_message, content_type: 14, name: Can change message}
|
137
|
+
model: auth.permission
|
138
|
+
pk: 41
|
139
|
+
- fields: {codename: delete_message, content_type: 14, name: Can delete message}
|
140
|
+
model: auth.permission
|
141
|
+
pk: 42
|
142
|
+
- fields: {codename: add_answer, content_type: 15, name: Can add answer}
|
143
|
+
model: auth.permission
|
144
|
+
pk: 43
|
145
|
+
- fields: {codename: change_answer, content_type: 15, name: Can change answer}
|
146
|
+
model: auth.permission
|
147
|
+
pk: 44
|
148
|
+
- fields: {codename: delete_answer, content_type: 15, name: Can delete answer}
|
149
|
+
model: auth.permission
|
150
|
+
pk: 45
|
151
|
+
- fields: {codename: add_outboundmessage, content_type: 16, name: Can add outbound
|
152
|
+
message}
|
153
|
+
model: auth.permission
|
154
|
+
pk: 46
|
155
|
+
- fields: {codename: change_outboundmessage, content_type: 16, name: Can change outbound
|
156
|
+
message}
|
157
|
+
model: auth.permission
|
158
|
+
pk: 47
|
159
|
+
- fields: {codename: delete_outboundmessage, content_type: 16, name: Can delete outbound
|
160
|
+
message}
|
161
|
+
model: auth.permission
|
162
|
+
pk: 48
|
163
|
+
- fields: {codename: add_outboundmessageidentifier, content_type: 17, name: Can add
|
164
|
+
outbound message identifier}
|
165
|
+
model: auth.permission
|
166
|
+
pk: 49
|
167
|
+
- fields: {codename: change_outboundmessageidentifier, content_type: 17, name: Can
|
168
|
+
change outbound message identifier}
|
169
|
+
model: auth.permission
|
170
|
+
pk: 50
|
171
|
+
- fields: {codename: delete_outboundmessageidentifier, content_type: 17, name: Can
|
172
|
+
delete outbound message identifier}
|
173
|
+
model: auth.permission
|
174
|
+
pk: 51
|
175
|
+
- fields: {codename: add_outboundmessagepluginrecord, content_type: 18, name: Can
|
176
|
+
add outbound message plugin record}
|
177
|
+
model: auth.permission
|
178
|
+
pk: 52
|
179
|
+
- fields: {codename: change_outboundmessagepluginrecord, content_type: 18, name: Can
|
180
|
+
change outbound message plugin record}
|
181
|
+
model: auth.permission
|
182
|
+
pk: 53
|
183
|
+
- fields: {codename: delete_outboundmessagepluginrecord, content_type: 18, name: Can
|
184
|
+
delete outbound message plugin record}
|
185
|
+
model: auth.permission
|
186
|
+
pk: 54
|
187
|
+
- fields: {codename: add_confirmation, content_type: 19, name: Can add confirmation}
|
188
|
+
model: auth.permission
|
189
|
+
pk: 55
|
190
|
+
- fields: {codename: change_confirmation, content_type: 19, name: Can change confirmation}
|
191
|
+
model: auth.permission
|
192
|
+
pk: 56
|
193
|
+
- fields: {codename: delete_confirmation, content_type: 19, name: Can delete confirmation}
|
194
|
+
model: auth.permission
|
195
|
+
pk: 57
|
196
|
+
- fields: {codename: add_moderation, content_type: 20, name: Can add moderation}
|
197
|
+
model: auth.permission
|
198
|
+
pk: 58
|
199
|
+
- fields: {codename: change_moderation, content_type: 20, name: Can change moderation}
|
200
|
+
model: auth.permission
|
201
|
+
pk: 59
|
202
|
+
- fields: {codename: delete_moderation, content_type: 20, name: Can delete moderation}
|
203
|
+
model: auth.permission
|
204
|
+
pk: 60
|
205
|
+
- fields: {codename: add_answerwebhook, content_type: 21, name: Can add answer web
|
206
|
+
hook}
|
207
|
+
model: auth.permission
|
208
|
+
pk: 61
|
209
|
+
- fields: {codename: change_answerwebhook, content_type: 21, name: Can change answer
|
210
|
+
web hook}
|
211
|
+
model: auth.permission
|
212
|
+
pk: 62
|
213
|
+
- fields: {codename: delete_answerwebhook, content_type: 21, name: Can delete answer
|
214
|
+
web hook}
|
215
|
+
model: auth.permission
|
216
|
+
pk: 63
|
217
|
+
- fields: {codename: add_subscriber, content_type: 22, name: Can add subscriber}
|
218
|
+
model: auth.permission
|
219
|
+
pk: 64
|
220
|
+
- fields: {codename: change_subscriber, content_type: 22, name: Can change subscriber}
|
221
|
+
model: auth.permission
|
222
|
+
pk: 65
|
223
|
+
- fields: {codename: delete_subscriber, content_type: 22, name: Can delete subscriber}
|
224
|
+
model: auth.permission
|
225
|
+
pk: 66
|
226
|
+
- fields: {codename: add_newanswernotificationtemplate, content_type: 23, name: Can
|
227
|
+
add new answer notification template}
|
228
|
+
model: auth.permission
|
229
|
+
pk: 67
|
230
|
+
- fields: {codename: change_newanswernotificationtemplate, content_type: 23, name: Can
|
231
|
+
change new answer notification template}
|
232
|
+
model: auth.permission
|
233
|
+
pk: 68
|
234
|
+
- fields: {codename: delete_newanswernotificationtemplate, content_type: 23, name: Can
|
235
|
+
delete new answer notification template}
|
236
|
+
model: auth.permission
|
237
|
+
pk: 69
|
238
|
+
- fields: {codename: add_ratelimiter, content_type: 24, name: Can add rate limiter}
|
239
|
+
model: auth.permission
|
240
|
+
pk: 70
|
241
|
+
- fields: {codename: change_ratelimiter, content_type: 24, name: Can change rate limiter}
|
242
|
+
model: auth.permission
|
243
|
+
pk: 71
|
244
|
+
- fields: {codename: delete_ratelimiter, content_type: 24, name: Can delete rate limiter}
|
245
|
+
model: auth.permission
|
246
|
+
pk: 72
|
247
|
+
- fields: {codename: add_apiinstance, content_type: 25, name: Can add api instance}
|
248
|
+
model: auth.permission
|
249
|
+
pk: 73
|
250
|
+
- fields: {codename: change_apiinstance, content_type: 25, name: Can change api instance}
|
251
|
+
model: auth.permission
|
252
|
+
pk: 74
|
253
|
+
- fields: {codename: delete_apiinstance, content_type: 25, name: Can delete api instance}
|
254
|
+
model: auth.permission
|
255
|
+
pk: 75
|
256
|
+
- fields: {codename: add_person, content_type: 26, name: Can add person}
|
257
|
+
model: auth.permission
|
258
|
+
pk: 76
|
259
|
+
- fields: {codename: change_person, content_type: 26, name: Can change person}
|
260
|
+
model: auth.permission
|
261
|
+
pk: 77
|
262
|
+
- fields: {codename: delete_person, content_type: 26, name: Can delete person}
|
263
|
+
model: auth.permission
|
264
|
+
pk: 78
|
265
|
+
- fields: {codename: add_contacttype, content_type: 27, name: Can add contact type}
|
266
|
+
model: auth.permission
|
267
|
+
pk: 79
|
268
|
+
- fields: {codename: change_contacttype, content_type: 27, name: Can change contact
|
269
|
+
type}
|
270
|
+
model: auth.permission
|
271
|
+
pk: 80
|
272
|
+
- fields: {codename: delete_contacttype, content_type: 27, name: Can delete contact
|
273
|
+
type}
|
274
|
+
model: auth.permission
|
275
|
+
pk: 81
|
276
|
+
- fields: {codename: add_contact, content_type: 28, name: Can add contact}
|
277
|
+
model: auth.permission
|
278
|
+
pk: 82
|
279
|
+
- fields: {codename: change_contact, content_type: 28, name: Can change contact}
|
280
|
+
model: auth.permission
|
281
|
+
pk: 83
|
282
|
+
- fields: {codename: delete_contact, content_type: 28, name: Can delete contact}
|
283
|
+
model: auth.permission
|
284
|
+
pk: 84
|
285
|
+
- fields: {codename: add_mailittemplate, content_type: 29, name: Can add mail it template}
|
286
|
+
model: auth.permission
|
287
|
+
pk: 85
|
288
|
+
- fields: {codename: change_mailittemplate, content_type: 29, name: Can change mail
|
289
|
+
it template}
|
290
|
+
model: auth.permission
|
291
|
+
pk: 86
|
292
|
+
- fields: {codename: delete_mailittemplate, content_type: 29, name: Can delete mail
|
293
|
+
it template}
|
294
|
+
model: auth.permission
|
295
|
+
pk: 87
|
296
|
+
- fields: {codename: add_bouncedmessagerecord, content_type: 30, name: Can add bounced
|
297
|
+
message record}
|
298
|
+
model: auth.permission
|
299
|
+
pk: 88
|
300
|
+
- fields: {codename: change_bouncedmessagerecord, content_type: 30, name: Can change
|
301
|
+
bounced message record}
|
302
|
+
model: auth.permission
|
303
|
+
pk: 89
|
304
|
+
- fields: {codename: delete_bouncedmessagerecord, content_type: 30, name: Can delete
|
305
|
+
bounced message record}
|
306
|
+
model: auth.permission
|
307
|
+
pk: 90
|
308
|
+
- fields: {codename: add_taskmeta, content_type: 31, name: Can add task state}
|
309
|
+
model: auth.permission
|
310
|
+
pk: 91
|
311
|
+
- fields: {codename: change_taskmeta, content_type: 31, name: Can change task state}
|
312
|
+
model: auth.permission
|
313
|
+
pk: 92
|
314
|
+
- fields: {codename: delete_taskmeta, content_type: 31, name: Can delete task state}
|
315
|
+
model: auth.permission
|
316
|
+
pk: 93
|
317
|
+
- fields: {codename: add_tasksetmeta, content_type: 32, name: Can add saved group
|
318
|
+
result}
|
319
|
+
model: auth.permission
|
320
|
+
pk: 94
|
321
|
+
- fields: {codename: change_tasksetmeta, content_type: 32, name: Can change saved
|
322
|
+
group result}
|
323
|
+
model: auth.permission
|
324
|
+
pk: 95
|
325
|
+
- fields: {codename: delete_tasksetmeta, content_type: 32, name: Can delete saved
|
326
|
+
group result}
|
327
|
+
model: auth.permission
|
328
|
+
pk: 96
|
329
|
+
- fields: {codename: add_intervalschedule, content_type: 33, name: Can add interval}
|
330
|
+
model: auth.permission
|
331
|
+
pk: 97
|
332
|
+
- fields: {codename: change_intervalschedule, content_type: 33, name: Can change interval}
|
333
|
+
model: auth.permission
|
334
|
+
pk: 98
|
335
|
+
- fields: {codename: delete_intervalschedule, content_type: 33, name: Can delete interval}
|
336
|
+
model: auth.permission
|
337
|
+
pk: 99
|
338
|
+
- fields: {codename: add_crontabschedule, content_type: 34, name: Can add crontab}
|
339
|
+
model: auth.permission
|
340
|
+
pk: 100
|
341
|
+
- fields: {codename: change_crontabschedule, content_type: 34, name: Can change crontab}
|
342
|
+
model: auth.permission
|
343
|
+
pk: 101
|
344
|
+
- fields: {codename: delete_crontabschedule, content_type: 34, name: Can delete crontab}
|
345
|
+
model: auth.permission
|
346
|
+
pk: 102
|
347
|
+
- fields: {codename: add_periodictasks, content_type: 35, name: Can add periodic tasks}
|
348
|
+
model: auth.permission
|
349
|
+
pk: 103
|
350
|
+
- fields: {codename: change_periodictasks, content_type: 35, name: Can change periodic
|
351
|
+
tasks}
|
352
|
+
model: auth.permission
|
353
|
+
pk: 104
|
354
|
+
- fields: {codename: delete_periodictasks, content_type: 35, name: Can delete periodic
|
355
|
+
tasks}
|
356
|
+
model: auth.permission
|
357
|
+
pk: 105
|
358
|
+
- fields: {codename: add_periodictask, content_type: 36, name: Can add periodic task}
|
359
|
+
model: auth.permission
|
360
|
+
pk: 106
|
361
|
+
- fields: {codename: change_periodictask, content_type: 36, name: Can change periodic
|
362
|
+
task}
|
363
|
+
model: auth.permission
|
364
|
+
pk: 107
|
365
|
+
- fields: {codename: delete_periodictask, content_type: 36, name: Can delete periodic
|
366
|
+
task}
|
367
|
+
model: auth.permission
|
368
|
+
pk: 108
|
369
|
+
- fields: {codename: add_workerstate, content_type: 37, name: Can add worker}
|
370
|
+
model: auth.permission
|
371
|
+
pk: 109
|
372
|
+
- fields: {codename: change_workerstate, content_type: 37, name: Can change worker}
|
373
|
+
model: auth.permission
|
374
|
+
pk: 110
|
375
|
+
- fields: {codename: delete_workerstate, content_type: 37, name: Can delete worker}
|
376
|
+
model: auth.permission
|
377
|
+
pk: 111
|
378
|
+
- fields: {codename: add_taskstate, content_type: 38, name: Can add task}
|
379
|
+
model: auth.permission
|
380
|
+
pk: 112
|
381
|
+
- fields: {codename: change_taskstate, content_type: 38, name: Can change task}
|
382
|
+
model: auth.permission
|
383
|
+
pk: 113
|
384
|
+
- fields: {codename: delete_taskstate, content_type: 38, name: Can delete task}
|
385
|
+
model: auth.permission
|
386
|
+
pk: 114
|
387
|
+
- fields: {codename: add_apiaccess, content_type: 39, name: Can add api access}
|
388
|
+
model: auth.permission
|
389
|
+
pk: 115
|
390
|
+
- fields: {codename: change_apiaccess, content_type: 39, name: Can change api access}
|
391
|
+
model: auth.permission
|
392
|
+
pk: 116
|
393
|
+
- fields: {codename: delete_apiaccess, content_type: 39, name: Can delete api access}
|
394
|
+
model: auth.permission
|
395
|
+
pk: 117
|
396
|
+
- fields: {codename: add_apikey, content_type: 40, name: Can add api key}
|
397
|
+
model: auth.permission
|
398
|
+
pk: 118
|
399
|
+
- fields: {codename: change_apikey, content_type: 40, name: Can change api key}
|
400
|
+
model: auth.permission
|
401
|
+
pk: 119
|
402
|
+
- fields: {codename: delete_apikey, content_type: 40, name: Can delete api key}
|
403
|
+
model: auth.permission
|
404
|
+
pk: 120
|
405
|
+
- fields:
|
406
|
+
date_joined: 2013-12-18 21:29:08.466407+00:00
|
407
|
+
email: admin@admines.cl
|
408
|
+
first_name: ''
|
409
|
+
groups: []
|
410
|
+
is_active: true
|
411
|
+
is_staff: true
|
412
|
+
is_superuser: true
|
413
|
+
last_login: 2013-12-18 21:33:59.610540+00:00
|
414
|
+
last_name: ''
|
415
|
+
password: pbkdf2_sha256$12000$1Q4Q7Eoc7dYc$1qGRAIa0/KLouN2JLX4ZEuvZJgzzYhj9/U2PvLdEHcM=
|
416
|
+
user_permissions: []
|
417
|
+
username: admin
|
418
|
+
model: auth.user
|
419
|
+
pk: 1
|
420
|
+
- fields: {allow_messages_using_form: true, moderation_needed_in_all_messages: false,
|
421
|
+
name: Monitoreo Parlamentario Chile, notify_owner_when_new_answer: false, owner: 1,
|
422
|
+
rate_limiter: 0, slug: monitoreo-parlamentario-chile}
|
423
|
+
model: nuntium.writeitinstance
|
424
|
+
pk: 1
|
425
|
+
- fields: {person: 1, writeitinstance: 1}
|
426
|
+
model: nuntium.membership
|
427
|
+
pk: 1
|
428
|
+
- fields: {person: 2, writeitinstance: 1}
|
429
|
+
model: nuntium.membership
|
430
|
+
pk: 2
|
431
|
+
- fields: {subject_template: '%(person)s has answered to your message %(message)s',
|
432
|
+
template_html: "Dear {{user}}:\n\nWe received an answer from {{person}} to your
|
433
|
+
message \"{{message.subject}}\" and the answer is:\n\n{{answer.content}}\n\nThanks
|
434
|
+
for using Write-It\n-- \nThe Write-it Team", template_text: "Dear {{user}}:\n\nWe
|
435
|
+
received an answer from {{person}} to your message \"{{message.subject}}\" and
|
436
|
+
the answer is:\n\n{{answer.content}}\n\nThanks for using Write-It\n-- \nThe
|
437
|
+
Write-it Team", writeitinstance: 1}
|
438
|
+
model: nuntium.newanswernotificationtemplate
|
439
|
+
pk: 1
|
440
|
+
- fields: {pythonpath: nuntium.plugins.OutputPlugin, status: 0, title: OutputPlugin}
|
441
|
+
model: djangoplugins.pluginpoint
|
442
|
+
pk: 1
|
443
|
+
- fields: {_order: 0, index: 0, name: mail-channel, point: 1, pythonpath: mailit.MailChannel,
|
444
|
+
status: 0, title: Mail Channel}
|
445
|
+
model: djangoplugins.plugin
|
446
|
+
pk: 1
|
447
|
+
- fields: {url: 'http://localhost:3002/api'}
|
448
|
+
model: popit.apiinstance
|
449
|
+
pk: 1
|
450
|
+
- fields: {api_instance: 1, image: '', name: Gonzalo Arenas Hodar, popit_id: 5008048c7a317e126400046d,
|
451
|
+
popit_url: 'http://localhost:3002/api/persons/5008048c7a317e126400046d', summary: ''}
|
452
|
+
model: popit.person
|
453
|
+
pk: 1
|
454
|
+
- fields: {api_instance: 1, image: '', name: Orlando Vargas Pizarro, popit_id: 500804717a317e126400005e,
|
455
|
+
popit_url: 'http://localhost:3002/api/persons/500804717a317e126400005e', summary: ''}
|
456
|
+
model: popit.person
|
457
|
+
pk: 2
|
458
|
+
- fields: {label_name: email, name: Email}
|
459
|
+
model: contactos.contacttype
|
460
|
+
pk: 1
|
461
|
+
- fields: {contact_type: 1, is_bounced: false, owner: 1, person: 1, value: gonzalo@arenas.cl}
|
462
|
+
model: contactos.contact
|
463
|
+
pk: 1
|
464
|
+
- fields: {contact_type: 1, is_bounced: false, owner: 1, person: 2, value: orlando@vargas.cl}
|
465
|
+
model: contactos.contact
|
466
|
+
pk: 2
|
467
|
+
- fields: {created: ! '2013-12-18 21:41:46+00:00', key: a, user: 1}
|
468
|
+
model: tastypie.apikey
|
469
|
+
pk: 1
|
470
|
+
|
metadata
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: writeit-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Fundación Ciudadano Inteligente
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-12-22 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: A simple hello world gem
|
14
|
+
email: lab@ciudadanointeligente.org
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- .gitignore
|
20
|
+
- .rspec
|
21
|
+
- .travis.yml
|
22
|
+
- Gemfile
|
23
|
+
- Gemfile.lock
|
24
|
+
- LICENSE
|
25
|
+
- README.md
|
26
|
+
- lib/models/message.rb
|
27
|
+
- lib/models/writeitinstance.rb
|
28
|
+
- lib/writeit-rails.rb
|
29
|
+
- rakefile
|
30
|
+
- spec/message_model_spec.rb
|
31
|
+
- spec/spec_helper.rb
|
32
|
+
- spec/writeitinstance_spec.rb
|
33
|
+
- start-local-writeit.bash
|
34
|
+
- update_writeit_data.sh
|
35
|
+
- writeit-rails.gemspec
|
36
|
+
- writeit_example_data.yaml
|
37
|
+
homepage: http://rubygems.org/gems/writeit-rails
|
38
|
+
licenses:
|
39
|
+
- Apache License, Version 2.0
|
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.2.1
|
58
|
+
signing_key:
|
59
|
+
specification_version: 4
|
60
|
+
summary: This Gem provides a basic api client for Write-it
|
61
|
+
test_files: []
|