active_forms 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. data/.gitignore +15 -19
  2. data/.travis.yml +10 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE +3 -1
  5. data/README.md +31 -0
  6. data/Rakefile +3 -49
  7. data/active_forms.gemspec +16 -81
  8. data/lib/active_forms.rb +41 -15
  9. data/lib/active_forms/application.rb +3 -1
  10. data/lib/active_forms/application_print.rb +2 -0
  11. data/lib/active_forms/configuration.rb +3 -1
  12. data/lib/active_forms/entry.rb +51 -0
  13. data/lib/active_forms/entry_printout.rb +22 -0
  14. data/lib/active_forms/form.rb +3 -1
  15. data/lib/active_forms/form_version.rb +19 -0
  16. data/lib/active_forms/mapper.rb +2 -0
  17. data/lib/active_forms/request.rb +27 -8
  18. data/lib/active_forms/token.rb +18 -0
  19. data/lib/active_forms/version.rb +3 -0
  20. data/test/active_forms/application_print_test.rb +2 -0
  21. data/test/active_forms/application_test.rb +2 -0
  22. data/test/active_forms/entry_printout_test.rb +60 -0
  23. data/test/active_forms/entry_test.rb +125 -0
  24. data/test/active_forms/form_test.rb +2 -0
  25. data/test/active_forms/form_version_test.rb +37 -0
  26. data/test/active_forms/mapper_test.rb +2 -0
  27. data/test/active_forms/request_test.rb +14 -12
  28. data/test/active_forms/token_test.rb +33 -0
  29. data/test/active_forms_test.rb +2 -0
  30. data/test/fixtures/get_entries.xml +22 -0
  31. data/test/fixtures/get_entries_single.xml +14 -0
  32. data/test/fixtures/get_entrydata.xml +38 -0
  33. data/test/fixtures/get_entryprintout.xml +15 -0
  34. data/test/fixtures/get_formaccesstokens.xml +12 -0
  35. data/test/fixtures/get_forminfo.xml +21 -0
  36. data/test/fixtures/post_entrydata.xml +12 -0
  37. data/test/test_helper.rb +5 -4
  38. metadata +99 -32
  39. data/.document +0 -5
  40. data/README.rdoc +0 -7
  41. data/VERSION +0 -1
@@ -0,0 +1,33 @@
1
+ # encoding: UTF-8
2
+
3
+ require 'test_helper'
4
+
5
+ class ActiveForms::EntryTest < Test::Unit::TestCase
6
+ context "" do
7
+ setup do
8
+ configure
9
+ end
10
+
11
+ context "when sent ActiveForms::Token.all with multi-response" do
12
+ setup do
13
+ stub_get(/formaccesstokens/, success_response("get_formaccesstokens"))
14
+ @tokens = ActiveForms::Token.all :apiFormCode => 'hipoteka'
15
+ end
16
+
17
+ should "respond with array of entry instances" do
18
+ tokens = []
19
+ ['asdf9j43f349jf23skf', 'asdf9j43fdfg23sksdf', 'asde4gw34tgezrgeskf',
20
+ 'aszxdre5gw345g435kf', 'asdf9zse6zs5WdAwskf'].each do |token_value|
21
+ token = ActiveForms::Token.new(:value => token_value)
22
+ tokens << token
23
+ assert_equal token.value, token_value
24
+ end
25
+
26
+ tokens.each do |token|
27
+ assert @tokens.include?(token)
28
+ end
29
+ assert_equal tokens.size, @tokens.size
30
+ end
31
+ end
32
+ end
33
+ end
@@ -1,3 +1,5 @@
1
+ # encoding: UTF-8
2
+
1
3
  require 'test_helper'
2
4
 
3
5
  class ActiveFormsTest < Test::Unit::TestCase
