Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/processout.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
require "processout/product"
require "processout/project"
require "processout/project_sftp_settings"
require "processout/project_sftp_settings_public"
require "processout/refund"
require "processout/subscription"
require "processout/transaction"
Expand Down Expand Up @@ -270,6 +271,11 @@ def project_sftp_settings(data = {})
obj = ProjectSFTPSettings.new(self, data)
end

# Create a new ProjectSFTPSettingsPublic instance
def project_sftp_settings_public(data = {})
obj = ProjectSFTPSettingsPublic.new(self, data)
end

# Create a new Refund instance
def refund(data = {})
obj = Refund.new(self, data)
Expand Down
21 changes: 18 additions & 3 deletions lib/processout/card_create_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,23 @@ def create(options = {})
request = Request.new(@client)
path = "/cards"
data = {

"device" => @device,
"name" => @name,
"number" => @number,
"exp_day" => @exp_day,
"exp_month" => @exp_month,
"exp_year" => @exp_year,
"cvc2" => @cvc2,
"preferred_scheme" => @preferred_scheme,
"metadata" => @metadata,
"token_type" => @token_type,
"eci" => @eci,
"cryptogram" => @cryptogram,
"applepay_response" => @applepay_response,
"applepay_mid" => @applepay_mid,
"payment_token" => @payment_token,
"contact" => @contact,
"shipping" => @shipping
}

response = Response.new(request.post(path, data, options))
Expand All @@ -296,8 +312,7 @@ def create(options = {})
body = body["card"]


obj = CardCreateRequest.new(@client)
return_values.push(obj.fill_with_data(body))
return_values.push(self.fill_with_data(body))



Expand Down
7 changes: 4 additions & 3 deletions lib/processout/card_update_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ def update(card_id, options = {})
request = Request.new(@client)
path = "/cards/" + CGI.escape(card_id) + ""
data = {

"update_type" => @update_type,
"update_reason" => @update_reason,
"preferred_scheme" => @preferred_scheme
}

response = Response.new(request.put(path, data, options))
Expand All @@ -107,8 +109,7 @@ def update(card_id, options = {})
body = body["card"]


obj = CardUpdateRequest.new(@client)
return_values.push(obj.fill_with_data(body))
return_values.push(self.fill_with_data(body))



Expand Down
2 changes: 1 addition & 1 deletion lib/processout/networking/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def apply_headers(req, options)
req.basic_auth @client.project_id, @client.project_secret
req.content_type = "application/json"
req["API-Version"] = "1.4.0.0"
req["User-Agent"] = "ProcessOut Ruby-Bindings/2.29.0"
req["User-Agent"] = "ProcessOut Ruby-Bindings/2.30.0"

unless options.nil?
req["Idempotency-Key"] = options.fetch(:idempotency_key, "")
Expand Down
120 changes: 120 additions & 0 deletions lib/processout/project_sftp_settings_public.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
# The content of this file was automatically generated

require "cgi"
require "json"
require "processout/networking/request"
require "processout/networking/response"

module ProcessOut
class ProjectSFTPSettingsPublic

attr_reader :enabled
attr_reader :endpoint
attr_reader :username


def enabled=(val)
@enabled = val
end

def endpoint=(val)
@endpoint = val
end

def username=(val)
@username = val
end


# Initializes the ProjectSFTPSettingsPublic object
# Params:
# +client+:: +ProcessOut+ client instance
# +data+:: data that can be used to fill the object
def initialize(client, data = {})
@client = client

self.enabled = data.fetch(:enabled, nil)
self.endpoint = data.fetch(:endpoint, nil)
self.username = data.fetch(:username, nil)

end

# Create a new ProjectSFTPSettingsPublic using the current client
def new(data = {})
ProjectSFTPSettingsPublic.new(@client, data)
end

# Overrides the JSON marshaller to only send the fields we want
def to_json(options)
{
"enabled": self.enabled,
"endpoint": self.endpoint,
"username": self.username,
}.to_json
end

# Fills the object with data coming from the API
# Params:
# +data+:: +Hash+ of data coming from the API
def fill_with_data(data)
if data.nil?
return self
end
if data.include? "enabled"
self.enabled = data["enabled"]
end
if data.include? "endpoint"
self.endpoint = data["endpoint"]
end
if data.include? "username"
self.username = data["username"]
end

self
end

# Prefills the object with the data passed as parameters
# Params:
# +data+:: +Hash+ of data
def prefill(data)
if data.nil?
return self
end
self.enabled = data.fetch(:enabled, self.enabled)
self.endpoint = data.fetch(:endpoint, self.endpoint)
self.username = data.fetch(:username, self.username)

self
end

# Fetch the SFTP settings for the project.
# Params:
# +id+:: ID of the project
# +options+:: +Hash+ of options
def fetch_sftp_settings(id, options = {})
self.prefill(options)

request = Request.new(@client)
path = "/projects/" + CGI.escape(id) + "/sftp-settings"
data = {

}

response = Response.new(request.get(path, data, options))
return_values = Array.new

body = response.body
body = body["sftp_settings"]


obj = ProjectSFTPSettingsPublic.new(@client)
return_values.push(obj.fill_with_data(body))



return_values[0]
end


end
end
2 changes: 1 addition & 1 deletion lib/processout/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module ProcessOut
VERSION = "2.29.0"
VERSION = "2.30.0"
end