Skip to content

Commit

Permalink
Fix Style/StringLiterals violation.
Browse files Browse the repository at this point in the history
  • Loading branch information
ppostma committed Jun 5, 2023
1 parent 8b9715c commit d2abb39
Show file tree
Hide file tree
Showing 38 changed files with 280 additions and 283 deletions.
3 changes: 0 additions & 3 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,3 @@ RSpec/MultipleExpectations:

Style/SafeNavigation:
Enabled: false

Style/StringLiterals:
Enabled: false
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

source "https://rubygems.org"
source 'https://rubygems.org'

git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }

Expand Down
6 changes: 3 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# frozen_string_literal: true

require "bundler/gem_tasks"
require "rspec/core/rake_task"
require "rubocop/rake_task"
require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
require 'rubocop/rake_task'

RSpec::Core::RakeTask.new(:spec)
RuboCop::RakeTask.new(:rubocop)
Expand Down
6 changes: 3 additions & 3 deletions bin/console
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require "bundler/setup"
require "tikkie/api"
require 'bundler/setup'
require 'tikkie/api'

# You can add fixtures and/or initialization code here to make experimenting
# with your gem easier. You can also use a different console, if you like.
Expand All @@ -11,5 +11,5 @@ require "tikkie/api"
# require "pry"
# Pry.start

require "irb"
require 'irb'
IRB.start(__FILE__)
110 changes: 55 additions & 55 deletions lib/tikkie/api.rb
Original file line number Diff line number Diff line change
@@ -1,59 +1,59 @@
# frozen_string_literal: true

require "tikkie/api/version"

require "tikkie/api/amount"
require "tikkie/api/client"
require "tikkie/api/configuration"
require "tikkie/api/exception"
require "tikkie/api/request"
require "tikkie/api/response"

require "tikkie/api/clients/base"
require "tikkie/api/clients/payment_requests"
require "tikkie/api/clients/payment_requests_subscription"
require "tikkie/api/clients/payments"
require "tikkie/api/clients/refunds"
require "tikkie/api/clients/sandbox_apps"

require "tikkie/api/resources/base"
require "tikkie/api/resources/error"
require "tikkie/api/resources/list"
require "tikkie/api/resources/payment_request"
require "tikkie/api/resources/payment_requests"
require "tikkie/api/resources/payment_requests_subscription"
require "tikkie/api/resources/payment"
require "tikkie/api/resources/payments"
require "tikkie/api/resources/refund"
require "tikkie/api/resources/sandbox_app"
require 'tikkie/api/version'

require 'tikkie/api/amount'
require 'tikkie/api/client'
require 'tikkie/api/configuration'
require 'tikkie/api/exception'
require 'tikkie/api/request'
require 'tikkie/api/response'

require 'tikkie/api/clients/base'
require 'tikkie/api/clients/payment_requests'
require 'tikkie/api/clients/payment_requests_subscription'
require 'tikkie/api/clients/payments'
require 'tikkie/api/clients/refunds'
require 'tikkie/api/clients/sandbox_apps'

require 'tikkie/api/resources/base'
require 'tikkie/api/resources/error'
require 'tikkie/api/resources/list'
require 'tikkie/api/resources/payment_request'
require 'tikkie/api/resources/payment_requests'
require 'tikkie/api/resources/payment_requests_subscription'
require 'tikkie/api/resources/payment'
require 'tikkie/api/resources/payments'
require 'tikkie/api/resources/refund'
require 'tikkie/api/resources/sandbox_app'

# Below the deprecated Tikkie v1 API code which will be removed after 01-01-2021.
require "tikkie/api/v1/access_token"
require "tikkie/api/v1/authentication"
require "tikkie/api/v1/client"
require "tikkie/api/v1/configuration"
require "tikkie/api/v1/exception"
require "tikkie/api/v1/request"

require "tikkie/api/v1/requests/payment_requests"
require "tikkie/api/v1/requests/platforms"
require "tikkie/api/v1/requests/users"

require "tikkie/api/v1/responses/base"
require "tikkie/api/v1/responses/bank_account"
require "tikkie/api/v1/responses/error"
require "tikkie/api/v1/responses/pagination"
require "tikkie/api/v1/responses/payment_request_created"
require "tikkie/api/v1/responses/payment_request"
require "tikkie/api/v1/responses/payment_requests"
require "tikkie/api/v1/responses/payment"
require "tikkie/api/v1/responses/platform"
require "tikkie/api/v1/responses/platforms"
require "tikkie/api/v1/responses/user"
require "tikkie/api/v1/responses/users"