@@ -0,0 +1,22 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <entries
3
+ xmlns="http://api.activeforms.com"
4
+ apiVersion="3.0"
5
+ >
6
+ <entry
7
+ number="12234"
8
+ formCode="credit_card_entry"
9
+ formVersionCode="version_1"
10
+ date="2007-08-23T12:43:03"
11
+ status="sent"
12
+ isPrintable="true"
13
+ />
14
+ <entry
15
+ number="12235"
16
+ formCode="credit_card_entry"
17
+ formVersionCode="version_1"
18
+ date="2007-08-23T12:44:03"
19
+ status="sent"
20
+ isPrintable="true"
21
+ />
22
+ </entries>
@@ -0,0 +1,14 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <entries
3
+ xmlns="http://api.activeforms.com"
4
+ apiVersion="3.0"
5
+ >
6
+ <entry
7
+ number="12234"
8
+ formCode="credit_card_entry"
9
+ formVersionCode="version_1"
10
+ date="2007-08-23T12:43:03"
11
+ status="sent"
12
+ isPrintable="true"
13
+ />
14
+ </entries>
@@ -0,0 +1,38 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <entryData
3
+ xmlns="http://api.activeforms.com"
4
+ apiVersion="3.0"
5
+ formCode="credit_card_entry"
6
+ formVersionCode="version_1"
7
+ number="23456"
8
+ date="2007-08-23T12:43:03"
9
+ status="sent"
10
+ isPrintable="true"
11
+ >
12
+ <fieldData identifier="last_name">
13
+ <value>Kowalski</value>
14
+ </fieldData>
15
+ <fieldData identifier="typ_karty">
16
+ <value>kredytowa</value>
17
+ </fieldData>
18
+ <fieldData identifier="ubezpieczenie">
19
+ <value>ubezpieczenie_karty</value>
20
+ <value>na_zycie</value>
21
+ </fieldData>
22
+ <fieldData identifier="przetwarzanie_danych">
23
+ <value>YES</value>
24
+ </fieldData>
25
+ <fieldData identifier="data_urodzenia">
26
+ <value>1978-01-12</value>
27
+ </fieldData>
28
+ <fieldData identifier="zdjecie">
29
+ <value>moj_misio.jpg</value>
30
+ <fileContent>/9j/4AAQSkZJRgABAQEASABIAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0a
31
+ HBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIy
32
+ MjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAMABAADASIA</fileContent>
33
+ </fieldData>
34
+ <fieldData identifier="nr_telefonu">
35
+ <value>+48 22 1234567</value>
36
+ </fieldData>
37
+ <fieldData identifier="uwagi"/>
38
+ </entryData>
@@ -0,0 +1,15 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <entryPrintout
3
+ xmlns="http://api.activeforms.com"
4
+ apiVersion="3.0"
5
+ formCode="credit_card_entry"
6
+ formVersionCode="version_1"
7
+ number="23456"
8
+ date="2007-08-23T12:43:03"
9
+ status="sent"
10
+ contentType="application/pdf"
11
+ >
12
+ <printoutContent>
13
+ /9j/4AAQSkZJRgABAQEASABIAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAMABAADASIA
14
+ </printoutContent>
15
+ </entryPrintout>
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <formAccessTokens
3
+ xmlns="http://api.activeforms.com/3.0"
4
+ apiVersion="3.0"
5
+ formCode="hipoteka"
6
+ >
7
+ <token value="asdf9j43f349jf23skf" />
8
+ <token value="asdf9j43fdfg23sksdf" />
9
+ <token value="asde4gw34tgezrgeskf" />
10
+ <token value="aszxdre5gw345g435kf" />
11
+ <token value="asdf9zse6zs5WdAwskf" />
12
+ </formAccessTokens>
@@ -0,0 +1,21 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <formInfo
3
+ xmlns="http://api.activeforms.com/3.0"
4
+ apiVersion="3.0"
5
+ code="hipoteka"
6
+ name="Wniosek do kampanii hipotecznej"
7
+ url="https://www.activeforms.com/bank/wniosek_o_karte_kredytowa"
8
+ mailIntegration="true"
9
+ accessType="public"
10
+ authKey="as432w3fq24r"
11
+ >
12
+ <formVersion code="1.0" name="Podstawowa" status="active"
13
+ description="Pierwsza wersja wniosku"
14
+ creationDate="2007-01-01 12:00:00+0100" isPrintable="false" />
15
+ <formVersion code="1.1" name="Poprawki" status="inactive"
16
+ description="Druga wersja wniosku"
17
+ creationDate="2007-01-02 12:00:00+0100" isPrintable="true" />
18
+ <formVersion code="1.2" name="Poprawki 2" status="inactive"
19
+ description="Trzecia wersja wniosku"
20
+ creationDate="2007-01-03 12:00:00+0100" isPrintable="true" />
21
+ </formInfo>
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <entryPutConfirmation
3
+ xmlns="http://api.activeforms.com"
4
+ apiVersion="3.0"
5
+ number="12234"
6
+ formCode="credit_card_entry"
7
+ formVersionCode="version_1"
8
+ date="2008-01-01T00:00:00.00+0000"
9
+ status="saved"
10
+ isPrintable="true"
11
+ accessToken="43r9j34f9j3"
12
+ />
data/test/test_helper.rb CHANGED
@@ -1,10 +1,11 @@
1
- require 'rubygems'
2
- require 'test/unit'
1
+ # encoding: UTF-8
2
+
3
+ require 'rubygems' if RUBY_VERSION < '1.9'
4
+ require 'bundler/setup'
5
+
3
6
  require 'shoulda'
