Class: ProcessOut::ApplePayAlternativeMerchantCertificates
- Inherits:
-
Object
- Object
- ProcessOut::ApplePayAlternativeMerchantCertificates
- Defined in:
- lib/processout/apple_pay_alternative_merchant_certificates.rb
Instance Attribute Summary collapse
-
#alternative_merchant_certificates ⇒ Object
Returns the value of attribute alternative_merchant_certificates.
-
#count ⇒ Object
Returns the value of attribute count.
Instance Method Summary collapse
-
#fetch(options = {}) ⇒ Object
- Fetch the project’s alternative certificates by ID Params:
options
-
Hash
of options.
- Fetch the project’s alternative certificates by ID Params:
-
#fill_with_data(data) ⇒ Object
- Fills the object with data coming from the API Params:
data
-
Hash
of data coming from the API.
- Fills the object with data coming from the API Params:
-
#initialize(client, data = {}) ⇒ ApplePayAlternativeMerchantCertificates
constructor
- Initializes the ApplePayAlternativeMerchantCertificates object Params:
client
ProcessOut
client instancedata
-
data that can be used to fill the object.
- Initializes the ApplePayAlternativeMerchantCertificates object Params:
-
#new(data = {}) ⇒ Object
Create a new ApplePayAlternativeMerchantCertificates using the current client.
-
#prefill(data) ⇒ Object
- Prefills the object with the data passed as parameters Params:
data
-
Hash
of data.
- Prefills the object with the data passed as parameters Params:
-
#to_json(options) ⇒ Object
Overrides the JSON marshaller to only send the fields we want.
Constructor Details
#initialize(client, data = {}) ⇒ ApplePayAlternativeMerchantCertificates
Initializes the ApplePayAlternativeMerchantCertificates object Params:
client
-
ProcessOut
client instance data
-
data that can be used to fill the object
44 45 46 47 48 49 50 |
# File 'lib/processout/apple_pay_alternative_merchant_certificates.rb', line 44 def initialize(client, data = {}) @client = client self.count = data.fetch(:count, nil) self.alternative_merchant_certificates = data.fetch(:alternative_merchant_certificates, nil) end |
Instance Attribute Details
#alternative_merchant_certificates ⇒ Object
Returns the value of attribute alternative_merchant_certificates.
12 13 14 |
# File 'lib/processout/apple_pay_alternative_merchant_certificates.rb', line 12 def alternative_merchant_certificates @alternative_merchant_certificates end |
#count ⇒ Object
Returns the value of attribute count.
11 12 13 |
# File 'lib/processout/apple_pay_alternative_merchant_certificates.rb', line 11 def count @count end |
Instance Method Details
#fetch(options = {}) ⇒ Object
Fetch the project’s alternative certificates by ID Params:
options
-
Hash
of options
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/processout/apple_pay_alternative_merchant_certificates.rb', line 98 def fetch( = {}) self.prefill() request = Request.new(@client) path = "/projects/applepay/alternative-merchant-certificates" data = { } response = Response.new(request.get(path, data, )) return_values = Array.new body = response.body body = body["applepay_certificates"] apple_pay_alternative_merchant_certificates = ApplePayAlternativeMerchantCertificates.new(@client) return_values.push(apple_pay_alternative_merchant_certificates.fill_with_data(body)) return_values[0] end |
#fill_with_data(data) ⇒ Object
Fills the object with data coming from the API Params:
data
-
Hash
of data coming from the API
68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/processout/apple_pay_alternative_merchant_certificates.rb', line 68 def fill_with_data(data) if data.nil? return self end if data.include? "count" self.count = data["count"] end if data.include? "alternative_merchant_certificates" self.alternative_merchant_certificates = data["alternative_merchant_certificates"] end self end |
#new(data = {}) ⇒ Object
Create a new ApplePayAlternativeMerchantCertificates using the current client
53 54 55 |
# File 'lib/processout/apple_pay_alternative_merchant_certificates.rb', line 53 def new(data = {}) ApplePayAlternativeMerchantCertificates.new(@client, data) end |
#prefill(data) ⇒ Object
Prefills the object with the data passed as parameters Params:
data
-
Hash
of data
85 86 87 88 89 90 91 92 93 |
# File 'lib/processout/apple_pay_alternative_merchant_certificates.rb', line 85 def prefill(data) if data.nil? return self end self.count = data.fetch(:count, self.count) self.alternative_merchant_certificates = data.fetch(:alternative_merchant_certificates, self.alternative_merchant_certificates) self end |
#to_json(options) ⇒ Object
Overrides the JSON marshaller to only send the fields we want
58 59 60 61 62 63 |
# File 'lib/processout/apple_pay_alternative_merchant_certificates.rb', line 58 def to_json() { "count": self.count, "alternative_merchant_certificates": self.alternative_merchant_certificates, }.to_json end |