require "tikkie/api/v1/types/payment_request_status"
require "tikkie/api/v1/types/payment_status"
require "tikkie/api/v1/types/platform_status"
require "tikkie/api/v1/types/platform_usage"
require "tikkie/api/v1/types/user_status"
require 'tikkie/api/v1/access_token'
require 'tikkie/api/v1/authentication'
require 'tikkie/api/v1/client'
require 'tikkie/api/v1/configuration'
require 'tikkie/api/v1/exception'
require 'tikkie/api/v1/request'

require 'tikkie/api/v1/requests/payment_requests'
require 'tikkie/api/v1/requests/platforms'
require 'tikkie/api/v1/requests/users'

require 'tikkie/api/v1/responses/base'
require 'tikkie/api/v1/responses/bank_account'
require 'tikkie/api/v1/responses/error'
require 'tikkie/api/v1/responses/pagination'
require 'tikkie/api/v1/responses/payment_request_created'
require 'tikkie/api/v1/responses/payment_request'
require 'tikkie/api/v1/responses/payment_requests'
require 'tikkie/api/v1/responses/payment'
require 'tikkie/api/v1/responses/platform'
require 'tikkie/api/v1/responses/platforms'
require 'tikkie/api/v1/responses/user'
require 'tikkie/api/v1/responses/users'

require 'tikkie/api/v1/types/payment_request_status'
require 'tikkie/api/v1/types/payment_status'
require 'tikkie/api/v1/types/platform_status'
require 'tikkie/api/v1/types/platform_usage'
require 'tikkie/api/v1/types/user_status'
2 changes: 1 addition & 1 deletion lib/tikkie/api/amount.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def to_d

# Convert the amount to a String with 2 decimals.
def to_s
format("%.2f", @amount)
format('%.2f', @amount)
end

def to_cents
Expand Down
4 changes: 2 additions & 2 deletions lib/tikkie/api/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ module Tikkie
module Api
# Tikkie API configuration.
class Configuration
SANDBOX_API_URL = "https://api-sandbox.abnamro.com/v2/tikkie/"
PRODUCTION_API_URL = "https://api.abnamro.com/v2/tikkie/"
SANDBOX_API_URL = 'https://api-sandbox.abnamro.com/v2/tikkie/'
PRODUCTION_API_URL = 'https://api.abnamro.com/v2/tikkie/'

attr_reader :api_key, :app_token, :sandbox

Expand Down
14 changes: 7 additions & 7 deletions lib/tikkie/api/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ def request(http_method, path, params = {}, body = {})
raise Tikkie::Api::Exception, "Invalid HTTP method: #{http_method}"
end

request["Accept"] = "application/json"
request["Content-Type"] = "application/json"
request["Api-Key"] = config.api_key
request["X-App-Token"] = config.app_token if config.app_token
request["User-Agent"] = "Ruby tikkie-api/#{Tikkie::Api::VERSION}"
request['Accept'] = 'application/json'
request['Content-Type'] = 'application/json'
request['Api-Key'] = config.api_key
request['X-App-Token'] = config.app_token if config.app_token
request['User-Agent'] = "Ruby tikkie-api/#{Tikkie::Api::VERSION}"

client = Net::HTTP.new(uri.hostname, uri.port)
client.use_ssl = uri.scheme == "https"
client.use_ssl = uri.scheme == 'https'
client.verify_mode = OpenSSL::SSL::VERIFY_PEER

begin
Expand All @@ -67,7 +67,7 @@ def request(http_method, path, params = {}, body = {})

logger.debug("[Tikkie] Response: #{response.http_code}, body: #{response.body}") if ENV['TIKKIE_DEBUG']

raise Tikkie::Api::Exception, "Invalid payload" if response.invalid?
raise Tikkie::Api::Exception, 'Invalid payload' if response.invalid?
raise Tikkie::Api::RequestError, response if response.error?

response
Expand Down
14 changes: 7 additions & 7 deletions lib/tikkie/api/resources/payment_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ module Api
module Resources
# Resource for a Payment Request.
class PaymentRequest < Base
STATUS_OPEN = "OPEN"
STATUS_CLOSED = "CLOSED"
STATUS_EXPIRED = "EXPIRED"
STATUS_MAX_YIELDED_REACHED = "MAX_YIELD_REACHED"
STATUS_MAX_SUCCESSFUL_PAYMENTS_REACHED = "MAX_SUCCESSFUL_PAYMENTS_REACHED"
STATUS_OPEN = 'OPEN'
STATUS_CLOSED = 'CLOSED'
STATUS_EXPIRED = 'EXPIRED'
STATUS_MAX_YIELDED_REACHED = 'MAX_YIELD_REACHED'
STATUS_MAX_SUCCESSFUL_PAYMENTS_REACHED = 'MAX_SUCCESSFUL_PAYMENTS_REACHED'

