coinone 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: '069fdbc2420b9ecbcb4dda0073ad2c9e686ed075'
4
+ data.tar.gz: b459e4cddf4701f47aa02eb2bdb9f09476f31f8f
5
+ SHA512:
6
+ metadata.gz: e93fac3835c04afdb083a68cff996612435975d21ac34cc715c89957e154c62bca76429b67836cffbff9a7a67d2c6925262d3b7f7c1002d46ce0957dff5bceb6
7
+ data.tar.gz: 16ff0177794409a1ccd4235fbb2b2afa676f56027da3504b705b1ad6cb73bf3011fdf965253dd9c3e32ad9a8c13021f2aee5d0d7b1fa71b42193a986f4ddfb44
data/.gitignore ADDED
@@ -0,0 +1,13 @@
1
+ /.bundle/
2
+ /coverage/
3
+ /doc/
4
+ /pkg/
5
+ /spec/reports/
6
+ /tmp/
7
+
8
+ *.gem
9
+ /vendor/cache
10
+ /vendor/bundle
11
+ .DS_Store
12
+ */.DS_Store
13
+ Gemfile.lock
data/.rubocop.yml ADDED
@@ -0,0 +1,17 @@
1
+ # This is the configuration used to check the rubocop source code.
2
+
3
+ inherit_from: .rubocop_todo.yml
4
+
5
+ AllCops:
6
+ Exclude:
7
+ - 'vendor/**/*'
8
+ - 'spec/fixtures/**/*'
9
+ - 'tmp/**/*'
10
+ TargetRubyVersion: 2.3
11
+
12
+ Style/Encoding:
13
+ EnforcedStyle: when_needed
14
+ Enabled: true
15
+
16
+ Style/FrozenStringLiteralComment:
17
+ EnforcedStyle: always
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,30 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2016-12-15 10:19:48 +0900 using RuboCop version 0.46.0.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 87
10
+ Metrics/AbcSize:
11
+ Max: 19
12
+
13
+ # Offense count: 32
14
+ # Configuration parameters: CountComments.
15
+ Metrics/ClassLength:
16
+ Max: 177
17
+
18
+ # Offense count: 29
19
+ Metrics/CyclomaticComplexity:
20
+ Max: 7
21
+
22
+ # Offense count: 149
23
+ # Configuration parameters: CountComments.
24
+ Metrics/MethodLength:
25
+ Max: 14
26
+
27
+ # Offense count: 12
28
+ # Configuration parameters: CountComments.
29
+ Metrics/ModuleLength:
30
+ Max: 156
data/.travis.yml ADDED
@@ -0,0 +1,11 @@
1
+ language: ruby
2
+
3
+ cache: bundler
4
+
5
+ rvm:
6
+ - 2.2
7
+ - 2.3.0
8
+ - ruby-head
9
+
10
+ #gemfile:
11
+ # - Gemfile
data/CHANGE_LOG.md ADDED
@@ -0,0 +1,4 @@
1
+ ## Release History
2
+
3
+ * **v0.1.0** - 2017-03-08
4
+ - Init Gem
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in coinone.gemspec
4
+
5
+ gem 'pry'
6
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 ggomagundan
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,82 @@
1
+ # Coinone
2
+ [![GemVersion](https://badge.fury.io/rb/coinone.svg)](https://badge.fury.io/rb/coinone)
3
+
4
+ `Coinone` Gem is porting from Coinone API
5
+
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'coinone'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install coinone
22
+
23
+ ## Usage
24
+
25
+
26
+ ## Todo
27
+ - [x] ACCOUNT V2 / Account Infomation
28
+ - [ ] ACCOUNT V2 / Balance
29
+ - [ ] ACCOUNT V2 / Daily Balance
30
+ - [ ] ACCOUNT V2 / Deposit Address
31
+ - [ ] ACCOUNT V2 / Virtual Account
32
+
33
+ - [ ] OAUTH / Delete Access Token
34
+ - [ ] OAUTH / Get Access Token
35
+ - [ ] OAUTH / Get Request Token
36
+ - [ ] OAUTH / Refresh Access Token
37
+
38
+ - [ ] ORDER V2 / Cancel All Order
39
+ - [ ] ORDER V2 / Cancel Order
40
+ - [ ] ORDER V2 / Limit Buy
41
+ - [ ] ORDER V2 / Limit Sell
42
+ - [ ] ORDER V2 / Market Buy
43
+ - [ ] ORDER V2 / Market Sell
44
+ - [ ] ORDER V2 / My Complete Orders
45
+ - [ ] ORDER V2 / My Limit Orders
46
+
47
+
48
+ - [ ] PUBLIC / Currency
49
+ - [ ] PUBLIC / OrderBook
50
+ - [ ] PUBLIC / Recent Complete Orders
51
+ - [ ] PUBLIC / Ticker
52
+
53
+ - [ ] TRANSACTION V2 / 2-Factor Authentication
54
+ - [ ] TRANSACTION V2 / Coin Transactions History
55
+ - [ ] TRANSACTION V2 / KRW Transactions History
56
+ - [ ] TRANSACTION V2 / Send Coin
57
+
58
+ ## Full documentation
59
+
60
+ The Documentation is at [Coinone Docs](http://doc.coinone.co.kr/)
61
+
62
+ ## Change Log
63
+
64
+ Current Version 0.1.0
65
+
66
+ This link listing [Change Log](https://github.com/ggomagundan/coinone/blob/master/CHANGE_LOG.md)
67
+
68
+
69
+
70
+ ## Contributing
71
+
72
+ 1. Fork it
73
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
74
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
75
+ 4. Push to the branch (`git push origin my-new-feature`)
76
+ 5. Create new Pull Request
77
+
78
+
79
+ ## License
80
+
81
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
82
+
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "coinone"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/coinone.gemspec ADDED
@@ -0,0 +1,42 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'coinone/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "coinone"
8
+ spec.version = Coinone::VERSION
9
+ spec.authors = ["Kai Park"]
10
+ spec.email = ["ggogun@gmail.com"]
11
+
12
+ spec.summary = %q{Wrapping for coinone.co.kr API}
13
+ spec.description = %q{Wrapping for coinone.co.kr API}
14
+ spec.homepage = %q{https://github.com/ggomagundan/coinone}
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
19
+
20
+ =begin
21
+ if spec.respond_to?(:metadata)
22
+ spec.metadata['allowed_push_host'] = ""
23
+ else
24
+ raise "RubyGems 2.0 or newer is required to protect against " \
25
+ "public gem pushes."
26
+ end
27
+ =end
28
+
29
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
30
+ f.match(%r{^(test|spec|features)/})
31
+ end
32
+ spec.bindir = "exe"
33
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
34
+ spec.require_paths = ["lib"]
35
+
36
+ spec.add_development_dependency "bundler", "~> 1.14"
37
+ spec.add_development_dependency "rake", "~> 10.0"
38
+
39
+ spec.add_runtime_dependency "json", "~> 2.0.0"
40
+ spec.add_dependency 'rest-client'
41
+ spec.add_dependency 'addressable'
42
+ end
data/lib/coinone.rb ADDED
@@ -0,0 +1,7 @@
1
+ require "coinone/version"
2
+
3
+ module Coinone
4
+ require 'coinone/connection'
5
+ require 'coinone/account'
6
+ require 'coinone/error'
7
+ end
@@ -0,0 +1,68 @@
1
+ require "coinone/account/bank_info"
2
+ require "coinone/account/email_info"
3
+ require "coinone/account/fee_rate"
4
+ require "coinone/account/virtual_account_info"
5
+ require "coinone/account/mobile_info"
6
+
7
+ module Coinone
8
+
9
+ class Account
10
+
11
+ attr_reader :security_level
12
+ attr_reader :connection
13
+ attr_reader :bank_info, :email_info, :fee_rate, :virtual_account_info, :mobile_info
14
+
15
+ def initialize(options={}, connection=nil)
16
+ @connection = connection || Connection.factory(options)
17
+ @security_level = nil
18
+ @bank_info = BankInfo.new()
19
+ @email_info = EmailInfo.new()
20
+ @fee_rate = FeeRate.new()
21
+ @virtual_account_info = VirtualAccountInfo.new()
22
+ @mobile_info = MobileInfo.new()
23
+ end
24
+
25
+
26
+ def get_user_info
27
+ res = @connection.post( "/account/user_info/")
28
+
29
+ @connection.check_for_errors(res.body)
30
+
31
+ puts res.body
32
+
33
+ set_user_info(res.body)
34
+ end
35
+
36
+ def set_user_info(params={})
37
+ json = JSON.parse(params, :symbolize_names => true)
38
+
39
+ user_info = json[:userInfo]
40
+ @security_level = user_info[:securityLevel].to_i
41
+ bank_info = user_info[:bankInfo]
42
+ email_info = user_info[:emailInfo]
43
+ fee_rate = user_info[:feeRate]
44
+ virtual_account_info = user_info[:virtualAccountInfo]
45
+ mobile_info = user_info[:mobileInfo]
46
+
47
+ @bank_info.update_info(bank_info)
48
+ @email_info.update_info(email_info)
49
+ @fee_rate.update_info(fee_rate)
50
+ @virtual_account_info.update_info(virtual_account_info)
51
+ @mobile_info.update_info(mobile_info)
52
+
53
+
54
+ end
55
+
56
+ =begin
57
+ def security_level
58
+ return @security_level
59
+ end
60
+
61
+ def security_level=(new_security_level)
62
+ @security_level = new_security_level
63
+ end
64
+ =end
65
+
66
+
67
+ end
68
+ end
@@ -0,0 +1,30 @@
1
+ module Coinone
2
+
3
+ class Account
4
+ class BankInfo
5
+ attr_reader :depositor, :bank_code, :is_authenticated, :account_number
6
+
7
+ def initialize(params={})
8
+
9
+ @depositor = nil
10
+ @bank_code = nil
11
+ @is_authenticated = nil
12
+ @account_number = nil
13
+
14
+ update_info(params)
15
+ end
16
+
17
+ def update_info(params={})
18
+
19
+ @depositor = params[:depositor].strip if params.has_key? :depositor
20
+ @bank_code = params[:bankCode].strip if params.has_key? :bankCode
21
+ @is_authenticated = params[:isAuthenticated] == "true"
22
+ @account_number = params[:accountNumber].strip if params.has_key? :accountNumber
23
+
24
+ end
25
+ end
26
+
27
+ end
28
+ end
29
+
30
+
@@ -0,0 +1,23 @@
1
+ module Coinone
2
+
3
+ class Account
4
+ class EmailInfo
5
+ attr_reader :email, :is_authenticated
6
+
7
+ def initialize(params={})
8
+ @email = nil
9
+ @is_authenticated = nil
10
+
11
+ update_info(params)
12
+ end
13
+
14
+ def update_info(params={})
15
+ @email = params[:email].strip if params.has_key? :email
16
+ @is_authenticated = params[:isAuthenticated] == "true"
17
+ end
18
+ end
19
+
20
+ end
21
+ end
22
+
23
+
@@ -0,0 +1,27 @@
1
+ require "coinone/account/fee_rate/btc"
2
+ require "coinone/account/fee_rate/eth"
3
+ require "coinone/account/fee_rate/etc"
4
+ module Coinone
5
+
6
+ class Account
7
+ class FeeRate
8
+ attr_reader :btc, :eth, :etc
9
+
10
+ def initialize(params={})
11
+ @btc = Btc.new()
12
+ @eth = Eth.new()
13
+ @etc = Etc.new()
14
+ update_info(params)
15
+ end
16
+
17
+ def update_info(params={})
18
+ @btc.update_info(params[:btc]) if params.has_key? :btc
19
+ @eth.update_info(params[:eth]) if params.has_key? :eth
20
+ @etc.update_info(params[:etc]) if params.has_key? :etc
21
+ end
22
+ end
23
+
24
+ end
25
+ end
26
+
27
+
@@ -0,0 +1,25 @@
1
+ module Coinone
2
+
3
+ class Account
4
+ class FeeRate
5
+ class Btc
6
+ attr_reader :taker, :maker
7
+
8
+ def initialize(params={})
9
+ @taker = nil
10
+ @maker = nil
11
+ update_info(params)
12
+ end
13
+
14
+ def update_info(params={})
15
+ @taker = params[:taker] if params.has_key? :taker
16
+ @maker = params[:maker] if params.has_key? :maker
17
+ end
18
+
19
+ end
20
+ end
21
+
22
+ end
23
+ end
24
+
25
+
@@ -0,0 +1,25 @@
1
+ module Coinone
2
+
3
+ class Account
4
+ class FeeRate
5
+ class Etc
6
+ attr_reader :taker, :maker
7
+
8
+ def initialize(params={})
9
+ @taker = nil
10
+ @maker = nil
11
+ update_info(params)
12
+ end
13
+
14
+ def update_info(params={})
15
+ @taker = params[:taker] if params.has_key? :taker
16
+ @maker = params[:maker] if params.has_key? :maker
17
+ end
18
+
19
+ end
20
+ end
21
+
22
+ end
23
+ end
24
+
25
+
@@ -0,0 +1,25 @@
1
+ module Coinone
2
+
3
+ class Account
4
+ class FeeRate
5
+ class Eth
6
+ attr_reader :taker, :maker
7
+
8
+ def initialize(params={})
9
+ @taker = nil
10
+ @maker = nil
11
+ update_info(params)
12
+ end
13
+
14
+ def update_info(params={})
15
+ @taker = params[:taker] if params.has_key? :taker
16
+ @maker = params[:maker] if params.has_key? :maker
17
+ end
18
+
19
+ end
20
+ end
21
+
22
+ end
23
+ end
24
+
25
+
@@ -0,0 +1,28 @@
1
+ module Coinone
2
+
3
+ class Account
4
+ class MobileInfo
5
+ attr_reader :user_name, :phone_number, :phone_corp, :is_authenticated
6
+
7
+ def initialize(params={})
8
+ @user_name = nil
9
+ @phone_number = nil
10
+ @phone_corp = nil
11
+ @is_authenticated = nil
12
+ update_info(params)
13
+ end
14
+
15
+ def update_info(params={})
16
+
17
+ @user_name = params[:userName].strip if params.has_key? :userName
18
+ @phone_number = params[:phoneNumber].strip if params.has_key? :phoneNumber
19
+ @phone_corp = params[:phoneCorp].strip if params.has_key? :phoneCorp
20
+ @is_authenticated = params[:isAuthenticated] == "true"
21
+
22
+ end
23
+ end
24
+
25
+ end
26
+ end
27
+
28
+
@@ -0,0 +1,27 @@
1
+ module Coinone
2
+
3
+ class Account
4
+ class VirtualAccountInfo
5
+ attr_reader :depositor, :account_number, :bank_name
6
+
7
+ def initialize(params={})
8
+ @depositor = nil
9
+ @account_number = nil
10
+ @bank_name = nil
11
+ update_info(params)
12
+ end
13
+
14
+ def update_info(params={})
15
+ @depositor = params[:depositor].strip if params.has_key? :depositor
16
+ @account_number = params[:accountNumber].strip if params.has_key? :accountNumber
17
+ @bank_name = params[:bankName].strip if params.has_key? :bankName
18
+ end
19
+ end
20
+
21
+ end
22
+ end
23
+
24
+
25
+
26
+
27
+
@@ -0,0 +1,125 @@
1
+ require 'rest-client'
2
+ require 'openssl'
3
+ require 'addressable/uri'
4
+
5
+ require 'coinone/error'
6
+
7
+ module Coinone
8
+
9
+ class Connection
10
+
11
+ attr_reader :access_token, :secret_key
12
+
13
+ BASE_URI = "https://api.coinone.co.kr/v2"
14
+ REQUEST_URI = "https://coinone.co.kr/account/login/"
15
+ AUTH_URI = "https://api.coinone.co.kr/oauth/access_token/"
16
+ REFRESH_AUTH_URI = "https://api.coinone.co.kr/oauth/refresh_token/"
17
+ DELETE_AUTH_URI = "https://api.coinone.co.kr/oauth/delete_token/"
18
+ ACCESS_TOKEN = "ea3e8668-58cc-4eba-84b2-cdfbe616e5cc"
19
+ SECRET_KEY= "dac26d4b-558f-4ada-b2ad-549bc1242554"
20
+
21
+ def self.factory(params) # :nodoc
22
+ Connection.new(
23
+ access_token: params[:access_token],
24
+ secret_key: params[:secret_key]
25
+ )
26
+ end
27
+
28
+ def initialize(options={}) # :nodoc
29
+
30
+ @access_token = options[:access_token] || nil
31
+ @secret_key = options[:secret_key] || nil
32
+
33
+ end
34
+
35
+ def resource
36
+ @@resouce ||= RestClient::Resource.new( BASE_URI )
37
+ end
38
+
39
+ def get( connection_uri, params = {} )
40
+ resource[ connection_uri ].get params: params.merge(access_token: @access_token)
41
+ end
42
+
43
+ def post( connection_uri, params = {} )
44
+ params[:access_token] = @access_token
45
+ params[:nonce] = Time.now.to_i / 10000
46
+ payload = create_coinone_payload(params)
47
+ signature = create_coinone_signature(payload)
48
+ =begin
49
+ puts "Send To : #{connection_uri}"
50
+ puts "params: #{params}"
51
+ puts "payload: #{payload}"
52
+ puts "signature: #{create_coinone_signature(payload)}"
53
+ =end
54
+
55
+ resource[ connection_uri ].post params, {'Content-Type': 'application/json', 'X-COINONE-PAYLOAD': payload, 'X-COINONE-SIGNATURE': signature }
56
+
57
+ end
58
+
59
+ def create_coinone_signature( payload )
60
+ OpenSSL::HMAC.hexdigest( 'sha512', SECRET_KEY.upcase, payload)
61
+ end
62
+
63
+ def create_coinone_payload( data )
64
+ Base64.strict_encode64(data.to_json).chomp
65
+ end
66
+
67
+ def check_for_errors(response)
68
+ # {"errorCode"=>"130", "errorMessage"=>"V2 API Nonce value must be a positive integer", "result"=>"error"}
69
+ response = JSON.parse(response)
70
+ case response["errorCode"].to_i
71
+ when 11 then raise AccessTokenMissingError, response["errorMessage"]
72
+ when 12 then raise InvalidAccessTokenError, response["errorMessage"]
73
+ when 40 then raise InvalidAPIPermissionError, response["errorMessage"]
74
+ when 50 then raise AuthenticateError, response["errorMessage"]
75
+ when 51 then raise InvalidAPIError, response["errorMessage"]
76
+ when 100 then raise SessionExpiredError, response["errorMessage"]
77
+ when 101 then raise InvalidFormatError, response["errorMessage"]
78
+ when 102 then raise IDMissingError, response["errorMessage"]
79
+ when 103 then raise LackOfBalanceError, response["errorMessage"]
80
+ when 104 then raise OrderIdMissingError, response["errorMessage"]
81
+ when 105 then raise PriceNotCorrectError, response["errorMessage"]
82
+ when 106 then raise LockingError, response["errorMessage"]
83
+ when 107 then raise ParameterError, response["errorMessage"]
84
+ when 111 then raise OrderIdMissingError, response["errorMessage"]
85
+ when 112 then raise CancelFailedError, response["errorMessage"]
86
+ when 113 then raise QuantityTooLowError, response["errorMessage"]
87
+ when 120 then raise APIV2PayloadMissingError, response["errorMessage"]
88
+ when 121 then raise APIV2SignatureMissingError, response["errorMessa ge"]
89
+ when 122 then raise APIV2NonceMissingError, response["errorMessage"]
90
+ when 123 then raise APIV2SignatureIsNotCorrectError, response["errorMessage"]
91
+ when 130 then raise APIV2NonceValueMustBePosiveIntegerError, response["errorMessage"]
92
+ when 131 then raise APIV2NonceBiggerThenLastNonceError, response["errorMessage"]
93
+ when 132 then raise APIV2BodyIsCorruptedError, response["errorMessage"]
94
+ when 150 then raise APIV2Call150Error, response["errorMessage"]
95
+ when 151 then raise APIV2Call151Error, response["errorMessage"]
96
+ when 200 then raise WalletError, response["errorMessage"]
97
+ when 202 then raise Limitation202Error, response["errorMessage"]
98
+ when 210 then raise Limitation210Error, response["errorMessage"]
99
+ when 220 then raise Limitation220Error, response["errorMessage"]
100
+ when 221 then raise Limitation221Error, response["errorMessage"]
101
+ when 310 then raise MobileAuthError, response["errorMessage"]
102
+ when 311 then raise NeedMobileAuthError, response["errorMessage"]
103
+ when 312 then raise NameIsNotCorrectError, response["errorMessage"]
104
+ when 330 then raise PhoneNumberError, response["errorMessage"]
105
+ when 404 then raise PageNotFoundError, response["errorMessage"]
106
+ when 405 then raise ServerError, response["errorMessage"]
107
+ when 444 then raise LockingError, response["errorMessage"]
108
+ when 500 then raise Email500Error, response["errorMessage"]
109
+ when 501 then raise EMail501Error, response["errorMessage"]
110
+ when 777 then raise MobileAuthError, response["errorMessage"]
111
+ when 778 then raise PhoneNumberError, response["errorMessage"]
112
+ when 1202 then raise AppNotFoundError, response["errorMessage"]
113
+ when 1203 then raise AlreadyRegisteredError, response["errorMessage"]
114
+ when 1204 then raise InvalidAccessError, response["errorMessage"]
115
+ when 1205 then raise APIKeyError, response["errorMessage"]
116
+ when 1206 then raise UserNotFound1206Error, response["errorMessage"]
117
+ when 1207 then raise UserNotFound1207Error, response["errorMessage"]
118
+ when 1208 then raise UserNotFound1208Error, response["errorMessage"]
119
+ when 1209 then raise UserNotFound1209Error, response["errorMessage"]
120
+ end
121
+ end
122
+ end
123
+
124
+
125
+ end
@@ -0,0 +1,52 @@
1
+ module Coinone
2
+ #class HTTPRequestFailed < StandardError; end
3
+ class AccessTokenMissingError < StandardError; end # 11
4
+ class InvalidAccessTokenError < StandardError; end # 12
5
+ class InvalidAPIPermissionError < StandardError; end # 40
6
+ class AuthenticateError < StandardError; end # 50
7
+ class InvalidAPIError < StandardError; end # 51
8
+ class SessionExpiredError < StandardError; end # 100
9
+ class InvalidFormatError < StandardError; end # 101
10
+ class IDMissingError < StandardError; end # 102
11
+ class LackOfBalanceError < StandardError; end # 103
12
+ class OrderIdMissingError < StandardError; end # 104
13
+ class PriceNotCorrectError < StandardError; end # 105
14
+ class LockingError < StandardError; end # 106
15
+ class ParameterError < StandardError; end # 107
16
+ class OrderIdMissingError < StandardError; end # 111
17
+ class CancelFailedError < StandardError; end # 112
18
+ class QuantityTooLowError < StandardError; end # 113
19
+ class APIV2PayloadMissingError < StandardError; end # 120
20
+ class APIV2SignatureMissingError < StandardError; end # 121
21
+ class APIV2NonceMissingError < StandardError; end # 122
22
+ class APIV2SignatureIsNotCorrectError < StandardError; end # 123
23
+ class APIV2NonceValueMustBePosiveIntegerError < StandardError; end # 130
24
+ class APIV2NonceBiggerThenLastNonceError < StandardError; end # 131
25
+ class APIV2BodyIsCorruptedError < StandardError; end # 132
26
+ class APIV2Call150Error < StandardError; end # 150
27
+ class APIV2Call151Error < StandardError; end # 151
28
+ class WalletError < StandardError; end # 200
29
+ class Limitation202Error < StandardError; end # 202
30
+ class Limitation210Error < StandardError; end # 210
31
+ class Limitation220Error < StandardError; end # 220
32
+ class Limitation221Error < StandardError; end # 221
33
+ class MobileAuthError < StandardError; end # 310
34
+ class NeedMobileAuthError < StandardError; end # 311
35
+ class NameIsNotCorrectError < StandardError; end # 312
36
+ class PhoneNumberError < StandardError; end # 330
37
+ class PageNotFoundError < StandardError; end # 404
38
+ class ServerError < StandardError; end # 405
39
+ class LockingError < StandardError; end # 444
40
+ class Email500Error < StandardError; end # 500
41
+ class EMail501Error < StandardError; end # 501
42
+ class MobileAuthError < StandardError; end # 777
43
+ class PhoneNumberError < StandardError; end # 778
44
+ class AppNotFoundError < StandardError; end # 1202
45
+ class AlreadyRegisteredError < StandardError; end # 1203
46
+ class InvalidAccessError < StandardError; end # 1204
47
+ class APIKeyError < StandardError; end # 1205
48
+ class UserNotFound1206Error < StandardError; end # 1206
49
+ class UserNotFound1207Error < StandardError; end # 1207
50
+ class UserNotFound1208Error < StandardError; end # 1208
51
+ class UserNotFound1209Error < StandardError; end # 1209
52
+ end
@@ -0,0 +1,3 @@
1
+ module Coinone
2
+ VERSION = "0.1.0"
3
+ end
metadata ADDED
@@ -0,0 +1,139 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: coinone
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Kai Park
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-03-07 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.14'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.14'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: json
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
+ - !ruby/object:Gem::Dependency
56
+ name: rest-client
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
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: addressable
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: Wrapping for coinone.co.kr API
84
+ email:
85
+ - ggogun@gmail.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - ".gitignore"
91
+ - ".rubocop.yml"
92
+ - ".rubocop_todo.yml"
93
+ - ".travis.yml"
94
+ - CHANGE_LOG.md
95
+ - Gemfile
96
+ - LICENSE.txt
97
+ - README.md
98
+ - Rakefile
99
+ - bin/console
100
+ - bin/setup
101
+ - coinone.gemspec
102
+ - lib/coinone.rb
103
+ - lib/coinone/account.rb
104
+ - lib/coinone/account/bank_info.rb
105
+ - lib/coinone/account/email_info.rb
106
+ - lib/coinone/account/fee_rate.rb
107
+ - lib/coinone/account/fee_rate/btc.rb
108
+ - lib/coinone/account/fee_rate/etc.rb
109
+ - lib/coinone/account/fee_rate/eth.rb
110
+ - lib/coinone/account/mobile_info.rb
111
+ - lib/coinone/account/virtual_account_info.rb
112
+ - lib/coinone/connection.rb
113
+ - lib/coinone/error.rb
114
+ - lib/coinone/version.rb
115
+ homepage: https://github.com/ggomagundan/coinone
116
+ licenses:
117
+ - MIT
118
+ metadata: {}
119
+ post_install_message:
120
+ rdoc_options: []
121
+ require_paths:
122
+ - lib
123
+ required_ruby_version: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - ">="
126
+ - !ruby/object:Gem::Version
127
+ version: '0'
128
+ required_rubygems_version: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ requirements: []
134
+ rubyforge_project:
135
+ rubygems_version: 2.6.8
136
+ signing_key:
137
+ specification_version: 4
138
+ summary: Wrapping for coinone.co.kr API
139
+ test_files: []