sendcloud_client 0.0.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a1980dda1ddaaf1e9ac916f808c92b555809743b
4
+ data.tar.gz: 3701eebe238fc6a263806773ab523df84d483fe9
5
+ SHA512:
6
+ metadata.gz: 67fbde3c9f9716727ad1bf8a5d3f90bca85ac8e8076405c24fc9591b5932dcae24a5105e580c21a0cea01ea9075ba7f16f9b0039415e22e616b77eb6b70f9e4b
7
+ data.tar.gz: aa5f928b4b0265186f43ee7f7a1e871b9e321b74f33cc505d1505e13caa9b291c1011ef78e26e258040969b7ee52abd103132408287609a26bc0a572cd7734f2
data/.gitignore ADDED
@@ -0,0 +1,19 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ .idea
7
+ Gemfile.lock
8
+ InstalledFiles
9
+ _yardoc
10
+ coverage
11
+ doc/
12
+ lib/bundler/man
13
+ pkg
14
+ rdoc
15
+ spec/reports
16
+ test/tmp
17
+ test/version_tmp
18
+ tmp
19
+ spec/spec_helper.rb
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format progress
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
3
+
4
+
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2016 Alvin Ye
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/README.md ADDED
@@ -0,0 +1,18 @@
1
+ ## Usage
2
+
3
+ only 25 lines
4
+
5
+ #### Configure
6
+
7
+ ```
8
+
9
+ gem "sendcloud_client"
10
+
11
+ SendcloudClient.setup do |config|
12
+ config.api_user = 'xxx'
13
+ config.api_key = 'yyy'
14
+ end
15
+
16
+ p SendcloudClient.sendmail(to: "alvin.ye.cn@gmail.com", from: "xxx", fromName: "SendCloud", subject: "xxx", html: "xxx")
17
+
18
+ ```
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,25 @@
1
+ require "rest-client"
2
+ require "json"
3
+
4
+ module SendcloudClient
5
+ API_BASE = 'https://api.sendcloud.net/apiv2'
6
+ class Error < StandardError; end
7
+
8
+ def self.setup
9
+ yield self
10
+ end
11
+
12
+ class << self
13
+ attr_accessor :api_user, :api_key
14
+ end
15
+
16
+ def self.sendmail(options = {})
17
+ return if options[:to].length == 0
18
+ uri = "#{API_BASE}/mail/send"
19
+ res = RestClient.post uri, apiUser: SendcloudClient.api_user,
20
+ apiKey: SendcloudClient.api_key, to: options[:to], from: options[:from], fromName: options[:from],
21
+ subject: options[:from], html: options[:from]
22
+
23
+ JSON.parse(res) rescue nil
24
+ end
25
+ end
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'sendcloud_client'
7
+ spec.version = '0.0.1'
8
+ spec.authors = ['Alvin Ye']
9
+ spec.email = ['alvin.ye.cn@gmail.com']
10
+ spec.description = %q{ruby client for sohu sendcloud api v2}
11
+ spec.summary = %q{ruby client for sohu sendcloud api v2}
12
+ spec.homepage = 'https://github.com/alvin2ye/sendcloud_client'
13
+ spec.license = 'MIT'
14
+
15
+ spec.files = `git ls-files`.split($/)
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ['lib']
19
+
20
+ spec.add_development_dependency 'bundler', '~> 1.12.5'
21
+ spec.add_development_dependency 'rake', '~> 11.2.2'
22
+ spec.add_dependency 'rest-client', '~> 2.0.0'
23
+ end
data/test/test.rb ADDED
@@ -0,0 +1,8 @@
1
+ gem "sendcloud_client"
2
+
3
+ SendcloudClient.setup do |config|
4
+ config.api_user = 'xxx'
5
+ config.api_key = 'yyy'
6
+ end
7
+
8
+ p SendcloudClient.sendmail(to: "xx@gmail.com", from: "xxx", fromName: "SendCloud", subject: "xxx", html: "xxx")
metadata ADDED
@@ -0,0 +1,96 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sendcloud_client
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Alvin Ye
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-08-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 1.12.5
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 1.12.5
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 11.2.2
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 11.2.2
41
+ - !ruby/object:Gem::Dependency
42
+ name: rest-client
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 2.0.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 2.0.0
55
+ description: ruby client for sohu sendcloud api v2
56
+ email:
57
+ - alvin.ye.cn@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".rspec"
64
+ - Gemfile
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - lib/sendcloud_client.rb
69
+ - sendcloud_client.gemspec
70
+ - test/test.rb
71
+ homepage: https://github.com/alvin2ye/sendcloud_client
72
+ licenses:
73
+ - MIT
74
+ metadata: {}
75
+ post_install_message:
76
+ rdoc_options: []
77
+ require_paths:
78
+ - lib
79
+ required_ruby_version: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ required_rubygems_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ requirements: []
90
+ rubyforge_project:
91
+ rubygems_version: 2.6.6
92
+ signing_key:
93
+ specification_version: 4
94
+ summary: ruby client for sohu sendcloud api v2
95
+ test_files:
96
+ - test/test.rb