corepro_fvr 1.0.9
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 +7 -0
- data/.gitignore +17 -0
- data/Gemfile +15 -0
- data/LICENSE +21 -0
- data/README.md +47 -0
- data/Rakefile +2 -0
- data/config-sample.yml +5 -0
- data/corepro_fvr.gemspec +25 -0
- data/lib/corepro.rb +15 -0
- data/lib/corepro/account.rb +111 -0
- data/lib/corepro/account_close.rb +21 -0
- data/lib/corepro/bank_document.rb +42 -0
- data/lib/corepro/card.rb +90 -0
- data/lib/corepro/connection.rb +90 -0
- data/lib/corepro/core_pro_api_exception.rb +26 -0
- data/lib/corepro/customer.rb +140 -0
- data/lib/corepro/customer_beneficiary.rb +42 -0
- data/lib/corepro/customer_document.rb +22 -0
- data/lib/corepro/external_account.rb +84 -0
- data/lib/corepro/external_account_document.rb +34 -0
- data/lib/corepro/models/account_access.rb +25 -0
- data/lib/corepro/models/account_id_only.rb +9 -0
- data/lib/corepro/models/api_error.rb +14 -0
- data/lib/corepro/models/customer_address.rb +17 -0
- data/lib/corepro/models/customer_answer.rb +9 -0
- data/lib/corepro/models/customer_beneficiary_id_only.rb +8 -0
- data/lib/corepro/models/customer_id_only.rb +8 -0
- data/lib/corepro/models/customer_message.rb +10 -0
- data/lib/corepro/models/customer_phone.rb +11 -0
- data/lib/corepro/models/customer_question.rb +21 -0
- data/lib/corepro/models/customer_response.rb +28 -0
- data/lib/corepro/models/customer_verify_request.rb +28 -0
- data/lib/corepro/models/envelope.rb +37 -0
- data/lib/corepro/models/external_account_id_only.rb +8 -0
- data/lib/corepro/models/external_account_verify.rb +13 -0
- data/lib/corepro/models/file_content.rb +10 -0
- data/lib/corepro/models/json_base.rb +93 -0
- data/lib/corepro/models/model_base.rb +26 -0
- data/lib/corepro/models/program_account.rb +20 -0
- data/lib/corepro/models/program_checking.rb +38 -0
- data/lib/corepro/models/program_e_code.rb +31 -0
- data/lib/corepro/models/program_external_account.rb +21 -0
- data/lib/corepro/models/program_interest_rate.rb +18 -0
- data/lib/corepro/models/program_limit.rb +12 -0
- data/lib/corepro/models/program_prepaid.rb +37 -0
- data/lib/corepro/models/program_savings.rb +36 -0
- data/lib/corepro/program.rb +74 -0
- data/lib/corepro/statement.rb +25 -0
- data/lib/corepro/transaction.rb +53 -0
- data/lib/corepro/transfer.rb +42 -0
- data/lib/corepro/utils/logger.rb +9 -0
- data/lib/corepro/utils/requestor.rb +120 -0
- data/lib/corepro/version.rb +4 -0
- data/q2labs_public.pem +9 -0
- data/test.pdf +0 -0
- data/test/a_program_test.rb +12 -0
- data/test/aa_customer_test.rb +78 -0
- data/test/ab_account_test.rb +45 -0
- data/test/ac_external_account_test.rb +39 -0
- data/test/ad_customer_beneficiary_test.rb +43 -0
- data/test/ae_customer_document_test.rb +16 -0
- data/test/af_bankdocument_test.rb +20 -0
- data/test/ag_external_account_document_test.rb +18 -0
- data/test/ai_statement_test.rb +23 -0
- data/test/aj_transfer_test.rb +53 -0
- data/test/ak_transaction_test.rb +19 -0
- data/test/al_card_test.rb +51 -0
- data/test/core_pro_test_base.rb +30 -0
- metadata +170 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4b87a445cdccdce45cbc4e2585afbe2ed5b67f6d
|
4
|
+
data.tar.gz: db2131bf8109f52cefacbcb94eede7b11dc93721
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b45b8a53f007da84f23f9b4d5a08518ac08d16ba9a0e2059a0803db7336970382518866d2b1be9489c81e4d83fe5cbca4b7f3e7f212626a40ec1fbd25e430a19
|
7
|
+
data.tar.gz: a33c0793b4140039d73a6915d95f61cd5d4d142e35e9d1fc3e5e22c277a8ad27bf3c00c37d50d518becb5eb55bc147290f77b4ac34cbc5af83291802ee2fd3d8
|
data/.gitignore
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in corepro.gemspec
|
4
|
+
gemspec
|
5
|
+
|
6
|
+
# gem 'corepro'
|
7
|
+
|
8
|
+
group :test do
|
9
|
+
if RUBY_PLATFORM =~ /(win32|w32)/
|
10
|
+
gem "win32console", '1.3.0'
|
11
|
+
end
|
12
|
+
gem "minitest"
|
13
|
+
gem 'minitest-reporters', '>= 0.5.0'
|
14
|
+
gem 'test-unit'
|
15
|
+
end
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 socialmoney.com
|
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 all
|
13
|
+
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 THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# corepro-sdk-ruby
|
2
|
+
|
3
|
+
A Ruby SDK for consuming the CorePro API
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'corepro'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install corepro
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
Use this object hierarchy as a simple entry point into CorePro. Details of the CorePro API itself are available at
|
24
|
+
https://docs.corepro.io/api. To see all available SDKs, visit https://docs.corepro.io/sdk.
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
require 'corepro'
|
28
|
+
|
29
|
+
# create a connection
|
30
|
+
# (typical use case is to pull connection info from config.yml, this is for explicitness)
|
31
|
+
conn = CorePro::Connection.new 'your-api-key-here', 'your-api-secret-here', 'api.corepro.io'
|
32
|
+
|
33
|
+
# retrieve a customer by a known tag (pass conn as nil if connection info is in config.yml)
|
34
|
+
cust = CorePro::Customer.getByTag 'bweaver', conn
|
35
|
+
|
36
|
+
# retrieve most recent transactions for that customer's primary account
|
37
|
+
trans = CorePro::Transaction.list cust.customerId, cust.accounts[0].accountId
|
38
|
+
|
39
|
+
```
|
40
|
+
|
41
|
+
## Contributing
|
42
|
+
|
43
|
+
1. Fork it ( https://github.com/socialmoney/corepro-sdk-ruby/fork )
|
44
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
45
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
46
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
47
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/config-sample.yml
ADDED
data/corepro_fvr.gemspec
ADDED
@@ -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 'corepro/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'corepro_fvr'
|
8
|
+
spec.version = CorePro::VERSION
|
9
|
+
spec.authors = ['devsupport', 'erendira', 'felipe']
|
10
|
+
spec.email = ['devsupport@socialmoney.com', 'garciaerendira@gmail.com', 'felipe.vr1591@gmail.com']
|
11
|
+
spec.summary = %q{A Ruby SDK for consuming the CorePro API.}
|
12
|
+
spec.description = %q{See https://docs.corepro.io for more detail.}
|
13
|
+
spec.homepage = 'https://github.com/nixv2/corepro-sdk-ruby'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
spec.required_ruby_version = '~> 2.4'
|
21
|
+
|
22
|
+
spec.add_development_dependency 'bundler', '~> 1.6'
|
23
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
24
|
+
spec.add_development_dependency 'test-unit', '~> 3.2'
|
25
|
+
end
|
data/lib/corepro.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require_relative 'corepro/connection'
|
2
|
+
require_relative 'corepro/account'
|
3
|
+
require_relative 'corepro/account_close'
|
4
|
+
require_relative 'corepro/card'
|
5
|
+
require_relative 'corepro/core_pro_api_exception'
|
6
|
+
require_relative 'corepro/customer'
|
7
|
+
require_relative 'corepro/customer_beneficiary'
|
8
|
+
require_relative 'corepro/customer_document'
|
9
|
+
require_relative 'corepro/bank_document'
|
10
|
+
require_relative 'corepro/external_account'
|
11
|
+
require_relative 'corepro/external_account_document'
|
12
|
+
require_relative 'corepro/program'
|
13
|
+
require_relative 'corepro/statement'
|
14
|
+
require_relative 'corepro/transaction'
|
15
|
+
require_relative 'corepro/transfer'
|
@@ -0,0 +1,111 @@
|
|
1
|
+
require_relative 'models/model_base'
|
2
|
+
require_relative 'utils/requestor'
|
3
|
+
require_relative 'models/account_id_only'
|
4
|
+
require_relative 'models/account_access'
|
5
|
+
|
6
|
+
module CorePro
|
7
|
+
class Account < Models::ModelBase
|
8
|
+
|
9
|
+
# Identifiers
|
10
|
+
attr_accessor :accountId
|
11
|
+
attr_accessor :customerId
|
12
|
+
attr_accessor :tag
|
13
|
+
attr_accessor :name
|
14
|
+
attr_accessor :routingNumber
|
15
|
+
attr_accessor :routingNumberMasked
|
16
|
+
attr_accessor :accountNumber
|
17
|
+
attr_accessor :accountNumberMasked
|
18
|
+
attr_accessor :legalName1
|
19
|
+
attr_accessor :legalName2
|
20
|
+
|
21
|
+
# state related
|
22
|
+
attr_accessor :status
|
23
|
+
attr_accessor :type
|
24
|
+
attr_accessor :productId
|
25
|
+
attr_accessor :createdDate
|
26
|
+
attr_accessor :closedDate
|
27
|
+
attr_accessor :isPrimary
|
28
|
+
attr_accessor :isCloseable
|
29
|
+
attr_accessor :lastModifiedDate
|
30
|
+
|
31
|
+
# goal related
|
32
|
+
attr_accessor :targetAmount
|
33
|
+
attr_accessor :targetDate
|
34
|
+
attr_accessor :targetMetDate
|
35
|
+
attr_accessor :targetMetPercent
|
36
|
+
attr_accessor :category
|
37
|
+
attr_accessor :subCategory
|
38
|
+
|
39
|
+
# balance related
|
40
|
+
attr_accessor :availableBalance
|
41
|
+
attr_accessor :accountBalance
|
42
|
+
attr_accessor :pendingBalance
|
43
|
+
attr_accessor :balanceLastModifiedDate
|
44
|
+
|
45
|
+
# recurring deposit related
|
46
|
+
attr_accessor :recurringContributionType
|
47
|
+
attr_accessor :recurringContributionAmount
|
48
|
+
attr_accessor :recurringContributionFromExternalAccountId
|
49
|
+
attr_accessor :recurringContributionStartDate
|
50
|
+
attr_accessor :recurringContributionEndDate
|
51
|
+
attr_accessor :recurringContributionNextDate
|
52
|
+
|
53
|
+
# joint account related
|
54
|
+
attr_accessor :totalCustomers
|
55
|
+
attr_accessor :isJointAccount
|
56
|
+
attr_accessor :primaryCustomerId
|
57
|
+
attr_accessor :isPrimaryCustomer
|
58
|
+
attr_accessor :accessTypeCode
|
59
|
+
attr_accessor :customerPriority
|
60
|
+
|
61
|
+
# customizable
|
62
|
+
attr_accessor :customField1
|
63
|
+
attr_accessor :customField2
|
64
|
+
attr_accessor :customField3
|
65
|
+
attr_accessor :customField4
|
66
|
+
attr_accessor :customField5
|
67
|
+
|
68
|
+
def initialize; end
|
69
|
+
|
70
|
+
def self.list(customerId, connection = nil, loggingObject = nil)
|
71
|
+
CorePro::Utils::Requestor.get("/account/list/#{customerId}", Account, connection, loggingObject)
|
72
|
+
end
|
73
|
+
|
74
|
+
def self.get(customerId, accountId, connection = nil, loggingObject = nil)
|
75
|
+
CorePro::Utils::Requestor.get("/account/get/#{customerId}/#{accountId}", Account, connection, loggingObject)
|
76
|
+
end
|
77
|
+
|
78
|
+
def self.getByTag(customerId, tag, connection = nil, loggingObject = nil)
|
79
|
+
CorePro::Utils::Requestor.get("/account/getByTag/#{customerId}/#{escape(tag)}", Account, connection, loggingObject)
|
80
|
+
end
|
81
|
+
|
82
|
+
def create(connection = nil, loggingObject = nil)
|
83
|
+
aid = CorePro::Utils::Requestor.post('/account/create', CorePro::Models::AccountIdOnly, self, connection, loggingObject)
|
84
|
+
aid.accountId
|
85
|
+
end
|
86
|
+
|
87
|
+
def update(connection = nil, loggingObject = nil)
|
88
|
+
aid = CorePro::Utils::Requestor.post('/account/update', CorePro::Models::AccountIdOnly, self, connection, loggingObject)
|
89
|
+
aid.accountId
|
90
|
+
end
|
91
|
+
|
92
|
+
def close(customerId, accountId, closeToAccountId, transactionTag, connection = nil, loggingObject = nil)
|
93
|
+
ac = CorePro::AccountClose.new
|
94
|
+
ac.customerId = customerId
|
95
|
+
ac.accountId = accountId
|
96
|
+
ac.closeToAccountId = closeToAccountId
|
97
|
+
ac.transactionTag = transactionTag
|
98
|
+
ac.close(connection, loggingObject)
|
99
|
+
end
|
100
|
+
|
101
|
+
def self.listAccess(customerId, accountId, connection = nil, loggingObject = nil)
|
102
|
+
CorePro::Utils::Requestor.get("/account/listaccess/#{customerId}/#{accountId}", CorePro::Models::AccountAccess, connection, loggingObject)
|
103
|
+
end
|
104
|
+
|
105
|
+
def editAccess(connection = nil, loggingObject = nil)
|
106
|
+
aea = CorePro::Utils::Requestor.post('/account/editaccess', CorePro::Models::AccountIdOnly, self, connection, loggingObject)
|
107
|
+
aea.accountId
|
108
|
+
end
|
109
|
+
|
110
|
+
end
|
111
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require_relative 'models/model_base'
|
2
|
+
require_relative 'utils/requestor'
|
3
|
+
|
4
|
+
module CorePro
|
5
|
+
class AccountClose < Models::ModelBase
|
6
|
+
attr_accessor :customerId
|
7
|
+
attr_accessor :accountId
|
8
|
+
attr_accessor :closeToAccountId
|
9
|
+
attr_accessor :transactionId
|
10
|
+
attr_accessor :transactionTag
|
11
|
+
attr_accessor :closingBalanceAmount
|
12
|
+
attr_accessor :interestPaidAmount
|
13
|
+
attr_accessor :backupWithholdingAmount
|
14
|
+
attr_accessor :totalClosingAmount
|
15
|
+
attr_accessor :isClosedToExternalAccount
|
16
|
+
|
17
|
+
def close(connection = nil, loggingObject = nil)
|
18
|
+
CorePro::Utils::Requestor.post('/account/close', AccountClose, self, connection, loggingObject)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require_relative 'models/model_base'
|
2
|
+
require_relative 'utils/requestor'
|
3
|
+
require_relative 'models/file_content'
|
4
|
+
|
5
|
+
module CorePro
|
6
|
+
class BankDocument < Models::ModelBase
|
7
|
+
|
8
|
+
attr_accessor :bankId
|
9
|
+
attr_accessor :customerId
|
10
|
+
attr_accessor :documentId
|
11
|
+
attr_accessor :documentType
|
12
|
+
attr_accessor :culture
|
13
|
+
attr_accessor :html
|
14
|
+
attr_accessor :title
|
15
|
+
attr_accessor :downloadUrl
|
16
|
+
attr_accessor :effectiveDate
|
17
|
+
attr_accessor :expireDate
|
18
|
+
|
19
|
+
def self.list(culture, documentType = nil, connection = nil, loggingObject = nil)
|
20
|
+
d = BankDocument.new
|
21
|
+
d.culture = culture
|
22
|
+
d.documentType = documentType
|
23
|
+
d.list connection, loggingObject
|
24
|
+
end
|
25
|
+
|
26
|
+
def list(connection = nil, loggingObject = nil)
|
27
|
+
CorePro::Utils::Requestor.get("/bankdocument/list/#{BankDocument.escape(self.culture)}/#{BankDocument.escape(self.documentType)}", BankDocument, connection, loggingObject)
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.download(culture, documentId, connection = nil, loggingObject = nil)
|
31
|
+
d = BankDocument.new
|
32
|
+
d.culture = culture
|
33
|
+
d.documentId = documentId
|
34
|
+
d.download connection, loggingObject
|
35
|
+
end
|
36
|
+
|
37
|
+
def download(connection = nil, loggingObject = nil)
|
38
|
+
CorePro::Utils::Requestor.get("/bankdocument/download/#{BankDocument.escape(self.culture)}/#{self.documentId}", CorePro::Models::FileContent, connection, loggingObject)
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
data/lib/corepro/card.rb
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
require_relative 'models/model_base'
|
2
|
+
require_relative 'utils/requestor'
|
3
|
+
|
4
|
+
module CorePro
|
5
|
+
class Card < Models::ModelBase
|
6
|
+
attr_accessor :cardId
|
7
|
+
attr_accessor :customerId
|
8
|
+
attr_accessor :cardHolderCustomerId
|
9
|
+
attr_accessor :typeCode
|
10
|
+
attr_accessor :vendorTypeCode
|
11
|
+
attr_accessor :status
|
12
|
+
attr_accessor :cardNumberMasked
|
13
|
+
attr_accessor :tag
|
14
|
+
attr_accessor :firstName
|
15
|
+
attr_accessor :middleName
|
16
|
+
attr_accessor :lastName
|
17
|
+
attr_accessor :nickName
|
18
|
+
attr_accessor :expireMonth
|
19
|
+
attr_accessor :expireYear
|
20
|
+
attr_accessor :primaryAccountId
|
21
|
+
attr_accessor :lockTypeCode
|
22
|
+
attr_accessor :lockReasonTypeCode
|
23
|
+
attr_accessor :createdDate
|
24
|
+
attr_accessor :requestedDate
|
25
|
+
attr_accessor :verifiedDate
|
26
|
+
attr_accessor :reissuedDate
|
27
|
+
attr_accessor :deniedDate
|
28
|
+
attr_accessor :expiredDate
|
29
|
+
attr_accessor :archivedDate
|
30
|
+
attr_accessor :lastModifiedDate
|
31
|
+
attr_accessor :accounts
|
32
|
+
attr_accessor :newPin
|
33
|
+
|
34
|
+
def self.get(customerId, cardId, connection = nil, loggingObject = nil)
|
35
|
+
CorePro::Utils::Requestor.get("/card/get/#{customerId}/#{cardId}", Card, connection, loggingObject)
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.getByTag(customerId, tag, connection = nil, loggingObject = nil)
|
39
|
+
CorePro::Utils::Requestor.get("/card/getByTag/#{customerId}/#{escape(tag)}", Card, connection, loggingObject)
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.list(customerId, connection = nil, loggingObject = nil)
|
43
|
+
CorePro::Utils::Requestor.get("/card/list/#{customerId}", Card, connection, loggingObject)
|
44
|
+
end
|
45
|
+
|
46
|
+
def initiate(connection = nil, loggingObject = nil)
|
47
|
+
CorePro::Utils::Requestor.post('/card/initiate', Card, self, connection, loggingObject)
|
48
|
+
end
|
49
|
+
|
50
|
+
def verify(connection = nil, loggingObject = nil)
|
51
|
+
CorePro::Utils::Requestor.post('/card/verify', Card, self, connection, loggingObject)
|
52
|
+
end
|
53
|
+
|
54
|
+
def reissue(connection = nil, loggingObject = nil)
|
55
|
+
CorePro::Utils::Requestor.post('/card/reissue', Card, self, connection, loggingObject)
|
56
|
+
end
|
57
|
+
|
58
|
+
def archive(connection = nil, loggingObject = nil)
|
59
|
+
CorePro::Utils::Requestor.post('/card/archive', nil, self, connection, loggingObject)
|
60
|
+
end
|
61
|
+
|
62
|
+
|
63
|
+
|
64
|
+
def addAccount(connection = nil, loggingObject = nil)
|
65
|
+
CorePro::Utils::Requestor.post('/card/addAccount', Card, self, connection, loggingObject)
|
66
|
+
end
|
67
|
+
|
68
|
+
def removeAccount(connection = nil, loggingObject = nil)
|
69
|
+
CorePro::Utils::Requestor.post('/card/removeAccount', Card, self, connection, loggingObject)
|
70
|
+
end
|
71
|
+
|
72
|
+
def reprioritizeAccount(connection = nil, loggingObject = nil)
|
73
|
+
CorePro::Utils::Requestor.post('/card/reprioritizeAccount', Card, self, connection, loggingObject)
|
74
|
+
end
|
75
|
+
|
76
|
+
|
77
|
+
def hotlist(connection = nil, loggingObject = nil)
|
78
|
+
CorePro::Utils::Requestor.post('/card/hotlist', Card, self, connection, loggingObject)
|
79
|
+
end
|
80
|
+
|
81
|
+
def lock(connection = nil, loggingObject = nil)
|
82
|
+
CorePro::Utils::Requestor.post('/card/lock', Card, self, connection, loggingObject)
|
83
|
+
end
|
84
|
+
|
85
|
+
def unlock(connection = nil, loggingObject = nil)
|
86
|
+
CorePro::Utils::Requestor.post('/card/unlock', Card, self, connection, loggingObject)
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
90
|
+
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
require 'base64'
|
2
|
+
require 'yaml'
|
3
|
+
|
4
|
+
module CorePro
|
5
|
+
class Connection
|
6
|
+
|
7
|
+
attr_accessor :proxyServerName
|
8
|
+
attr_accessor :proxyPort
|
9
|
+
attr_accessor :proxyUser
|
10
|
+
attr_accessor :proxyPassword
|
11
|
+
|
12
|
+
@@config = begin
|
13
|
+
if File.exists?('config.yml')
|
14
|
+
YAML.load(File.open('config.yml'))
|
15
|
+
elsif File.exists?('../config.yml')
|
16
|
+
YAML.load(File.open('../config.yml'))
|
17
|
+
else
|
18
|
+
{}
|
19
|
+
end
|
20
|
+
rescue ArgumentError => e
|
21
|
+
puts "Could not parse YAML: #{e.message}"
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
def self.createFromConfig(apiKey = nil, apiSecret = nil, domainName = nil, proxyServerName = nil, proxyPort = nil)
|
26
|
+
c = Connection.new
|
27
|
+
c.apiKey = apiKey || @@config['CoreProApiKey']
|
28
|
+
c.apiSecret = apiSecret || @@config['CoreProApiSecret']
|
29
|
+
c.domainName = domainName || @@config['CoreProDomainName']
|
30
|
+
c.proxyServerName = proxyServerName || @@config['CoreProProxyServerName']
|
31
|
+
c.proxyPort = proxyPort || @@config['CoreProProxyPort']
|
32
|
+
c
|
33
|
+
end
|
34
|
+
|
35
|
+
def initialize(apiKey = nil, apiSecret = nil, domainName = nil, proxyServerName = nil, proxyPort = nil, proxyUser = nil, proxyPassword = nil)
|
36
|
+
@apiKey = apiKey || @@config['CoreProApiKey']
|
37
|
+
@apiSecret = apiSecret || @@config['CoreProApiSecret']
|
38
|
+
@domainName = domainName || @@config['CoreProDomainName']
|
39
|
+
@proxyServerName = proxyServerName || @@config['CoreProProxyServerName']
|
40
|
+
@proxyPort = proxyPort || @@config['CoreProProxyPort']
|
41
|
+
@proxyUser = proxyUser || @@config['CoreProProxyUser']
|
42
|
+
@proxyPassword = proxyPassword || @@config['CoreProProxyPassword']
|
43
|
+
@headerValue = ''
|
44
|
+
end
|
45
|
+
|
46
|
+
def apiKey
|
47
|
+
@apiKey
|
48
|
+
end
|
49
|
+
|
50
|
+
def apiKey=(value)
|
51
|
+
@apiKey = value
|
52
|
+
@headerValue = ''
|
53
|
+
end
|
54
|
+
|
55
|
+
def apiSecret
|
56
|
+
@apiSecret
|
57
|
+
end
|
58
|
+
|
59
|
+
def apiSecret=(value)
|
60
|
+
@apiSecret = value
|
61
|
+
@headerValue = ''
|
62
|
+
end
|
63
|
+
|
64
|
+
def headerValue
|
65
|
+
if (@headerValue || '' == '')
|
66
|
+
utf8Value = "#{@apiKey}:#{@apiSecret}".force_encoding('iso-8859-1').encode('utf-8')
|
67
|
+
b64 = Base64.strict_encode64(utf8Value)
|
68
|
+
@headerValue = "Basic #{b64}"
|
69
|
+
end
|
70
|
+
@headerValue
|
71
|
+
end
|
72
|
+
|
73
|
+
def domainName
|
74
|
+
@domainName
|
75
|
+
end
|
76
|
+
|
77
|
+
def domainName=(value)
|
78
|
+
if value == nil
|
79
|
+
@domainName = nil
|
80
|
+
else
|
81
|
+
value.gsub! 'https://', ''
|
82
|
+
value.gsub! 'http://', ''
|
83
|
+
value.gsub! 'www.', ''
|
84
|
+
|
85
|
+
@domainName = value.split('/')[0]
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
90
|
+
end
|