ulpos 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies to develop your gem here.
3
+ # Include everything needed to run rake, tests, features, etc.
4
+ group :development do
5
+ gem "shoulda", ">= 0"
6
+ gem "rdoc", "~> 3.12"
7
+ gem "bundler", "1.2.3"
8
+ gem "jeweler", "~> 1.8.4"
9
+ gem "simplecov", ">= 0"
10
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,44 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ activesupport (3.2.10)
5
+ i18n (~> 0.6)
6
+ multi_json (~> 1.0)
7
+ bourne (1.1.2)
8
+ mocha (= 0.10.5)
9
+ git (1.2.5)
10
+ i18n (0.6.1)
11
+ jeweler (1.8.4)
12
+ bundler (~> 1.0)
13
+ git (>= 1.2.5)
14
+ rake
15
+ rdoc
16
+ json (1.7.6)
17
+ metaclass (0.0.1)
18
+ mocha (0.10.5)
19
+ metaclass (~> 0.0.1)
20
+ multi_json (1.5.0)
21
+ rake (10.0.3)
22
+ rdoc (3.12)
23
+ json (~> 1.4)
24
+ shoulda (3.3.2)
25
+ shoulda-context (~> 1.0.1)
26
+ shoulda-matchers (~> 1.4.1)
27
+ shoulda-context (1.0.2)
28
+ shoulda-matchers (1.4.2)
29
+ activesupport (>= 3.0.0)
30
+ bourne (~> 1.1.2)
31
+ simplecov (0.7.1)
32
+ multi_json (~> 1.0)
33
+ simplecov-html (~> 0.7.1)
34
+ simplecov-html (0.7.1)
35
+
36
+ PLATFORMS
37
+ ruby
38
+
39
+ DEPENDENCIES
40
+ bundler (= 1.2.3)
41
+ jeweler (~> 1.8.4)
42
+ rdoc (~> 3.12)
43
+ shoulda
44
+ simplecov
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2013 unionpaysmart
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,3 @@
1
+ 开发平台官网: http://open.ulpos.com/
2
+
3
+ U联生活开放平台是为渠道合作伙伴提供优惠券电子凭证与银行卡、商户POS机具进行数据交互与各方清结算的支持平台。基于U联生活开放平台,对渠道合作伙伴开放合作商户资源、持银联卡用户资源及商户POS机具资源,满足渠道合作伙伴基于银行卡创建各类应用,并帮助渠道合作伙伴进行商户营销佣金的清结算,以帮助渠道合作伙伴的业务成长。
data/README.rdoc ADDED
@@ -0,0 +1,19 @@
1
+ = ulpos
2
+
3
+ Description goes here.
4
+
5
+ == Contributing to ulpos
6
+
7
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
8
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
9
+ * Fork the project.
10
+ * Start a feature/bugfix branch.
11
+ * Commit and push until you are happy with your contribution.
12
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
14
+
15
+ == Copyright
16
+
17
+ Copyright (c) 2013 unionpaysmart. See LICENSE.txt for
18
+ further details.
19
+
data/Rakefile ADDED
@@ -0,0 +1,53 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "ulpos"
18
+ gem.homepage = "http://github.com/wxmcan/ulpos"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{ulpos open platform}
21
+ gem.description = %Q{U联生活开放平台是为渠道合作伙伴提供优惠券电子凭证与银行卡、商户POS机具进行数据交互与各方清结算的支持平台}
22
+ gem.email = "bobwang@unionpaysmart.com"
23
+ gem.authors = ["Bob Wang"]
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
27
+
28
+ require 'rake/testtask'
29
+ Rake::TestTask.new(:test) do |test|
30
+ test.libs << 'lib' << 'test'
31
+ test.pattern = 'test/**/test_*.rb'
32
+ test.verbose = true
33
+ end
34
+
35
+ #require 'rcov/rcovtask'
36
+ #Rcov::RcovTask.new do |test|
37
+ #test.libs << 'test'
38
+ #test.pattern = 'test/**/test_*.rb'
39
+ #test.verbose = true
40
+ #test.rcov_opts << '--exclude "gems/*"'
41
+ #end
42
+
43
+ task :default => :test
44
+
45
+ require 'rdoc/task'
46
+ Rake::RDocTask.new do |rdoc|
47
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
48
+
49
+ rdoc.rdoc_dir = 'rdoc'
50
+ rdoc.title = "ulpos #{version}"
51
+ rdoc.rdoc_files.include('README*')
52
+ rdoc.rdoc_files.include('lib/**/*.rb')
53
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.2
@@ -0,0 +1,34 @@
1
+ require 'json'
2
+ module Ulpos
3
+ class Client
4
+ attr_reader :app_key, :app_secret, :endpoint
5
+
6
+ def initialize(app_key = Ulpos.app_key, app_secret = Ulpos.app_secret, endpoint = Ulpos.endpoint)
7
+ @app_key = app_key
8
+ @app_secret = app_secret
9
+ @endpoint = endpoint
10
+ end
11
+
12
+ def invoke(method, options = {})
13
+ params = {
14
+ :timestamp => Time.now.strftime("%Y-%m-%d %H:%M:%S"),
15
+ :format => 'json',
16
+ :app_key => @app_key,
17
+ :v => '2.0',
18
+ :method => method,
19
+ :sign_method => 'md5'
20
+ }
21
+ params.merge!(options)
22
+ str = @app_secret + (params.sort.collect { |param| "#{param[0]}#{param[1]}" }).join("") + @app_secret
23
+ params["sign"] = Digest::MD5.hexdigest(str).upcase!
24
+ res = Net::HTTP.post_form(URI.parse(@endpoint), params)
25
+ if params[:format] == 'json'
26
+ JSON.parse(res.body)
27
+ elsif params[:format] == 'xml'
28
+ res.body
29
+ else
30
+ res.body
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,3 @@
1
+ module Ulpos
2
+ VERSION = "0.0.1"
3
+ end
data/lib/ulpos.rb ADDED
@@ -0,0 +1,12 @@
1
+ module Ulpos
2
+ class << self
3
+ attr_accessor :app_key, :app_secret, :endpoint
4
+
5
+ def configure
6
+ yield self
7
+ true
8
+ end
9
+ end
10
+
11
+ autoload :Client, "ulpos/client"
12
+ end
metadata ADDED
@@ -0,0 +1,141 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ulpos
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.2
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Bob Wang
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-01-04 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: shoulda
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rdoc
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: '3.12'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '3.12'
46
+ - !ruby/object:Gem::Dependency
47
+ name: bundler
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - '='
52
+ - !ruby/object:Gem::Version
53
+ version: 1.2.3
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - '='
60
+ - !ruby/object:Gem::Version
61
+ version: 1.2.3
62
+ - !ruby/object:Gem::Dependency
63
+ name: jeweler
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: 1.8.4
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 1.8.4
78
+ - !ruby/object:Gem::Dependency
79
+ name: simplecov
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ description: U联生活开放平台是为渠道合作伙伴提供优惠券电子凭证与银行卡、商户POS机具进行数据交互与各方清结算的支持平台
95
+ email: bobwang@unionpaysmart.com
96
+ executables: []
97
+ extensions: []
98
+ extra_rdoc_files:
99
+ - LICENSE.txt
100
+ - README.md
101
+ - README.rdoc
102
+ files:
103
+ - Gemfile
104
+ - Gemfile.lock
105
+ - LICENSE.txt
106
+ - README.md
107
+ - README.rdoc
108
+ - Rakefile
109
+ - VERSION
110
+ - lib/ulpos.rb
111
+ - lib/ulpos/client.rb
112
+ - lib/ulpos/version.rb
113
+ homepage: http://github.com/wxmcan/ulpos
114
+ licenses:
115
+ - MIT
116
+ post_install_message:
117
+ rdoc_options: []
118
+ require_paths:
119
+ - lib
120
+ required_ruby_version: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ segments:
127
+ - 0
128
+ hash: -2024717248431316914
129
+ required_rubygems_version: !ruby/object:Gem::Requirement
130
+ none: false
131
+ requirements:
132
+ - - ! '>='
133
+ - !ruby/object:Gem::Version
134
+ version: '0'
135
+ requirements: []
136
+ rubyforge_project:
137
+ rubygems_version: 1.8.24
138
+ signing_key:
139
+ specification_version: 3
140
+ summary: ulpos open platform
141
+ test_files: []