edm 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/Gemfile +4 -0
- data/Rakefile +1 -0
- data/edm.gemspec +24 -0
- data/lib/edm/version.rb +3 -0
- data/lib/edm.rb +24 -0
- metadata +51 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/edm.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "edm/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "edm"
|
7
|
+
s.version = Edm::VERSION
|
8
|
+
s.authors = ["lijiping"]
|
9
|
+
s.email = ["lijiping@demohour.com"]
|
10
|
+
s.homepage = ""
|
11
|
+
s.summary = %q{edm api package}
|
12
|
+
s.description = %q{demohour edm api}
|
13
|
+
|
14
|
+
s.rubyforge_project = "edm"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
|
21
|
+
# specify any dependencies here; for example:
|
22
|
+
# s.add_development_dependency "rspec"
|
23
|
+
# s.add_runtime_dependency "rest-client"
|
24
|
+
end
|
data/lib/edm/version.rb
ADDED
data/lib/edm.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require "edm/version"
|
2
|
+
|
3
|
+
module Edm
|
4
|
+
KEY = Setting.edm_key
|
5
|
+
def self.batch_create_contacts(options = {})
|
6
|
+
sign = generate_sign(options)
|
7
|
+
options["sign"] = sign
|
8
|
+
result = remote_request('post', 'http://0.0.0.0:3000/api/contacts/batch_create.json', options)
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.generate_sign(options = {})
|
12
|
+
if options.length > 0
|
13
|
+
options.to_a.sort.map { |c| "#{c[0]}=#{c[1]}" }.join('&')
|
14
|
+
sign = Digest::SHA1.hexdigest("#{str}#{key}")
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.remote_request(http_method, url, options = {})
|
19
|
+
case http_method
|
20
|
+
when 'post'
|
21
|
+
Net::HTTP.post_form(URI.parse(url), options)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: edm
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- lijiping
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-12-30 00:00:00.000000000Z
|
13
|
+
dependencies: []
|
14
|
+
description: demohour edm api
|
15
|
+
email:
|
16
|
+
- lijiping@demohour.com
|
17
|
+
executables: []
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- .gitignore
|
22
|
+
- Gemfile
|
23
|
+
- Rakefile
|
24
|
+
- edm.gemspec
|
25
|
+
- lib/edm.rb
|
26
|
+
- lib/edm/version.rb
|
27
|
+
homepage: ''
|
28
|
+
licenses: []
|
29
|
+
post_install_message:
|
30
|
+
rdoc_options: []
|
31
|
+
require_paths:
|
32
|
+
- lib
|
33
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
34
|
+
none: false
|
35
|
+
requirements:
|
36
|
+
- - ! '>='
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0'
|
39
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ! '>='
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '0'
|
45
|
+
requirements: []
|
46
|
+
rubyforge_project: edm
|
47
|
+
rubygems_version: 1.8.10
|
48
|
+
signing_key:
|
49
|
+
specification_version: 3
|
50
|
+
summary: edm api package
|
51
|
+
test_files: []
|