4
7
  require 'fakeweb'
5
8
 
6
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
7
- $LOAD_PATH.unshift(File.dirname(__FILE__))
8
9
  require 'active_forms'
9
10
 
10
11
  FakeWeb.allow_net_connect = false
metadata CHANGED
@@ -1,7 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_forms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ hash: 19
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 3
9
+ - 0
10
+ version: 0.3.0
5
11
  platform: ruby
6
12
  authors:
7
13
  - "Micha\xC5\x82 Szajbe"
@@ -9,121 +15,182 @@ autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
17
 
12
- date: 2010-04-01 00:00:00 +02:00
13
- default_executable:
18
+ date: 2012-06-27 00:00:00 Z
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
21
  name: activesupport
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
20
25
  requirements:
21
26
  - - ">="
22
27
  - !ruby/object:Gem::Version
28
+ hash: 3
29
+ segments:
30
+ - 0
23
31
  version: "0"
24
- version:
32
+ type: :runtime
33
+ version_requirements: *id001
25
34
  - !ruby/object:Gem::Dependency
26
35
  name: httparty
27
- type: :runtime
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ none: false
30
39
  requirements:
31
40
  - - ">="
32
41
  - !ruby/object:Gem::Version
42
+ hash: 15
43
+ segments:
44
+ - 0
45
+ - 5
46
+ - 2
33
47
  version: 0.5.2
34
- version:
48
+ type: :runtime
49
+ version_requirements: *id002
35
50
  - !ruby/object:Gem::Dependency
36
51
  name: thoughtbot-shoulda
37
- type: :development
38
- version_requirement:
39
- version_requirements: !ruby/object:Gem::Requirement
52
+ prerelease: false
53
+ requirement: &id003 !ruby/object:Gem::Requirement
54
+ none: false
40
55
  requirements:
41
56
  - - ">="
42
57
  - !ruby/object:Gem::Version
58
+ hash: 35
59
+ segments:
60
+ - 2
61
+ - 10
62
+ - 2
43
63
  version: 2.10.2
44
- version:
64
+ type: :development
65
+ version_requirements: *id003
45
66
  - !ruby/object:Gem::Dependency
46
67
  name: fakeweb
47
- type: :development
48
- version_requirement:
49
- version_requirements: !ruby/object:Gem::Requirement
68
+ prerelease: false
69
+ requirement: &id004 !ruby/object:Gem::Requirement
70
+ none: false
50
71
  requirements:
51
72
  - - ">="
52
73
  - !ruby/object:Gem::Version
74
+ hash: 15
75
+ segments:
76
+ - 1
77
+ - 2
78
+ - 8
53
79
  version: 1.2.8
54
- version:
80
+ type: :development
81
+ version_requirements: *id004
55
82
  description:
56
- email: michal.szajbe@gmail.com
83
+ email:
84
+ - michal.szajbe@gmail.com
57
85
  executables: []
58
86
 
59
87
  extensions: []
60
88
 
61
- extra_rdoc_files:
62
- - LICENSE
63
- - README.rdoc
89
+ extra_rdoc_files: []
90
+
64
91
  files:
65
- - .document
66
92
  - .gitignore
93
+ - .travis.yml
94
+ - Gemfile
67
95
  - LICENSE
68
- - README.rdoc
96
+ - README.md
69
97
  - Rakefile
70
- - VERSION
71
98
  - active_forms.gemspec
72
99
  - lib/active_forms.rb
73
100
  - lib/active_forms/application.rb
74
101
  - lib/active_forms/application_print.rb
75
102
  - lib/active_forms/configuration.rb
103
+ - lib/active_forms/entry.rb
104
+ - lib/active_forms/entry_printout.rb
76
105
  - lib/active_forms/form.rb
106
+ - lib/active_forms/form_version.rb
77
107
  - lib/active_forms/mapper.rb
78
108
  - lib/active_forms/request.rb
