conduit 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +1 -21
  3. data/lib/conduit.rb +4 -6
  4. data/lib/conduit/configuration.rb +20 -31
  5. data/lib/conduit/core/action.rb +15 -2
  6. data/lib/conduit/core/connection.rb +3 -1
  7. data/lib/conduit/core/parser.rb +7 -3
  8. data/lib/conduit/storage.rb +2 -2
  9. data/lib/conduit/version.rb +1 -1
  10. data/lib/tmp/conduit/1/fusion/activate/request.xml +26 -0
  11. data/lib/tmp/conduit/1/fusion/change_device/request.xml +15 -0
  12. data/lib/tmp/conduit/1/fusion/change_number/request.xml +14 -0
  13. data/lib/tmp/conduit/1/fusion/deactivate/request.xml +14 -0
  14. data/lib/tmp/conduit/1/fusion/purchase/1-response.xml +1 -0
  15. data/lib/tmp/conduit/1/fusion/purchase/request.xml +15 -0
  16. data/lib/tmp/conduit/1/fusion/query_subscription/1-response.xml +1 -0
  17. data/lib/tmp/conduit/1/fusion/query_subscription/request.xml +15 -0
  18. data/lib/tmp/conduit/1/fusion/reset_voicemail/request.xml +14 -0
  19. data/lib/tmp/conduit/1/fusion/restore/request.xml +14 -0
  20. data/lib/tmp/conduit/1/fusion/suspend/request.xml +15 -0
  21. data/lib/tmp/conduit/2/fusion/purchase/request.xml +15 -0
  22. data/lib/tmp/conduit/3/fusion/activate/request.xml +26 -0
  23. data/lib/tmp/conduit/4/fusion/activate/request.xml +26 -0
  24. data/lib/tmp/conduit/5/fusion/activate/request.xml +26 -0
  25. data/lib/tmp/conduit/6/fusion/activate/request.xml +26 -0
  26. data/lib/tmp/conduit/7/fusion/activate/request.xml +26 -0
  27. data/lib/tmp/conduit/8/fusion/activate/request.xml +26 -0
  28. data/lib/tmp/conduit/9/fusion/activate/request.xml +26 -0
  29. data/spec/classes/core/action_spec.rb +11 -2
  30. data/spec/classes/core/parser_spec.rb +52 -0
  31. data/spec/spec_helper.rb +13 -17
  32. data/spec/{dummy/lib/conduit/drivers → support}/my_driver/actions/foo.rb +0 -0
  33. data/spec/{dummy/lib/conduit/drivers → support}/my_driver/driver.rb +0 -0
  34. data/spec/support/my_driver/parsers/foo.rb +75 -0
  35. data/spec/{dummy/lib/conduit/drivers → support}/my_driver/views/foo.erb +0 -0
  36. data/spec/{dummy/lib/conduit/drivers → support}/my_driver/views/layout.erb +0 -0
  37. data/spec/support/xml/xml_response.xml +3 -0
  38. metadata +45 -140
  39. data/app/controllers/conduit/responses_controller.rb +0 -14
  40. data/app/models/conduit/concerns/storage.rb +0 -41
  41. data/app/models/conduit/request.rb +0 -111
  42. data/app/models/conduit/response.rb +0 -50
  43. data/app/models/conduit/subscription.rb +0 -6
  44. data/config/routes.rb +0 -3
  45. data/db/migrate/20131209223122_create_conduit_requests.rb +0 -13
  46. data/db/migrate/20131209223734_create_conduit_responses.rb +0 -10
  47. data/db/migrate/20140305202729_create_conduit_subscriptions.rb +0 -12
  48. data/lib/conduit/acts_as_conduit_subscriber.rb +0 -41
  49. data/lib/conduit/engine.rb +0 -20
  50. data/lib/tasks/conduit_tasks.rake +0 -4
  51. data/spec/classes/acts_as_conduit_subscriber_spec.rb +0 -61
  52. data/spec/controllers/responses_controller_spec.rb +0 -29
  53. data/spec/dummy/README.rdoc +0 -28
  54. data/spec/dummy/Rakefile +0 -6
  55. data/spec/dummy/app/assets/javascripts/application.js +0 -13
  56. data/spec/dummy/app/assets/stylesheets/application.css +0 -13
  57. data/spec/dummy/app/controllers/application_controller.rb +0 -5
  58. data/spec/dummy/app/helpers/application_helper.rb +0 -2
  59. data/spec/dummy/app/views/layouts/application.html.erb +0 -14
  60. data/spec/dummy/bin/bundle +0 -3
  61. data/spec/dummy/bin/rails +0 -4
  62. data/spec/dummy/bin/rake +0 -4
  63. data/spec/dummy/config.ru +0 -4
  64. data/spec/dummy/config/application.rb +0 -29
  65. data/spec/dummy/config/boot.rb +0 -5
  66. data/spec/dummy/config/database.yml +0 -12
  67. data/spec/dummy/config/environment.rb +0 -5
  68. data/spec/dummy/config/environments/development.rb +0 -29
  69. data/spec/dummy/config/environments/production.rb +0 -80
  70. data/spec/dummy/config/environments/test.rb +0 -36
  71. data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
  72. data/spec/dummy/config/initializers/conduit.rb +0 -5
  73. data/spec/dummy/config/initializers/filter_parameter_logging.rb +0 -4
  74. data/spec/dummy/config/initializers/inflections.rb +0 -16
  75. data/spec/dummy/config/initializers/mime_types.rb +0 -5
  76. data/spec/dummy/config/initializers/secret_token.rb +0 -12
  77. data/spec/dummy/config/initializers/session_store.rb +0 -3
  78. data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
  79. data/spec/dummy/config/locales/en.yml +0 -23
  80. data/spec/dummy/config/routes.rb +0 -3
  81. data/spec/dummy/db/test.sqlite3 +0 -0
  82. data/spec/dummy/db/test.sqlite3-journal +0 -0
  83. data/spec/dummy/lib/conduit/drivers/my_driver/parsers/foo.rb +0 -13
  84. data/spec/dummy/log/test.log +0 -6
  85. data/spec/dummy/public/404.html +0 -58
  86. data/spec/dummy/public/422.html +0 -58
  87. data/spec/dummy/public/500.html +0 -57
  88. data/spec/models/conduit/request_spec.rb +0 -50
  89. data/spec/models/conduit/response_spec.rb +0 -52
