genesis_ruby 0.2.4 → 0.2.6
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 +4 -4
- data/CHANGELOG.md +46 -0
- data/Gemfile.lock +15 -15
- data/README.md +41 -0
- data/VERSION +1 -1
- data/lib/genesis_ruby/api/constants/currencies/iso4217.rb +6 -0
- data/lib/genesis_ruby/api/constants/non_financial/kyc/document_supported_types.rb +28 -0
- data/lib/genesis_ruby/api/constants/non_financial/kyc/document_types.rb +49 -0
- data/lib/genesis_ruby/api/constants/non_financial/kyc/genders.rb +22 -0
- data/lib/genesis_ruby/api/constants/non_financial/kyc/profile_current_statuses.rb +25 -0
- data/lib/genesis_ruby/api/constants/transactions/parameters/african_mobile_operators.rb +37 -0
- data/lib/genesis_ruby/api/constants/transactions/parameters/customer_identification/customer_identification_owner.rb +24 -0
- data/lib/genesis_ruby/api/constants/transactions/parameters/customer_identification/customer_identification_subtype.rb +24 -0
- data/lib/genesis_ruby/api/constants/transactions/parameters/customer_identification/customer_identification_type.rb +63 -0
- data/lib/genesis_ruby/api/constants/transactions/parameters/digital_asset_types.rb +31 -0
- data/lib/genesis_ruby/api/constants/transactions/parameters/purpose_of_payment.rb +136 -0
- data/lib/genesis_ruby/api/constants/transactions/parameters/source_of_funds.rb +34 -0
- data/lib/genesis_ruby/api/mixins/requests/digital_asset_type_attributes.rb +26 -0
- data/lib/genesis_ruby/api/mixins/requests/financial/african_mobile_attributes.rb +30 -0
- data/lib/genesis_ruby/api/mixins/requests/financial/cards/tokenization_params_attributes.rb +36 -0
- data/lib/genesis_ruby/api/mixins/requests/financial/customer_identification_attributes.rb +82 -0
- data/lib/genesis_ruby/api/mixins/requests/financial/gift_cards_attributes.rb +26 -0
- data/lib/genesis_ruby/api/mixins/requests/financial/preauthorization_attributes.rb +25 -0
- data/lib/genesis_ruby/api/mixins/requests/financial/purpose_of_payment_attributes.rb +29 -0
- data/lib/genesis_ruby/api/mixins/requests/financial/source_of_funds_attributes.rb +38 -0
- data/lib/genesis_ruby/api/mixins/requests/financial/travel_data/airline_itinerary_attributes.rb +1 -1
- data/lib/genesis_ruby/api/mixins/requests/non_financial/fx/id_attributes.rb +28 -0
- data/lib/genesis_ruby/api/mixins/requests/non_financial/fx/tier_id_attributes.rb +28 -0
- data/lib/genesis_ruby/api/mixins/requests/non_financial/kyc/customer_information_attributes.rb +62 -0
- data/lib/genesis_ruby/api/mixins/requests/non_financial/kyc/document_attributes.rb +60 -0
- data/lib/genesis_ruby/api/request.rb +7 -0
- data/lib/genesis_ruby/api/requests/base/financials/credit_card.rb +4 -2
- data/lib/genesis_ruby/api/requests/base/non_financial/kyc/base.rb +33 -0
- data/lib/genesis_ruby/api/requests/base/reference.rb +1 -2
- data/lib/genesis_ruby/api/requests/financial/cards/authorize.rb +5 -1
- data/lib/genesis_ruby/api/requests/financial/cards/authorize3d.rb +5 -1
- data/lib/genesis_ruby/api/requests/financial/cards/credit.rb +39 -0
- data/lib/genesis_ruby/api/requests/financial/cards/payout.rb +72 -0
- data/lib/genesis_ruby/api/requests/financial/cards/sale.rb +3 -1
- data/lib/genesis_ruby/api/requests/financial/cards/sale3d.rb +3 -1
- data/lib/genesis_ruby/api/requests/financial/crypto/bit_pay/payout.rb +52 -0
- data/lib/genesis_ruby/api/requests/financial/crypto/bit_pay/refund.rb +36 -0
- data/lib/genesis_ruby/api/requests/financial/crypto/bit_pay/sale.rb +55 -0
- data/lib/genesis_ruby/api/requests/financial/gift_cards/fashioncheque.rb +47 -0
- data/lib/genesis_ruby/api/requests/financial/gift_cards/intersolve.rb +46 -0
- data/lib/genesis_ruby/api/requests/financial/gift_cards/tcs.rb +47 -0
- data/lib/genesis_ruby/api/requests/financial/mobile/african_mobile_sale.rb +81 -0
- data/lib/genesis_ruby/api/requests/financial/mobile/russian_mobile_sale.rb +55 -0
- data/lib/genesis_ruby/api/requests/financial/preauthorizations/incremental_authorize.rb +24 -0
- data/lib/genesis_ruby/api/requests/financial/preauthorizations/partial_reversal.rb +24 -0
- data/lib/genesis_ruby/api/requests/financial/vouchers/neosurf.rb +61 -0
- data/lib/genesis_ruby/api/requests/non_financial/fraud/chargeback/date_range.rb +82 -0
- data/lib/genesis_ruby/api/requests/non_financial/fraud/chargeback/transaction.rb +52 -0
- data/lib/genesis_ruby/api/requests/non_financial/fraud/reports/date_range.rb +108 -0
- data/lib/genesis_ruby/api/requests/non_financial/fraud/reports/transaction.rb +52 -0
- data/lib/genesis_ruby/api/requests/non_financial/fx/get_rate.rb +55 -0
- data/lib/genesis_ruby/api/requests/non_financial/fx/get_rates.rb +53 -0
- data/lib/genesis_ruby/api/requests/non_financial/fx/get_tier.rb +53 -0
- data/lib/genesis_ruby/api/requests/non_financial/fx/get_tiers.rb +35 -0
- data/lib/genesis_ruby/api/requests/non_financial/fx/search_rate.rb +61 -0
- data/lib/genesis_ruby/api/requests/non_financial/kyc/consumer_registration/create.rb +99 -0
- data/lib/genesis_ruby/api/requests/non_financial/kyc/consumer_registration/update.rb +50 -0
- data/lib/genesis_ruby/api/requests/non_financial/kyc/verifications/remote_identity.rb +91 -0
- data/lib/genesis_ruby/api/requests/non_financial/tokenization/cryptogram.rb +5 -2
- data/lib/genesis_ruby/api/requests/wpf/create.rb +3 -1
- data/lib/genesis_ruby/configuration.rb +4 -0
- data/lib/genesis_ruby/dependencies.rb +1 -0
- data/lib/genesis_ruby/utils/country.rb +272 -0
- data/lib/genesis_ruby/utils/money/conversions/amount_to_exponent.rb +1 -4
- data/lib/genesis_ruby/version.rb +1 -1
- metadata +52 -2
@@ -0,0 +1,99 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Api
|
3
|
+
module Requests
|
4
|
+
module NonFinancial
|
5
|
+
module Kyc
|
6
|
+
module ConsumerRegistration
|
7
|
+
# Create Consumer Registration Request class for KYC Non-Financial API services
|
8
|
+
class Create < Api::Requests::Base::NonFinancial::Kyc::Base
|
9
|
+
|
10
|
+
include Api::Mixins::Requests::NonFinancial::Kyc::CustomerInformationAttributes
|
11
|
+
|
12
|
+
attr_accessor :session_id, :customer_unique_id, :transaction_unique_id, :customer_phone_number,
|
13
|
+
:service_language, :security_code, :service_type, :customer_username,
|
14
|
+
:customer_registration_date, :customer_registration_ip_address,
|
15
|
+
:customer_registration_device_id, :third_party_device_id, :device_fingerprint,
|
16
|
+
:bonus_code, :bonus_submission_date, :bonus_amount, :merchant_website,
|
17
|
+
:how_did_you_hear, :affiliate_id, :rule_context
|
18
|
+
attr_writer :profile_action_type, :device_fingerprint_type, :profile_current_status, :industry_type
|
19
|
+
|
20
|
+
# Initializes the Create Consumer Registration Request
|
21
|
+
def initialize(configuration, _builder_interface = nil)
|
22
|
+
super configuration
|
23
|
+
|
24
|
+
self.request_path = 'create_consumer'
|
25
|
+
end
|
26
|
+
|
27
|
+
# Returns device_fingerprint_type as an integer
|
28
|
+
def device_fingerprint_type
|
29
|
+
@device_fingerprint_type&.to_i
|
30
|
+
end
|
31
|
+
|
32
|
+
# Returns profile_action_type as an integer
|
33
|
+
def profile_action_type
|
34
|
+
@profile_action_type&.to_i
|
35
|
+
end
|
36
|
+
|
37
|
+
# Returns profile_current_status as an integer
|
38
|
+
def profile_current_status
|
39
|
+
@profile_current_status&.to_i
|
40
|
+
end
|
41
|
+
|
42
|
+
# Returns industry_type as an integer
|
43
|
+
def industry_type
|
44
|
+
@industry_type&.to_i
|
45
|
+
end
|
46
|
+
|
47
|
+
protected
|
48
|
+
|
49
|
+
# Sets the request field validations
|
50
|
+
def init_field_validations # rubocop:disable Metrics/MethodLength
|
51
|
+
super
|
52
|
+
|
53
|
+
required_fields.push *%i[
|
54
|
+
customer_unique_id
|
55
|
+
customer_registration_date
|
56
|
+
customer_registration_ip_address
|
57
|
+
] + customer_information_required_fields
|
58
|
+
|
59
|
+
field_values.merge! device_fingerprint_type: [1, 2, 3],
|
60
|
+
profile_action_type: [1, 2],
|
61
|
+
profile_current_status:
|
62
|
+
GenesisRuby::Api::Constants::NonFinancial::Kyc::ProfileCurrentStatuses.all,
|
63
|
+
industry_type: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
|
64
|
+
field_values.merge! customer_information_required_field_values
|
65
|
+
end
|
66
|
+
|
67
|
+
# Defines the request structure
|
68
|
+
def request_structure # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
69
|
+
{
|
70
|
+
session_id: session_id,
|
71
|
+
customer_username: customer_username,
|
72
|
+
customer_unique_id: customer_unique_id,
|
73
|
+
customer_registration_date: customer_registration_date,
|
74
|
+
customer_registration_ip_address: customer_registration_ip_address,
|
75
|
+
customer_registration_device_id: customer_registration_device_id,
|
76
|
+
customer_information: customer_information_structure,
|
77
|
+
third_party_device_id: third_party_device_id,
|
78
|
+
device_fingerprint: device_fingerprint,
|
79
|
+
device_fingerprint_type: device_fingerprint_type,
|
80
|
+
profile_action_type: profile_action_type,
|
81
|
+
profile_current_status: profile_current_status,
|
82
|
+
bonus_code: bonus_code,
|
83
|
+
bonus_submission_date: bonus_submission_date,
|
84
|
+
bonus_amount: bonus_amount,
|
85
|
+
merchant_website: merchant_website,
|
86
|
+
industry_type: industry_type,
|
87
|
+
how_did_you_hear: how_did_you_hear,
|
88
|
+
affiliate_id: affiliate_id,
|
89
|
+
rule_context: rule_context
|
90
|
+
}
|
91
|
+
end
|
92
|
+
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'genesis_ruby/api/constants/non_financial/kyc/profile_current_statuses'
|
2
|
+
|
3
|
+
module GenesisRuby
|
4
|
+
module Api
|
5
|
+
module Requests
|
6
|
+
module NonFinancial
|
7
|
+
module Kyc
|
8
|
+
module ConsumerRegistration
|
9
|
+
# Update Consumer Registration Request class for KYC Non-Financial API services
|
10
|
+
class Update < Api::Requests::Base::NonFinancial::Kyc::Base
|
11
|
+
|
12
|
+
attr_accessor :reference_id, :profile_current_status, :status_reason
|
13
|
+
|
14
|
+
def initialize(configuration, _builder_interface = nil)
|
15
|
+
super configuration
|
16
|
+
|
17
|
+
self.request_path = 'update_consumer'
|
18
|
+
end
|
19
|
+
|
20
|
+
protected
|
21
|
+
|
22
|
+
# Sets the request field validations
|
23
|
+
def init_field_validations
|
24
|
+
super
|
25
|
+
|
26
|
+
required_fields.push *%i[
|
27
|
+
reference_id
|
28
|
+
profile_current_status
|
29
|
+
]
|
30
|
+
|
31
|
+
field_values.merge! profile_current_status:
|
32
|
+
GenesisRuby::Api::Constants::NonFinancial::Kyc::ProfileCurrentStatuses.all
|
33
|
+
end
|
34
|
+
|
35
|
+
# Defines the request structure
|
36
|
+
def request_structure
|
37
|
+
{
|
38
|
+
reference_id: reference_id,
|
39
|
+
profile_current_status: profile_current_status,
|
40
|
+
status_reason: status_reason
|
41
|
+
}
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
require 'genesis_ruby/api/constants/non_financial/kyc/document_supported_types'
|
2
|
+
|
3
|
+
module GenesisRuby
|
4
|
+
module Api
|
5
|
+
module Requests
|
6
|
+
module NonFinancial
|
7
|
+
module Kyc
|
8
|
+
module Verifications
|
9
|
+
# Remote Identity Verification Request class for KYC Non-Financial API services
|
10
|
+
class RemoteIdentity < Api::Requests::Base::NonFinancial::Kyc::Base
|
11
|
+
|
12
|
+
include Api::Mixins::Requests::NonFinancial::Kyc::DocumentAttributes
|
13
|
+
|
14
|
+
# Initializes the Remote Identity Verification Request
|
15
|
+
def initialize(configuration, _builder_interface = nil)
|
16
|
+
super configuration
|
17
|
+
|
18
|
+
self.request_path = 'verifications'
|
19
|
+
end
|
20
|
+
|
21
|
+
attr_accessor :reference_id, :country, :backside_proof_required
|
22
|
+
attr_reader :email
|
23
|
+
|
24
|
+
# Sets the email address for the Remote Identity verification
|
25
|
+
def email=(value)
|
26
|
+
raise InvalidArgumentError unless value =~ /\A.+@.+\..+\Z/
|
27
|
+
|
28
|
+
@email = value
|
29
|
+
end
|
30
|
+
|
31
|
+
# Gets the expiry date for the Remote Identity verification
|
32
|
+
def expiry_date
|
33
|
+
@expiry_date&.strftime(
|
34
|
+
Api::Constants::DateTimeFormats::YYYY_MM_DD_ISO_8601
|
35
|
+
)
|
36
|
+
end
|
37
|
+
|
38
|
+
# Sets the expiry date for the Remote Identity verification
|
39
|
+
def expiry_date=(value)
|
40
|
+
parse_date attribute: __method__, value: value, allow_empty: true
|
41
|
+
end
|
42
|
+
|
43
|
+
# Sets the document supported types for the Remote Identity verification
|
44
|
+
def document_supported_types=(value)
|
45
|
+
parse_array_of_strings attribute: __method__,
|
46
|
+
value: value,
|
47
|
+
allowed: Api::Constants::NonFinancial::Kyc::DocumentSupportedTypes.all
|
48
|
+
end
|
49
|
+
|
50
|
+
# Returns the document supported types for the Remote Identity verification
|
51
|
+
def document_supported_types
|
52
|
+
@document_supported_types || []
|
53
|
+
end
|
54
|
+
|
55
|
+
# Initializes field validations for the Remote Identity verification request
|
56
|
+
def init_field_validations
|
57
|
+
super
|
58
|
+
|
59
|
+
field_values.merge! country: GenesisRuby::Utils::Country::COUNTRIES.keys.map(&:upcase),
|
60
|
+
backside_proof_required: [true, false]
|
61
|
+
end
|
62
|
+
|
63
|
+
protected
|
64
|
+
|
65
|
+
# Performs validation checks for the Remote Identity verification request
|
66
|
+
def check_requirements
|
67
|
+
raise ParameterError, 'Either email or reference_id field has to be set.' if email.nil? && reference_id.nil? # rubocop:disable Layout/LineLength
|
68
|
+
|
69
|
+
super
|
70
|
+
end
|
71
|
+
|
72
|
+
# Returns request structure for the Remote Identity verification
|
73
|
+
def request_structure
|
74
|
+
{
|
75
|
+
email: email,
|
76
|
+
reference_id: reference_id,
|
77
|
+
country: country,
|
78
|
+
backside_proof_required: backside_proof_required,
|
79
|
+
expiry_date: expiry_date,
|
80
|
+
document_supported_types: document_supported_types,
|
81
|
+
document: document_attributes_structure
|
82
|
+
}
|
83
|
+
end
|
84
|
+
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
@@ -9,6 +9,8 @@ module GenesisRuby
|
|
9
9
|
include Api::Mixins::Requests::NonFinancial::Tokenization::TokenAttributes
|
10
10
|
include Api::Mixins::Requests::NonFinancial::Tokenization::TokenizationAttributes
|
11
11
|
|
12
|
+
attr_accessor :transaction_reference
|
13
|
+
|
12
14
|
def initialize(configuration, builder_interface = Builder::XML)
|
13
15
|
super configuration, builder_interface
|
14
16
|
|
@@ -21,7 +23,7 @@ module GenesisRuby
|
|
21
23
|
def init_field_validations
|
22
24
|
super
|
23
25
|
|
24
|
-
required_fields.push *tokenization_required_fields, *%i[token]
|
26
|
+
required_fields.push *tokenization_required_fields, *%i[token transaction_reference]
|
25
27
|
end
|
26
28
|
|
27
29
|
# API Request structure
|
@@ -29,7 +31,8 @@ module GenesisRuby
|
|
29
31
|
{
|
30
32
|
cryptogram_request: tokenization_attributes_structure.merge(
|
31
33
|
{
|
32
|
-
token:
|
34
|
+
token: token,
|
35
|
+
transaction_reference: transaction_reference
|
33
36
|
}
|
34
37
|
)
|
35
38
|
}
|
@@ -11,6 +11,7 @@ module GenesisRuby
|
|
11
11
|
class Create < Request # rubocop:disable Metrics/ClassLength
|
12
12
|
|
13
13
|
include Mixins::Requests::AddressInfoAttributes
|
14
|
+
include Mixins::Requests::DigitalAssetTypeAttributes
|
14
15
|
include Mixins::Requests::Financial::AsyncAttributes
|
15
16
|
include Mixins::Requests::Financial::Business::BusinessAttributes
|
16
17
|
include Mixins::Requests::Financial::Cards::AccountOwnerAttributes
|
@@ -171,7 +172,8 @@ module GenesisRuby
|
|
171
172
|
account_owner: account_owner_attributes_structure,
|
172
173
|
pay_later: pay_later,
|
173
174
|
reminders: pay_later ? reminders_structure : [],
|
174
|
-
funding: funding_attributes_structure
|
175
|
+
funding: funding_attributes_structure,
|
176
|
+
digital_asset_type: digital_asset_type
|
175
177
|
}
|
176
178
|
}
|
177
179
|
end
|
@@ -196,6 +196,10 @@ module GenesisRuby
|
|
196
196
|
api_service: {
|
197
197
|
GenesisRuby::Api::Constants::Environments::PRODUCTION => 'prod.api.',
|
198
198
|
GenesisRuby::Api::Constants::Environments::STAGING => 'staging.api.'
|
199
|
+
},
|
200
|
+
kyc_service: {
|
201
|
+
GenesisRuby::Api::Constants::Environments::PRODUCTION => 'prod.kyc.',
|
202
|
+
GenesisRuby::Api::Constants::Environments::STAGING => 'staging.kyc.'
|
199
203
|
}
|
200
204
|
}
|
201
205
|
end
|
@@ -25,6 +25,7 @@ require 'genesis_ruby/api/requests/base/consumer'
|
|
25
25
|
require 'genesis_ruby/api/requests/financial/sdd/sale'
|
26
26
|
require 'genesis_ruby/api/requests/base/graphql'
|
27
27
|
require 'genesis_ruby/api/notification'
|
28
|
+
require 'genesis_ruby/api/requests/base/non_financial/kyc/base'
|
28
29
|
|
29
30
|
# Load Financial and Non Financial API Requests
|
30
31
|
Dir["#{File.dirname(__FILE__)}/api/requests/*financial/**/*.rb"].sort.each { |file| require file }
|
@@ -0,0 +1,272 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Utils
|
3
|
+
# Country-related methods
|
4
|
+
class Country # rubocop:disable Metrics/ClassLength
|
5
|
+
|
6
|
+
COUNTRIES = {
|
7
|
+
'AF' => 'Afghanistan',
|
8
|
+
'AX' => 'Aland Islands',
|
9
|
+
'AL' => 'Albania',
|
10
|
+
'DZ' => 'Algeria',
|
11
|
+
'AS' => 'American Samoa',
|
12
|
+
'AD' => 'Andorra',
|
13
|
+
'AO' => 'Angola',
|
14
|
+
'AI' => 'Anguilla',
|
15
|
+
'AQ' => 'Antarctica',
|
16
|
+
'AG' => 'Antigua And Barbuda',
|
17
|
+
'AR' => 'Argentina',
|
18
|
+
'AM' => 'Armenia',
|
19
|
+
'AW' => 'Aruba',
|
20
|
+
'AU' => 'Australia',
|
21
|
+
'AT' => 'Austria',
|
22
|
+
'AZ' => 'Azerbaijan',
|
23
|
+
'BS' => 'Bahamas',
|
24
|
+
'BH' => 'Bahrain',
|
25
|
+
'BD' => 'Bangladesh',
|
26
|
+
'BB' => 'Barbados',
|
27
|
+
'BY' => 'Belarus',
|
28
|
+
'BE' => 'Belgium',
|
29
|
+
'BZ' => 'Belize',
|
30
|
+
'BJ' => 'Benin',
|
31
|
+
'BM' => 'Bermuda',
|
32
|
+
'BT' => 'Bhutan',
|
33
|
+
'BO' => 'Bolivia',
|
34
|
+
'BA' => 'Bosnia And Herzegovina',
|
35
|
+
'BW' => 'Botswana',
|
36
|
+
'BV' => 'Bouvet Island',
|
37
|
+
'BR' => 'Brazil',
|
38
|
+
'IO' => 'British Indian Ocean Territory',
|
39
|
+
'BN' => 'Brunei Darussalam',
|
40
|
+
'BG' => 'Bulgaria',
|
41
|
+
'BF' => 'Burkina Faso',
|
42
|
+
'BI' => 'Burundi',
|
43
|
+
'KH' => 'Cambodia',
|
44
|
+
'CM' => 'Cameroon',
|
45
|
+
'CA' => 'Canada',
|
46
|
+
'CV' => 'Cape Verde',
|
47
|
+
'KY' => 'Cayman Islands',
|
48
|
+
'CF' => 'Central African Republic',
|
49
|
+
'TD' => 'Chad',
|
50
|
+
'CL' => 'Chile',
|
51
|
+
'CN' => 'China',
|
52
|
+
'CX' => 'Christmas Island',
|
53
|
+
'CC' => 'Cocos (Keeling) Islands',
|
54
|
+
'CO' => 'Colombia',
|
55
|
+
'KM' => 'Comoros',
|
56
|
+
'CG' => 'Congo',
|
57
|
+
'CD' => 'Congo, Democratic Republic',
|
58
|
+
'CK' => 'Cook Islands',
|
59
|
+
'CR' => 'Costa Rica',
|
60
|
+
'CI' => "Cote D'Ivoire",
|
61
|
+
'HR' => 'Croatia',
|
62
|
+
'CU' => 'Cuba',
|
63
|
+
'CY' => 'Cyprus',
|
64
|
+
'CZ' => 'Czech Republic',
|
65
|
+
'DK' => 'Denmark',
|
66
|
+
'DJ' => 'Djibouti',
|
67
|
+
'DM' => 'Dominica',
|
68
|
+
'DO' => 'Dominican Republic',
|
69
|
+
'EC' => 'Ecuador',
|
70
|
+
'EG' => 'Egypt',
|
71
|
+
'SV' => 'El Salvador',
|
72
|
+
'GQ' => 'Equatorial Guinea',
|
73
|
+
'ER' => 'Eritrea',
|
74
|
+
'EE' => 'Estonia',
|
75
|
+
'ET' => 'Ethiopia',
|
76
|
+
'FK' => 'Falkland Islands (Malvinas)',
|
77
|
+
'FO' => 'Faroe Islands',
|
78
|
+
'FJ' => 'Fiji',
|
79
|
+
'FI' => 'Finland',
|
80
|
+
'FR' => 'France',
|
81
|
+
'GF' => 'French Guiana',
|
82
|
+
'PF' => 'French Polynesia',
|
83
|
+
'TF' => 'French Southern Territories',
|
84
|
+
'GA' => 'Gabon',
|
85
|
+
'GM' => 'Gambia',
|
86
|
+
'GE' => 'Georgia',
|
87
|
+
'DE' => 'Germany',
|
88
|
+
'GH' => 'Ghana',
|
89
|
+
'GI' => 'Gibraltar',
|
90
|
+
'GR' => 'Greece',
|
91
|
+
'GL' => 'Greenland',
|
92
|
+
'GD' => 'Grenada',
|
93
|
+
'GP' => 'Guadeloupe',
|
94
|
+
'GU' => 'Guam',
|
95
|
+
'GT' => 'Guatemala',
|
96
|
+
'GG' => 'Guernsey',
|
97
|
+
'GN' => 'Guinea',
|
98
|
+
'GW' => 'Guinea-Bissau',
|
99
|
+
'GY' => 'Guyana',
|
100
|
+
'HT' => 'Haiti',
|
101
|
+
'HM' => 'Heard Island & Mcdonald Islands',
|
102
|
+
'VA' => 'Holy See (Vatican City State)',
|
103
|
+
'HN' => 'Honduras',
|
104
|
+
'HK' => 'Hong Kong',
|
105
|
+
'HU' => 'Hungary',
|
106
|
+
'IS' => 'Iceland',
|
107
|
+
'IN' => 'India',
|
108
|
+
'ID' => 'Indonesia',
|
109
|
+
'IR' => 'Iran, Islamic Republic Of',
|
110
|
+
'IQ' => 'Iraq',
|
111
|
+
'IE' => 'Ireland',
|
112
|
+
'IM' => 'Isle Of Man',
|
113
|
+
'IL' => 'Israel',
|
114
|
+
'IT' => 'Italy',
|
115
|
+
'JM' => 'Jamaica',
|
116
|
+
'JP' => 'Japan',
|
117
|
+
'JE' => 'Jersey',
|
118
|
+
'JO' => 'Jordan',
|
119
|
+
'KZ' => 'Kazakhstan',
|
120
|
+
'KE' => 'Kenya',
|
121
|
+
'KI' => 'Kiribati',
|
122
|
+
'KR' => 'Korea',
|
123
|
+
'KW' => 'Kuwait',
|
124
|
+
'KG' => 'Kyrgyzstan',
|
125
|
+
'LA' => "Lao People's Democratic Republic",
|
126
|
+
'LV' => 'Latvia',
|
127
|
+
'LB' => 'Lebanon',
|
128
|
+
'LS' => 'Lesotho',
|
129
|
+
'LR' => 'Liberia',
|
130
|
+
'LY' => 'Libyan Arab Jamahiriya',
|
131
|
+
'LI' => 'Liechtenstein',
|
132
|
+
'LT' => 'Lithuania',
|
133
|
+
'LU' => 'Luxembourg',
|
134
|
+
'MO' => 'Macao',
|
135
|
+
'MK' => 'Macedonia',
|
136
|
+
'MG' => 'Madagascar',
|
137
|
+
'MW' => 'Malawi',
|
138
|
+
'MY' => 'Malaysia',
|
139
|
+
'MV' => 'Maldives',
|
140
|
+
'ML' => 'Mali',
|
141
|
+
'MT' => 'Malta',
|
142
|
+
'MH' => 'Marshall Islands',
|
143
|
+
'MQ' => 'Martinique',
|
144
|
+
'MR' => 'Mauritania',
|
145
|
+
'MU' => 'Mauritius',
|
146
|
+
'YT' => 'Mayotte',
|
147
|
+
'MX' => 'Mexico',
|
148
|
+
'FM' => 'Micronesia, Federated States Of',
|
149
|
+
'MD' => 'Moldova',
|
150
|
+
'MC' => 'Monaco',
|
151
|
+
'MN' => 'Mongolia',
|
152
|
+
'ME' => 'Montenegro',
|
153
|
+
'MS' => 'Montserrat',
|
154
|
+
'MA' => 'Morocco',
|
155
|
+
'MZ' => 'Mozambique',
|
156
|
+
'MM' => 'Myanmar',
|
157
|
+
'NA' => 'Namibia',
|
158
|
+
'NR' => 'Nauru',
|
159
|
+
'NP' => 'Nepal',
|
160
|
+
'NL' => 'Netherlands',
|
161
|
+
'AN' => 'Netherlands Antilles',
|
162
|
+
'NC' => 'New Caledonia',
|
163
|
+
'NZ' => 'New Zealand',
|
164
|
+
'NI' => 'Nicaragua',
|
165
|
+
'NE' => 'Niger',
|
166
|
+
'NG' => 'Nigeria',
|
167
|
+
'NU' => 'Niue',
|
168
|
+
'NF' => 'Norfolk Island',
|
169
|
+
'MP' => 'Northern Mariana Islands',
|
170
|
+
'NO' => 'Norway',
|
171
|
+
'OM' => 'Oman',
|
172
|
+
'PK' => 'Pakistan',
|
173
|
+
'PW' => 'Palau',
|
174
|
+
'PS' => 'Palestinian Territory, Occupied',
|
175
|
+
'PA' => 'Panama',
|
176
|
+
'PG' => 'Papua New Guinea',
|
177
|
+
'PY' => 'Paraguay',
|
178
|
+
'PE' => 'Peru',
|
179
|
+
'PH' => 'Philippines',
|
180
|
+
'PN' => 'Pitcairn',
|
181
|
+
'PL' => 'Poland',
|
182
|
+
'PT' => 'Portugal',
|
183
|
+
'PR' => 'Puerto Rico',
|
184
|
+
'QA' => 'Qatar',
|
185
|
+
'RE' => 'Reunion',
|
186
|
+
'RO' => 'Romania',
|
187
|
+
'RU' => 'Russian Federation',
|
188
|
+
'RW' => 'Rwanda',
|
189
|
+
'BL' => 'Saint Barthelemy',
|
190
|
+
'SH' => 'Saint Helena',
|
191
|
+
'KN' => 'Saint Kitts And Nevis',
|
192
|
+
'LC' => 'Saint Lucia',
|
193
|
+
'MF' => 'Saint Martin',
|
194
|
+
'PM' => 'Saint Pierre And Miquelon',
|
195
|
+
'VC' => 'Saint Vincent And Grenadines',
|
196
|
+
'WS' => 'Samoa',
|
197
|
+
'SM' => 'San Marino',
|
198
|
+
'ST' => 'Sao Tome And Principe',
|
199
|
+
'SA' => 'Saudi Arabia',
|
200
|
+
'SN' => 'Senegal',
|
201
|
+
'RS' => 'Serbia',
|
202
|
+
'SC' => 'Seychelles',
|
203
|
+
'SL' => 'Sierra Leone',
|
204
|
+
'SG' => 'Singapore',
|
205
|
+
'SK' => 'Slovakia',
|
206
|
+
'SI' => 'Slovenia',
|
207
|
+
'SB' => 'Solomon Islands',
|
208
|
+
'SO' => 'Somalia',
|
209
|
+
'ZA' => 'South Africa',
|
210
|
+
'GS' => 'South Georgia And Sandwich Isl.',
|
211
|
+
'ES' => 'Spain',
|
212
|
+
'LK' => 'Sri Lanka',
|
213
|
+
'SD' => 'Sudan',
|
214
|
+
'SR' => 'Suriname',
|
215
|
+
'SJ' => 'Svalbard And Jan Mayen',
|
216
|
+
'SZ' => 'Swaziland',
|
217
|
+
'SE' => 'Sweden',
|
218
|
+
'CH' => 'Switzerland',
|
219
|
+
'SY' => 'Syrian Arab Republic',
|
220
|
+
'TW' => 'Taiwan',
|
221
|
+
'TJ' => 'Tajikistan',
|
222
|
+
'TZ' => 'Tanzania',
|
223
|
+
'TH' => 'Thailand',
|
224
|
+
'TL' => 'Timor-Leste',
|
225
|
+
'TG' => 'Togo',
|
226
|
+
'TK' => 'Tokelau',
|
227
|
+
'TO' => 'Tonga',
|
228
|
+
'TT' => 'Trinidad And Tobago',
|
229
|
+
'TN' => 'Tunisia',
|
230
|
+
'TR' => 'Turkey',
|
231
|
+
'TM' => 'Turkmenistan',
|
232
|
+
'TC' => 'Turks And Caicos Islands',
|
233
|
+
'TV' => 'Tuvalu',
|
234
|
+
'UG' => 'Uganda',
|
235
|
+
'UA' => 'Ukraine',
|
236
|
+
'AE' => 'United Arab Emirates',
|
237
|
+
'GB' => 'United Kingdom',
|
238
|
+
'US' => 'United States',
|
239
|
+
'UM' => 'United States Outlying Islands',
|
240
|
+
'UY' => 'Uruguay',
|
241
|
+
'UZ' => 'Uzbekistan',
|
242
|
+
'VU' => 'Vanuatu',
|
243
|
+
'VE' => 'Venezuela',
|
244
|
+
'VN' => 'Viet Nam',
|
245
|
+
'VG' => 'Virgin Islands, British',
|
246
|
+
'VI' => 'Virgin Islands, U.S.',
|
247
|
+
'WF' => 'Wallis And Futuna',
|
248
|
+
'EH' => 'Western Sahara',
|
249
|
+
'YE' => 'Yemen',
|
250
|
+
'ZM' => 'Zambia',
|
251
|
+
'ZW' => 'Zimbabwe'
|
252
|
+
}.freeze
|
253
|
+
|
254
|
+
# Retrieves a country's name by its ISO code.
|
255
|
+
def country_name(iso_code)
|
256
|
+
COUNTRIES.fetch(iso_code, false)
|
257
|
+
end
|
258
|
+
|
259
|
+
# Retrieves a country's ISO code by its name.
|
260
|
+
def country_iso(country_name)
|
261
|
+
country_pair = COUNTRIES.find { |_iso, name| name.downcase == country_name.downcase }
|
262
|
+
country_pair&.first
|
263
|
+
end
|
264
|
+
|
265
|
+
# Returns a list of all supported country ISO codes.
|
266
|
+
def list
|
267
|
+
COUNTRIES.keys
|
268
|
+
end
|
269
|
+
|
270
|
+
end
|
271
|
+
end
|
272
|
+
end
|
data/lib/genesis_ruby/version.rb
CHANGED