def initialize(config, options = {})
@payment_request_token = options.delete(:payment_request_token)
Expand Down Expand Up @@ -86,10 +86,10 @@ def create_resource(attributes)
amount = Tikkie::Api::Amount.new(attributes[:amount])
params[:amountInCents] = amount.to_cents
end
params[:expiryDate] = attributes[:expiry_date].respond_to?(:strftime) ? attributes[:expiry_date].strftime("%F") : attributes[:expiry_date] if attributes.key?(:expiry_date)
params[:expiryDate] = attributes[:expiry_date].respond_to?(:strftime) ? attributes[:expiry_date].strftime('%F') : attributes[:expiry_date] if attributes.key?(:expiry_date)
params[:referenceId] = attributes[:reference_id] if attributes.key?(:reference_id)

request.post("paymentrequests", options, params)
request.post('paymentrequests', options, params)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/tikkie/api/resources/payment_requests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def load_resource
params[:fromDate] = options[:from_date].respond_to?(:utc) ? options[:from_date].utc.iso8601 : options[:from_date] if options.key?(:from_date)
params[:toDate] = options[:to_date].respond_to?(:utc) ? options[:to_date].utc.iso8601 : options[:to_date] if options.key?(:to_date)

request.get("paymentrequests", params)
request.get('paymentrequests', params)
end

def payment_requests
Expand Down
4 changes: 2 additions & 2 deletions lib/tikkie/api/resources/payment_requests_subscription.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ def subscription_id
private

def create_resource(attributes)
request.post("paymentrequestssubscription", options, attributes)
request.post('paymentrequestssubscription', options, attributes)
end

def delete_resource
request.delete("paymentrequestssubscription", options)
request.delete('paymentrequestssubscription', options)
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/tikkie/api/resources/refund.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ module Api
module Resources
# Resource for a Refund.
class Refund < Base
STATUS_PENDING = "PENDING"
STATUS_PAID = "PAID"
STATUS_PENDING = 'PENDING'
STATUS_PAID = 'PAID'

attr_reader :payment_request_token, :payment_token

Expand Down
2 changes: 1 addition & 1 deletion lib/tikkie/api/resources/sandbox_app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def app_token
private

def create_resource(attributes)
request.post("sandboxapps", options, attributes)
request.post('sandboxapps', options, attributes)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/tikkie/api/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

module Tikkie
module Api
VERSION = "2.0.0"
VERSION = '2.0.0'
end
end
6 changes: 3 additions & 3 deletions lib/tikkie/notification.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# frozen_string_literal: true

require "tikkie/notifications/bundle_notification"
require "tikkie/notifications/payment_notification"
require "tikkie/notifications/refund_notification"
require 'tikkie/notifications/bundle_notification'
require 'tikkie/notifications/payment_notification'
require 'tikkie/notifications/refund_notification'

module Tikkie
# Parses the payload for a Notification.
Expand Down
2 changes: 1 addition & 1 deletion lib/tikkie/notifications/bundle_notification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Tikkie
module Notifications
# Bundle notification.
class BundleNotification
NOTIFICATION_TYPE = "BUNDLE"
NOTIFICATION_TYPE = 'BUNDLE'

attr_reader :body

Expand Down
2 changes: 1 addition & 1 deletion lib/tikkie/notifications/payment_notification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Tikkie
module Notifications
# Payment notification.
class PaymentNotification
NOTIFICATION_TYPE = "PAYMENT"
NOTIFICATION_TYPE = 'PAYMENT'

attr_reader :body

Expand Down
2 changes: 1 addition & 1 deletion lib/tikkie/notifications/refund_notification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Tikkie
module Notifications
# Refund notification.
class RefundNotification
NOTIFICATION_TYPE = "REFUND"
NOTIFICATION_TYPE = 'REFUND'

attr_reader :body

Expand Down
12 changes: 6 additions & 6 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# frozen_string_literal: true

require "bundler/setup"
require "tikkie/api"
require "tikkie/notification"
require "webmock/rspec"
require "timecop"
require 'bundler/setup'
require 'tikkie/api'
require 'tikkie/notification'
require 'webmock/rspec'
require 'timecop'

RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
config.example_status_persistence_file_path = ".rspec_status"
config.example_status_persistence_file_path = '.rspec_status'

# Disable RSpec exposing methods globally on `Module` and `main`
config.disable_monkey_patching!
Expand Down
Loading

0 comments on commit d2abb39

Please sign in to comment.