payture-api-v1 0.1.0

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: 888f47a3f03a4d6fc09a68c812fe6b27e71709a2
4
+ data.tar.gz: 531825558335ba3b6d8d2e3f04c9c6f1122d4788
5
+ SHA512:
6
+ metadata.gz: 917beabab481e35de2ff077d8657a8c1e838dea48c8b44ad915393a2db307991471b89f5cb0d198f4a1d507e51e51329dd28d4a2c6b5d979494465db54c613db
7
+ data.tar.gz: 05e526497fc8582e73b46f7924f498227312eaa3fa11cff4110e6a26ef36e255fac4a662402672f27c65f9a1c5fc130505d646a79868871a71774e3546e13d77
data/.coveralls.yml ADDED
@@ -0,0 +1 @@
1
+ service_name: travis-ci
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in payture-api-v1.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 René Kersten
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # Payture API V1
2
+
3
+ This library provides a wrapper to Version 1 of the Payture API
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'payture-api-v1'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install payture-api-v1
20
+
21
+ ## Usage
22
+
23
+ TODO: Write usage instructions here
24
+
25
+ ## Contributing
26
+
27
+ 1. Fork it ( https://github.com/endorfin/payture-api-v1/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/Rakefile ADDED
@@ -0,0 +1,15 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rake/testtask'
3
+
4
+ Rake::TestTask.new do |test|
5
+ test.libs << 'lib' << 'test'
6
+ test.pattern = 'test/**/test_*.rb'
7
+ end
8
+
9
+ desc "Run tests"
10
+ task :default => :test
11
+
12
+ desc "Coverage Report"
13
+ task :coverage do
14
+ system('bundle exec coveralls report')
15
+ end
@@ -0,0 +1,9 @@
1
+ class String
2
+ def to_snakecase
3
+ self.scan(/[A-Z][a-z]*/).join('_').downcase
4
+ end
5
+
6
+ def to_camelcase
7
+ self.split('_').map(&:capitalize).join
8
+ end
9
+ end
@@ -0,0 +1,14 @@
1
+ require "core_extensions/string"
2
+
3
+ require "payture/api/v1/version"
4
+ require "payture/api/v1/configuration"
5
+ require "payture/api/v1/client"
6
+
7
+ module Payture
8
+ module Api
9
+ module V1
10
+ extend Configuration
11
+
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,29 @@
1
+ module Payture::Api::V1
2
+
3
+ class Client
4
+ Dir[File.expand_path("../client/*.rb", __FILE__)].each{|f| require f}
5
+
6
+ attr_accessor *Configuration::VALID_OPTIONS_KEYS
7
+
8
+ def initialize(options={})
9
+ options = Payture::Api::V1.options.merge(options)
10
+ Configuration::VALID_OPTIONS_KEYS.each do |key|
11
+ send("#{key}=", options[key])
12
+ end
13
+
14
+ self.class.send(:include, Client::PaytureApi) if 'api' == self.api_type
15
+ self.class.send(:include, Client::PaytureApim) if 'apim' == self.api_type
16
+ self.class.send(:include, Client::PaytureVwapi) if 'vwapi' == self.api_type
17
+ end
18
+
19
+ def url
20
+ "https://#{host}.#{Configuration::DOMAIN}/#{api_type}/"
21
+ end
22
+
23
+ def api_methods
24
+ API_METHODS.map{|method| method.to_snakecase }
25
+ end
26
+
27
+ end
28
+
29
+ end
@@ -0,0 +1,19 @@
1
+ module Payture::Api::V1
2
+
3
+ class Client
4
+ module PaytureApi
5
+
6
+ API_METHODS = %w(Pay Block Charge Unblock Refund GetState)
7
+
8
+ API_METHODS.each do |method_name|
9
+ method = method_name.to_snakecase
10
+ define_method method do |options|
11
+ options ||= {}
12
+ # TODO: response = api.get(method_name, options)
13
+ end
14
+ end
15
+
16
+ end
17
+ end
18
+
19
+ end
@@ -0,0 +1,19 @@
1
+ module Payture::Api::V1
2
+
3
+ class Client
4
+ module PaytureApim
5
+
6
+ API_METHODS = %w(Init Pay Charge Unblock Refund PayStatus)
7
+
8
+ API_METHODS.each do |method_name|
9
+ underscore_method_name = method_name.to_snakecase
10
+ define_method underscore_method_name do |options|
11
+ options ||= {}
12
+ # TODO: response = api.get(method_name, options)
13
+ end
14
+ end
15
+
16
+ end
17
+ end
18
+
19
+ end
@@ -0,0 +1,19 @@
1
+ module Payture::Api::V1
2
+
3
+ class Client
4
+ module PaytureVwapi
5
+
6
+ API_METHODS = %w(Register Update Delete Add Activate Remove GetList Init Pay SendCode Charge Unblock Refund PayStatus)
7
+
8
+ API_METHODS.each do |method_name|
9
+ underscore_method_name = method_name.to_snakecase
10
+ define_method underscore_method_name do |options|
11
+ options ||= {}
12
+ # TODO: response = api.get(method_name, options)
13
+ end
14
+ end
15
+
16
+ end
17
+ end
18
+
19
+ end
@@ -0,0 +1,46 @@
1
+ module Payture
2
+ module Api
3
+ module V1
4
+ module Configuration
5
+
6
+ DOMAIN = 'payture.com'
7
+
8
+ DEFAULT_API_TYPE = 'api' # api, apim, vwapi
9
+ DEFAULT_HOST = 'sandbox' # sandbox, secure
10
+ DEFAULT_KEY = 'MerchantKey'
11
+ DEFAULT_PASSWORD = nil
12
+ DEFAULT_USER_AGENT = "Payture API V1 Ruby Gem #{Payture::Api::V1::VERSION}".freeze
13
+
14
+ VALID_OPTIONS_KEYS = [
15
+ :api_type,
16
+ :host,
17
+ :key,
18
+ :password,
19
+ :user_agent
20
+ ].freeze
21
+
22
+ attr_accessor *VALID_OPTIONS_KEYS
23
+
24
+ def self.extended(base)
25
+ base.reset
26
+ end
27
+
28
+ def reset
29
+ self.api_type = DEFAULT_API_TYPE
30
+ self.host = DEFAULT_HOST
31
+ self.key = DEFAULT_KEY
32
+ self.password = DEFAULT_PASSWORD
33
+ self.user_agent = DEFAULT_USER_AGENT
34
+ end
35
+
36
+ def configure
37
+ yield self
38
+ end
39
+
40
+ def options
41
+ Hash[ * VALID_OPTIONS_KEYS.map { |key| [key, send(key)] }.flatten ]
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,7 @@
1
+ module Payture
2
+ module Api
3
+ module V1
4
+ VERSION = "0.1.0"
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'payture/api/v1/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "payture-api-v1"
8
+ spec.version = Payture::Api::V1::VERSION
9
+ spec.authors = ["René Kersten"]
10
+ spec.email = ["rene.kersten@gmail.com"]
11
+ spec.description = %q{This library provides a wrapper to Version 1 of the Payture API}
12
+ spec.summary = %q{Payture API V1}
13
+ spec.homepage = "https://github.com/endorfin/payture-api-v1"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_development_dependency "bundler", "~> 1.8"
21
+ spec.add_development_dependency "rake"
22
+ spec.add_development_dependency "minitest"
23
+ spec.add_development_dependency "minitest-reporters"
24
+ spec.add_development_dependency "coveralls"
25
+ end
metadata ADDED
@@ -0,0 +1,131 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: payture-api-v1
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - René Kersten
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-02-25 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.8'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.8'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: minitest-reporters
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: coveralls
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: This library provides a wrapper to Version 1 of the Payture API
84
+ email:
85
+ - rene.kersten@gmail.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - .coveralls.yml
91
+ - .gitignore
92
+ - .travis.yml
93
+ - CODE_OF_CONDUCT.md
94
+ - Gemfile
95
+ - LICENSE.txt
96
+ - README.md
97
+ - Rakefile
98
+ - lib/core_extensions/string.rb
99
+ - lib/payture/api/v1.rb
100
+ - lib/payture/api/v1/client.rb
101
+ - lib/payture/api/v1/client/payture_api.rb
102
+ - lib/payture/api/v1/client/payture_apim.rb
103
+ - lib/payture/api/v1/client/payture_vwapi.rb
104
+ - lib/payture/api/v1/configuration.rb
105
+ - lib/payture/api/v1/version.rb
106
+ - payture-api-v1.gemspec
107
+ homepage: https://github.com/endorfin/payture-api-v1
108
+ licenses:
109
+ - MIT
110
+ metadata: {}
111
+ post_install_message:
112
+ rdoc_options: []
113
+ require_paths:
114
+ - lib
115
+ required_ruby_version: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - '>='
118
+ - !ruby/object:Gem::Version
119
+ version: '0'
120
+ required_rubygems_version: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '>='
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ requirements: []
126
+ rubyforge_project:
127
+ rubygems_version: 2.0.14
128
+ signing_key:
129
+ specification_version: 4
130
+ summary: Payture API V1
131
+ test_files: []