mandao 0.0.1 → 0.0.2pre

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.
@@ -0,0 +1,29 @@
1
+ def stub_documents
2
+ xml = "<documents><document><id>731</id><uri>urn:c2m:document:id:732</uri><createdAt>2014-10-07T01:35:29-04:00</createdAt><contentSize>178806</contentSize><contentType>application/pdf</contentType></document><document><id>732</id><uri>urn:c2m:document:id:732</uri><createdAt>2014-10-07T01:35:29-04:00</createdAt><contentSize>178806</contentSize><contentType>application/pdf</contentType></document></documents>"
3
+ stub_request(:get, "https://username:password@#{ Mandao::Configuration::DEFAULT_ENDPOINT }/documents").
4
+ with(:headers => {'Accept'=>'application/xml', 'User-Agent'=>'Ruby'}).
5
+ to_return(:status => 200, :body => xml, :headers => {})
6
+ end
7
+
8
+ def stub_document_post
9
+ xml = "<documents>
10
+ <id>12345</id>
11
+ <status>0</status>
12
+ <description>Success</description>
13
+ </documents>"
14
+ stub_request(:post, "https://username:password@#{ Mandao::Configuration::DEFAULT_ENDPOINT }/documents").
15
+ with(headers: {'Accept' => 'application/xml', 'Content-Type' => 'application/pdf'}).
16
+ to_return(status: 200, body: xml)
17
+ end
18
+
19
+ def stub_address_lists
20
+ xml = "<addressLists><addressList><id>29547</id><ready>false</ready><total>0</total></addressList></addressLists>"
21
+ stub_request(:get, "https://username:password@#{ Mandao::Configuration::DEFAULT_ENDPOINT }/addressLists").
22
+ to_return(:status => 200, :body => xml, :headers => {})
23
+ end
24
+
25
+ def stub_address_lists_post
26
+ xml = "<addressList><id>29546</id><ready>false</ready><total>0</total></addressList>"
27
+ stub_request(:post, "https://username:password@stage.rest.click2mail.com/v1/addressLists").
28
+ to_return(:status => 200, :body => xml, :headers => {})
29
+ end
@@ -0,0 +1,18 @@
1
+ require File.expand_path('../spec_helper', __FILE__)
2
+
3
+ describe Mandao do
4
+
5
+ describe '.configure' do
6
+
7
+ it 'should set values' do
8
+ Mandao.configure do |config|
9
+ Mandao::Configuration::VALID_OPTIONS_KEYS.each do |key|
10
+ config.send("#{key}=", key)
11
+ expect(Mandao.config.send(key)).to be_eql(key)
12
+ end
13
+ end
14
+ end
15
+
16
+ end
17
+
18
+ end
@@ -0,0 +1,14 @@
1
+ require 'rspec'
2
+ require 'webmock/rspec'
3
+ require 'active_resource'
4
+ require 'rest_client'
5
+
6
+ require File.expand_path('../../lib/mandao', __FILE__)
7
+ require File.expand_path('../../lib/mandao/resources/base', __FILE__)
8
+ require File.expand_path('../../lib/mandao/xml_format', __FILE__)
9
+ require File.expand_path('..//mandao/stub_requests', __FILE__)
10
+ Dir.glob(File.expand_path('../../lib/mandao/resources/*', __FILE__)).each { |file| require(file) }
11
+
12
+ RSpec.configure do |config|
13
+ config.include WebMock::API
14
+ end
metadata CHANGED
@@ -1,15 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mandao
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marlon Mantilla
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-10 00:00:00.000000000 Z
11
+ date: 2014-10-11 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activeresource
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '4.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '4.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rest-client
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.7'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.7'
13
41
  - !ruby/object:Gem::Dependency
14
42
  name: bundler
15
43
  requirement: !ruby/object:Gem::Requirement
@@ -44,16 +72,29 @@ dependencies:
44
72
  requirements:
45
73
  - - "~>"
46
74
  - !ruby/object:Gem::Version
47
- version: 3.1.0
75
+ version: '3.1'
48
76
  type: :development
49
77
  prerelease: false
50
78
  version_requirements: !ruby/object:Gem::Requirement
51
79
  requirements:
52
80
  - - "~>"
53
81
  - !ruby/object:Gem::Version
54
- version: 3.1.0
55
- description: Mandao gem allows developers to access Click2Mail REST services in a
56
- simple way.
82
+ version: '3.1'
83
+ - !ruby/object:Gem::Dependency
84
+ name: webmock
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '1.19'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '1.19'
97
+ description: Mandao allows you to access Click2Mail REST services in a simple way.
57
98
  email:
58
99
  - me@marlonmantilla.com
59
100
  executables: []
@@ -61,22 +102,27 @@ extensions: []
61
102
  extra_rdoc_files: []
