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.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.rspec +2 -0
- data/lib/mandao/configuration.rb +49 -0
- data/lib/mandao/resources/address.rb +35 -0
- data/lib/mandao/resources/address_list.rb +49 -0
- data/lib/mandao/resources/base.rb +19 -0
- data/lib/mandao/resources/document.rb +24 -0
- data/lib/mandao/version.rb +1 -1
- data/lib/mandao/xml_format.rb +16 -0
- data/lib/mandao.rb +2 -5
- data/mandao.gemspec +7 -2
- data/spec/mandao/address_list_spec.rb +37 -0
- data/spec/mandao/document_spec.rb +26 -0
- data/spec/mandao/files/document.pdf +1641 -0
- data/spec/mandao/stub_requests.rb +29 -0
- data/spec/mandao_spec.rb +18 -0
- data/spec/spec_helper.rb +14 -0
- metadata +69 -17
- data/push/.gitignore +0 -14
- data/push/Gemfile +0 -4
- data/push/LICENSE.txt +0 -22
- data/push/README.md +0 -31
- data/push/Rakefile +0 -2
- data/push/lib/push/version.rb +0 -3
- data/push/lib/push.rb +0 -5
- data/push/push.gemspec +0 -23
@@ -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
|
data/spec/mandao_spec.rb
ADDED
@@ -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
|
data/spec/spec_helper.rb
ADDED
@@ -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.
|
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-
|
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
|
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
|
55
|
-
|
56
|
-
|
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
|
-
-
|
73
|
-
-
|
74
|
-
-
|
75
|
-
-
|
76
|
-
-
|
77
|
-
-
|
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:
|
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
data/push/Gemfile
DELETED
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
data/push/lib/push/version.rb
DELETED
data/push/lib/push.rb
DELETED
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
|