@@ -1,58 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>The change you wanted was rejected (422)</title>
5
- <style>
6
- body {
7
- background-color: #EFEFEF;
8
- color: #2E2F30;
9
- text-align: center;
10
- font-family: arial, sans-serif;
11
- }
12
-
13
- div.dialog {
14
- width: 25em;
15
- margin: 4em auto 0 auto;
16
- border: 1px solid #CCC;
17
- border-right-color: #999;
18
- border-left-color: #999;
19
- border-bottom-color: #BBB;
20
- border-top: #B00100 solid 4px;
21
- border-top-left-radius: 9px;
22
- border-top-right-radius: 9px;
23
- background-color: white;
24
- padding: 7px 4em 0 4em;
25
- }
26
-
27
- h1 {
28
- font-size: 100%;
29
- color: #730E15;
30
- line-height: 1.5em;
31
- }
32
-
33
- body > p {
34
- width: 33em;
35
- margin: 0 auto 1em;
36
- padding: 1em 0;
37
- background-color: #F7F7F7;
38
- border: 1px solid #CCC;
39
- border-right-color: #999;
40
- border-bottom-color: #999;
41
- border-bottom-left-radius: 4px;
42
- border-bottom-right-radius: 4px;
43
- border-top-color: #DADADA;
44
- color: #666;
45
- box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
- }
47
- </style>
48
- </head>
49
-
50
- <body>
51
- <!-- This file lives in public/422.html -->
52
- <div class="dialog">
53
- <h1>The change you wanted was rejected.</h1>
54
- <p>Maybe you tried to change something you didn't have access to.</p>
55
- </div>
56
- <p>If you are the application owner check the logs for more information.</p>
57
- </body>
58
- </html>
@@ -1,57 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>We're sorry, but something went wrong (500)</title>
5
- <style>
6
- body {
7
- background-color: #EFEFEF;
8
- color: #2E2F30;
9
- text-align: center;
10
- font-family: arial, sans-serif;
11
- }
12
-
13
- div.dialog {
14
- width: 25em;
15
- margin: 4em auto 0 auto;
16
- border: 1px solid #CCC;
17
- border-right-color: #999;
18
- border-left-color: #999;
19
- border-bottom-color: #BBB;
20
- border-top: #B00100 solid 4px;
21
- border-top-left-radius: 9px;
22
- border-top-right-radius: 9px;
23
- background-color: white;
24
- padding: 7px 4em 0 4em;
25
- }
26
-
27
- h1 {
28
- font-size: 100%;
29
- color: #730E15;
30
- line-height: 1.5em;
31
- }
32
-
33
- body > p {
34
- width: 33em;
35
- margin: 0 auto 1em;
36
- padding: 1em 0;
37
- background-color: #F7F7F7;
38
- border: 1px solid #CCC;
39
- border-right-color: #999;
40
- border-bottom-color: #999;
41
- border-bottom-left-radius: 4px;
42
- border-bottom-right-radius: 4px;
43
- border-top-color: #DADADA;
44
- color: #666;
45
- box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
- }
47
- </style>
48
- </head>
49
-
50
- <body>
51
- <!-- This file lives in public/500.html -->
52
- <div class="dialog">
53
- <h1>We're sorry, but something went wrong.</h1>
54
- </div>
55
- <p>If you are the application owner check the logs for more information.</p>
56
- </body>
57
- </html>
@@ -1,50 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Conduit::Request do
4
-
5
- let(:xml_request) do
6
- read_support_file('xml/xml_request.xml')
7
- end
8
-
9
- subject do
10
- Excon.stub({}, body: read_support_file("xml/xml_response.xml"), status: 200)
11
-
12
- Conduit::Request.create(driver: :my_driver, action: :foo,
13
- options: request_attributes)
14
- end
15
-
16
- before do
17
- subject.perform_request
18
- end
19
-
20
- describe "#create" do
21
- it "generates a file path for storage" do
22
- subject.file.should_not be_nil
23
- end
24
-
25
- it "saves the record to the database" do
26
- subject.persisted?.should be_true
27
- end
28
-
29
- it "creates a response in the database" do
30
- subject.responses.should_not be_empty
31
- end
32
- end
33
-
34
- describe "#destroy" do
35
- before { subject.destroy }
36
-
37
- it "removes the record from the database" do
38
- subject.destroyed?.should be_true
39
- end
40
- end
41
-
42
- describe '#content' do
43
- it "returns the xml view" do
44
- a = subject.content.gsub(/\s+/, "") # Strip whitespace for comparison
45
- b = xml_request.gsub(/\s+/, "") # Strip whitespace for comparison
46
- a.should == b
47
- end
48
- end
49
-
50
- end
@@ -1,52 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Conduit::Response do
4
-
5
- before do
6
- Excon.stub({}, body: read_support_file("xml/xml_response.xml"), status: 200)
7
-
8
- @request = Conduit::Request.create(driver: :my_driver, action: :foo,
9
- options: request_attributes)
10
- @request.perform_request
11
- end
12
-
13
- let(:xml_response) do
14
- read_support_file('xml/xml_response.xml')
15
- end
16
-
17
- subject { @request.responses.first }
18
-
19
- describe "#create" do
20
- it "generates a file path from the request" do
21
- File.dirname(subject.file).should eq File.dirname(@request.file)
22
- end
23
-
24
- it "saves the record to the database" do
25
- subject.persisted?.should be_true
26
- end
27
- end
28
-
29
- describe "#destroy" do
30
- before { subject.destroy }
31
-
32
- it "removes the record from the database" do
33
- subject.destroyed?.should be_true
34
- end
35
- end
36
-
37
- describe '#content' do
38
- it "returns the xml view" do
39
- a = subject.content.gsub(/\s+/, "") # Strip whitespace for comparison
40
- b = xml_response.gsub(/\s+/, "") # Strip whitespace for comparison
41
- a.should == b
42
- end
43
- end
44
-
45
- describe "#parsed_content" do
46
- it "returns a parser object" do
47
- klass = Conduit::Driver::MyDriver::Foo::Parser
48
- subject.parsed_content.class.should == klass
49
- end
50
- end
51
-
52
- end