62
103
  files:
63
104
  - ".gitignore"
105
+ - ".rspec"
64
106
  - Gemfile
65
107
  - LICENSE
66
108
  - LICENSE.txt
67
109
  - README.md
68
110
  - Rakefile
69
111
  - lib/mandao.rb
112
+ - lib/mandao/configuration.rb
113
+ - lib/mandao/resources/address.rb
114
+ - lib/mandao/resources/address_list.rb
115
+ - lib/mandao/resources/base.rb
116
+ - lib/mandao/resources/document.rb
70
117
  - lib/mandao/version.rb
118
+ - lib/mandao/xml_format.rb
71
119
  - mandao.gemspec
72
- - push/.gitignore
73
- - push/Gemfile
74
- - push/LICENSE.txt
75
- - push/README.md
76
- - push/Rakefile
77
- - push/lib/push.rb
78
- - push/lib/push/version.rb
79
- - push/push.gemspec
120
+ - spec/mandao/address_list_spec.rb
121
+ - spec/mandao/document_spec.rb
122
+ - spec/mandao/files/document.pdf
123
+ - spec/mandao/stub_requests.rb
124
+ - spec/mandao_spec.rb
125
+ - spec/spec_helper.rb
80
126
  homepage: ''
81
127
  licenses:
82
128
  - MIT
@@ -92,13 +138,19 @@ required_ruby_version: !ruby/object:Gem::Requirement
92
138
  version: '0'
93
139
  required_rubygems_version: !ruby/object:Gem::Requirement
94
140
  requirements:
95
- - - ">="
141
+ - - ">"
96
142
  - !ruby/object:Gem::Version
97
- version: '0'
143
+ version: 1.3.1
98
144
  requirements: []
99
145
  rubyforge_project:
100
146
  rubygems_version: 2.2.2
101
147
  signing_key:
102
148
  specification_version: 4
103
149
  summary: Mandao is a cool gem for accessing the Click2Mail REST API. https://developers.click2mail.com/rest-api/molpro/getting-started/main
104
- test_files: []
150
+ test_files:
151
+ - spec/mandao/address_list_spec.rb
152
+ - spec/mandao/document_spec.rb
153
+ - spec/mandao/files/document.pdf
154
+ - spec/mandao/stub_requests.rb
155
+ - spec/mandao_spec.rb
156
+ - spec/spec_helper.rb
data/push/.gitignore DELETED
@@ -1,14 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
10
- *.bundle
11
- *.so
12
- *.o
13
- *.a
14
- mkmf.log
data/push/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in push.gemspec
4
- gemspec
data/push/LICENSE.txt DELETED
@@ -1,22 +0,0 @@
1
- Copyright (c) 2014 Marlon Mantilla
2
-
3
- MIT License
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/push/README.md DELETED
@@ -1,31 +0,0 @@
1
- # Push
2
-
3
- TODO: Write a gem description
4
-
5
- ## Installation
6
-
7
- Add this line to your application's Gemfile:
8
-
9
- ```ruby
10
- gem 'push'
11
- ```
12
-
13
- And then execute:
14
-
15
- $ bundle
16
-
17
- Or install it yourself as:
18
-
19
- $ gem install push
20
-
21
- ## Usage
22
-
23
- TODO: Write usage instructions here
24
-
25
- ## Contributing
26
-
27
- 1. Fork it ( https://github.com/[my-github-username]/push/fork )
28
- 2. Create your feature branch (`git checkout -b my-new-feature`)
29
- 3. Commit your changes (`git commit -am 'Add some feature'`)
30
- 4. Push to the branch (`git push origin my-new-feature`)
31
- 5. Create a new Pull Request
data/push/Rakefile DELETED
@@ -1,2 +0,0 @@
1
- require "bundler/gem_tasks"
2
-
@@ -1,3 +0,0 @@
1
- module Push
2
- VERSION = "0.0.1"
3
- end
data/push/lib/push.rb DELETED
@@ -1,5 +0,0 @@
1
- require "push/version"
2
-
3
- module Push
4
- # Your code goes here...
5
- end
data/push/push.gemspec DELETED
@@ -1,23 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'push/version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "push"
8
- spec.version = Push::VERSION
9
- spec.authors = ["Marlon Mantilla"]
10
- spec.email = ["marman0315@gmail.com"]
11
- spec.summary = %q{TODO: Write a short summary. Required.}
12
- spec.description = %q{TODO: Write a longer description. Optional.}
13
- spec.homepage = ""
14
- spec.license = "MIT"
15
-
16
- spec.files = `git ls-files -z`.split("\x0")
17
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
- spec.require_paths = ["lib"]
20
-
21
- spec.add_development_dependency "bundler", "~> 1.7"
22
- spec.add_development_dependency "rake", "~> 10.0"
23
- end