lpt-ruby 0.4.1

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.
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Lpt
4
+ module Resources
5
+ class Verification < ApiResource
6
+ extend Lpt::ApiOperations::Retrieve
7
+ extend Lpt::ApiOperations::Create
8
+ extend Lpt::ApiOperations::Update
9
+
10
+ attr_accessor :verification_id, :reference_id, :subject, :profile,
11
+ :instrument, :merchant, :merchant_account, :category, :type,
12
+ :url, :result, :verified
13
+
14
+ def id_prefix
15
+ Lpt::PREFIX_VERIFICATION
16
+ end
17
+
18
+ protected
19
+
20
+ def assign_object_name
21
+ @object_name = "verification"
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Lpt
4
+ VERSION = "0.4.1"
5
+ end
data/lib/lpt.rb ADDED
@@ -0,0 +1,145 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "active_support/all"
4
+ require "delegate"
5
+ require "faraday"
6
+ require "logger"
7
+
8
+ require_relative "lpt/authentication"
9
+ require_relative "lpt/version"
10
+ require_relative "lpt/environment"
11
+ require_relative "lpt/lpt_client"
12
+
13
+ require_relative "lpt/api_operations/create"
14
+ require_relative "lpt/api_operations/retrieve"
15
+ require_relative "lpt/api_operations/update"
16
+
17
+ require_relative "lpt/resources/api_resource"
18
+ require_relative "lpt/resources/instrument"
19
+ require_relative "lpt/resources/payment"
20
+ require_relative "lpt/resources/profile"
21
+
22
+ require_relative "lpt/requests/api_request"
23
+ require_relative "lpt/requests/empty_request"
24
+ require_relative "lpt/requests/instrument_request"
25
+ require_relative "lpt/requests/instrument_token_request"
26
+ require_relative "lpt/requests/payment_request"
27
+ require_relative "lpt/requests/profile_request"
28
+
29
+ module Lpt
30
+ class Error < StandardError; end
31
+
32
+ DEFAULT_CA_BUNDLE_PATH = "#{__dir__}/data/ca-certificates.crt"
33
+
34
+ LEVEL_DEBUG = Logger::DEBUG
35
+ LEVEL_ERROR = Logger::ERROR
36
+ LEVEL_INFO = Logger::INFO
37
+ LEVEL_TEST = -1
38
+
39
+ PREFIX_ENTITY = "LEN"
40
+ PREFIX_MERCHANT = "LMR"
41
+ PREFIX_MERCHANT_ACCOUNT = "LMA"
42
+ PREFIX_PROFILE = "LID"
43
+ PREFIX_INSTRUMENT = "LPI"
44
+ PREFIX_TOKEN = "LTK"
45
+ PREFIX_PAYMENT = "LPY"
46
+ PREFIX_VERIFICATION = "LPV"
47
+
48
+ class << self
49
+ include Lpt::Authentication
50
+
51
+ attr_writer :open_timeout, :read_timeout, :write_timeout,
52
+ :max_network_retries, :initial_network_retry_delay,
53
+ :max_network_retry_delay, :verify_ssl_certs, :ca_bundle_path,
54
+ :log_level
55
+
56
+ delegate :api_base_url, to: :env
57
+
58
+ def environment=(environment)
59
+ standard_env = standardize_environment(environment)
60
+ assert_environment_is_valid! standard_env
61
+ @environment = standard_env
62
+ end
63
+
64
+ def environment
65
+ @environment || Lpt::Environment::DEV
66
+ end
67
+
68
+ def api_version
69
+ "v2"
70
+ end
71
+
72
+ def base_addresses(environment: nil)
73
+ case environment
74
+ when Lpt::Environment::PRODUCTION
75
+ { api_base: "api-s2", cx_base: "cx", cx_api_base: "api.cx" }
76
+ when Lpt::Environment::STAGING
77
+ { api_base: "staging-api-s2", cx_base: "cx.stg",
78
+ cx_api_base: "api.cx.stg" }
79
+ else
80
+ { api_base: "api", cx_base: "cx", cx_api_base: "api.cx" }
81
+ end
82
+ end
83
+
84
+ def token_path(entity: nil)
85
+ Lpt::Resources::Instrument.token_path(entity: entity)
86
+ end
87
+
88
+ def open_timeout
89
+ @open_timeout || 30
90
+ end
91
+
92
+ def read_timeout
93
+ @read_timeout || 80
94
+ end
95
+
96
+ def write_timeout
97
+ @write_timeout || 30
98
+ end
99
+
100
+ def max_network_retries
101
+ @max_network_retries || 2
102
+ end
103
+
104
+ def initial_network_retry_delay
105
+ @initial_network_retry_delay || 0.5
106
+ end
107
+
108
+ def max_network_retry_delay
109
+ @max_network_retry_delay || 5
110
+ end
111
+
112
+ def verify_ssl_certs
113
+ @verify_ssl_certs || true
114
+ end
115
+
116
+ def ca_bundle_path
117
+ @ca_bundle_path || DEFAULT_CA_BUNDLE_PATH
118
+ end
119
+
120
+ def log_level
121
+ @log_level || LEVEL_DEBUG
122
+ end
123
+
124
+ protected
125
+
126
+ def assert_environment_is_valid!(env)
127
+ msg = "Invalid Environment: #{env}"
128
+ raise ArgumentError, msg unless envs.include?(env)
129
+ end
130
+
131
+ def standardize_environment(env)
132
+ return env if env.is_a? Integer
133
+
134
+ Lpt::Environment::ENVIRONMENTS[env]
135
+ end
136
+
137
+ def envs
138
+ Lpt::Environment::ENVIRONMENTS.values
139
+ end
140
+
141
+ def env
142
+ @env ||= Lpt::Environment.factory(environment: environment)
143
+ end
144
+ end
145
+ end
data/lpt-ruby.gemspec ADDED
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/lpt/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "lpt-ruby"
7
+ spec.version = Lpt::VERSION
8
+ spec.authors = ["LPT"]
9
+ spec.email = ["support@lpt.io"]
10
+
11
+ spec.summary = "LPT Ruby API Client"
12
+ spec.description = "LPT Ruby API Client"
13
+ spec.homepage = "https://lpt.io"
14
+ spec.license = "MIT"
15
+ spec.required_ruby_version = ">= 2.6.0"
16
+
17
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
18
+
19
+ spec.metadata["homepage_uri"] = spec.homepage
20
+ spec.metadata["source_code_uri"] = "https://github.com/lacore-payment-tech/lpt-ruby"
21
+ spec.metadata["changelog_uri"] = "https://github.com/lacore-payment-tech/lpt-ruby"
22
+ spec.metadata["rubygems_mfa_required"] = "true"
23
+
24
+ # Specify which files should be added to the gem when it is released.
25
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
26
+ spec.files = Dir.chdir(__dir__) do
27
+ `git ls-files -z`.split("\x0").reject do |f|
28
+ (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
29
+ end
30
+ end
31
+ spec.bindir = "exe"
32
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
33
+ spec.require_paths = ["lib"]
34
+
35
+ spec.add_dependency "activesupport", ">= 7.0"
36
+ spec.add_dependency "faraday", ">= 2.13.1"
37
+
38
+ # For more information and examples about making a new gem, check out our
39
+ # guide at: https://bundler.io/guides/creating_gem.html
40
+ end
data/sig/lpt.rbs ADDED
@@ -0,0 +1,4 @@
1
+ module Lpt
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,109 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lpt-ruby
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.4.1
5
+ platform: ruby
6
+ authors:
7
+ - LPT
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2025-07-29 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activesupport
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '7.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '7.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: faraday
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 2.13.1
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 2.13.1
41
+ description: LPT Ruby API Client
42
+ email:
43
+ - support@lpt.io
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".rubocop.yml"
49
+ - CHANGELOG.md
50
+ - CODE_OF_CONDUCT.md
51
+ - Gemfile
52
+ - LICENSE.txt
53
+ - README.md
54
+ - Rakefile
55
+ - lib/data/ca-certificates.crt
56
+ - lib/lpt.rb
57
+ - lib/lpt/api_operations/create.rb
58
+ - lib/lpt/api_operations/retrieve.rb
59
+ - lib/lpt/api_operations/update.rb
60
+ - lib/lpt/authentication.rb
61
+ - lib/lpt/environment.rb
62
+ - lib/lpt/lpt_client.rb
63
+ - lib/lpt/requests/api_request.rb
64
+ - lib/lpt/requests/empty_request.rb
65
+ - lib/lpt/requests/instrument_request.rb
66
+ - lib/lpt/requests/instrument_token_request.rb
67
+ - lib/lpt/requests/payment_capture_request.rb
68
+ - lib/lpt/requests/payment_refund_request.rb
69
+ - lib/lpt/requests/payment_request.rb
70
+ - lib/lpt/requests/payment_reversal_request.rb
71
+ - lib/lpt/requests/profile_request.rb
72
+ - lib/lpt/requests/verification_request.rb
73
+ - lib/lpt/resources/api_resource.rb
74
+ - lib/lpt/resources/instrument.rb
75
+ - lib/lpt/resources/payment.rb
76
+ - lib/lpt/resources/profile.rb
77
+ - lib/lpt/resources/verification.rb
78
+ - lib/lpt/version.rb
79
+ - lpt-ruby.gemspec
80
+ - sig/lpt.rbs
81
+ homepage: https://lpt.io
82
+ licenses:
83
+ - MIT
84
+ metadata:
85
+ allowed_push_host: https://rubygems.org
86
+ homepage_uri: https://lpt.io
87
+ source_code_uri: https://github.com/lacore-payment-tech/lpt-ruby
88
+ changelog_uri: https://github.com/lacore-payment-tech/lpt-ruby
89
+ rubygems_mfa_required: 'true'
90
+ post_install_message:
91
+ rdoc_options: []
92
+ require_paths:
93
+ - lib
94
+ required_ruby_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: 2.6.0
99
+ required_rubygems_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ requirements: []
105
+ rubygems_version: 3.3.26
106
+ signing_key:
107
+ specification_version: 4
108
+ summary: LPT Ruby API Client
109
+ test_files: []