Class: ProcessOut::AlternativeMerchantCertificate
- Inherits:
-
Object
- Object
- ProcessOut::AlternativeMerchantCertificate
- Defined in:
- lib/processout/alternative_merchant_certificate.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
Instance Method Summary collapse
-
#delete(options = {}) ⇒ Object
- Delete a given alternative merchant certificate Params:
options -
Hashof options.
- Delete a given alternative merchant certificate Params:
-
#fill_with_data(data) ⇒ Object
- Fills the object with data coming from the API Params:
data -
Hashof data coming from the API.
- Fills the object with data coming from the API Params:
-
#initialize(client, data = {}) ⇒ AlternativeMerchantCertificate
constructor
- Initializes the AlternativeMerchantCertificate object Params:
client ProcessOutclient instancedata-
data that can be used to fill the object.
- Initializes the AlternativeMerchantCertificate object Params:
-
#new(data = {}) ⇒ Object
Create a new AlternativeMerchantCertificate using the current client.
-
#prefill(data) ⇒ Object
- Prefills the object with the data passed as parameters Params:
data -
Hashof data.
- Prefills the object with the data passed as parameters Params:
-
#save(options = {}) ⇒ Object
- Save new alternative apple pay certificates Params:
options -
Hashof options.
- Save new alternative apple pay certificates Params:
-
#to_json(options) ⇒ Object
Overrides the JSON marshaller to only send the fields we want.
Constructor Details
#initialize(client, data = {}) ⇒ AlternativeMerchantCertificate
Initializes the AlternativeMerchantCertificate object Params:
client-
ProcessOutclient instance data-
data that can be used to fill the object
23 24 25 26 27 28 |
# File 'lib/processout/alternative_merchant_certificate.rb', line 23 def initialize(client, data = {}) @client = client self.id = data.fetch(:id, nil) end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
11 12 13 |
# File 'lib/processout/alternative_merchant_certificate.rb', line 11 def id @id end |
Instance Method Details
#delete(options = {}) ⇒ Object
Delete a given alternative merchant certificate Params:
options-
Hashof options
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/processout/alternative_merchant_certificate.rb', line 95 def delete( = {}) self.prefill() request = Request.new(@client) path = "/projects/applepay/alternative-merchant-certificates/" + CGI.escape(@id) + "" data = { } response = Response.new(request.delete(path, data, )) return_values = Array.new return_values.push(response.success) return_values[0] end |
#fill_with_data(data) ⇒ Object
Fills the object with data coming from the API Params:
data-
Hashof data coming from the API
45 46 47 48 49 50 51 52 53 54 |
# File 'lib/processout/alternative_merchant_certificate.rb', line 45 def fill_with_data(data) if data.nil? return self end if data.include? "id" self.id = data["id"] end self end |
#new(data = {}) ⇒ Object
Create a new AlternativeMerchantCertificate using the current client
31 32 33 |
# File 'lib/processout/alternative_merchant_certificate.rb', line 31 def new(data = {}) AlternativeMerchantCertificate.new(@client, data) end |
#prefill(data) ⇒ Object
Prefills the object with the data passed as parameters Params:
data-
Hashof data
59 60 61 62 63 64 65 66 |
# File 'lib/processout/alternative_merchant_certificate.rb', line 59 def prefill(data) if data.nil? return self end self.id = data.fetch(:id, self.id) self end |
#save(options = {}) ⇒ Object
Save new alternative apple pay certificates Params:
options-
Hashof options
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/processout/alternative_merchant_certificate.rb', line 71 def save( = {}) self.prefill() request = Request.new(@client) path = "/projects/applepay/alternative-merchant-certificates" data = { } response = Response.new(request.post(path, data, )) return_values = Array.new body = response.body body = body["alternative_merchant_certificate"] alternative_merchant_certificate = AlternativeMerchantCertificate.new(@client) return_values.push(alternative_merchant_certificate.fill_with_data(body)) return_values[0] end |
#to_json(options) ⇒ Object
Overrides the JSON marshaller to only send the fields we want
36 37 38 39 40 |
# File 'lib/processout/alternative_merchant_certificate.rb', line 36 def to_json() { "id": self.id, }.to_json end |