109
+ - lib/active_forms/token.rb
110
+ - lib/active_forms/version.rb
79
111
  - test/active_forms/application_print_test.rb
80
112
  - test/active_forms/application_test.rb
113
+ - test/active_forms/entry_printout_test.rb
114
+ - test/active_forms/entry_test.rb
81
115
  - test/active_forms/form_test.rb
116
+ - test/active_forms/form_version_test.rb
82
117
  - test/active_forms/mapper_test.rb
83
118
  - test/active_forms/request_test.rb
119
+ - test/active_forms/token_test.rb
84
120
  - test/active_forms_test.rb
85
121
  - test/fixtures/error.xml
86
122
  - test/fixtures/get_applicationdata.xml
87
123
  - test/fixtures/get_applicationprint.xml
88
124
  - test/fixtures/get_applications.xml
89
125
  - test/fixtures/get_applications_single.xml
126
+ - test/fixtures/get_entries.xml
127
+ - test/fixtures/get_entries_single.xml
128
+ - test/fixtures/get_entrydata.xml
129
+ - test/fixtures/get_entryprintout.xml
130
+ - test/fixtures/get_formaccesstokens.xml
131
+ - test/fixtures/get_forminfo.xml
90
132
  - test/fixtures/get_forms.xml
91
133
  - test/fixtures/get_forms_single.xml
134
+ - test/fixtures/post_entrydata.xml
92
135
  - test/fixtures/success.xml
93
136
  - test/test_helper.rb
94
- has_rdoc: true
95
137
  homepage: http://github.com/monterail/active_forms
96
138
  licenses: []
97
139
 
98
140
  post_install_message:
99
- rdoc_options:
100
- - --charset=UTF-8
141
+ rdoc_options: []
142
+
101
143
  require_paths:
102
144
  - lib
103
145
  required_ruby_version: !ruby/object:Gem::Requirement
146
+ none: false
104
147
  requirements:
105
148
  - - ">="
106
149
  - !ruby/object:Gem::Version
150
+ hash: 3
151
+ segments:
152
+ - 0
107
153
  version: "0"
108
- version:
109
154
  required_rubygems_version: !ruby/object:Gem::Requirement
155
+ none: false
110
156
  requirements:
111
157
  - - ">="
112
158
  - !ruby/object:Gem::Version
159
+ hash: 3
160
+ segments:
161
+ - 0
113
162
  version: "0"
114
- version:
115
163
  requirements: []
116
164
 
117
165
  rubyforge_project:
118
- rubygems_version: 1.3.5
166
+ rubygems_version: 1.8.24
119
167
  signing_key:
120
168
  specification_version: 3
121
169
  summary: Active Forms API wrapper
122
170
  test_files:
123
171
  - test/active_forms/application_print_test.rb
124
172
  - test/active_forms/application_test.rb
173
+ - test/active_forms/entry_printout_test.rb
174
+ - test/active_forms/entry_test.rb
125
175
  - test/active_forms/form_test.rb
176
+ - test/active_forms/form_version_test.rb
126
177
  - test/active_forms/mapper_test.rb
127
178
  - test/active_forms/request_test.rb
179
+ - test/active_forms/token_test.rb
128
180
  - test/active_forms_test.rb
181
+ - test/fixtures/error.xml
182
+ - test/fixtures/get_applicationdata.xml
183
+ - test/fixtures/get_applicationprint.xml
184
+ - test/fixtures/get_applications.xml
185
+ - test/fixtures/get_applications_single.xml
186
+ - test/fixtures/get_entries.xml
187
+ - test/fixtures/get_entries_single.xml
188
+ - test/fixtures/get_entrydata.xml
189
+ - test/fixtures/get_entryprintout.xml
190
+ - test/fixtures/get_formaccesstokens.xml
191
+ - test/fixtures/get_forminfo.xml
192
+ - test/fixtures/get_forms.xml
193
+ - test/fixtures/get_forms_single.xml
194
+ - test/fixtures/post_entrydata.xml
195
+ - test/fixtures/success.xml
129
196
  - test/test_helper.rb
data/.document DELETED
@@ -1,5 +0,0 @@
1
- README.rdoc
2
- lib/**/*.rb
3
- bin/*
4
- features/**/*.feature
5
- LICENSE
data/README.rdoc DELETED
@@ -1,7 +0,0 @@
1
- = active_forms
2
-
3
- ActiveForms API wrapper.
4
-
5
- == Copyright
6
-
7
- Copyright (c) 2010 Monterail. See LICENSE for details.