Class: ShieldPay::Company
- Inherits:
-
Object
- Object
- ShieldPay::Company
- Extended by:
- Helpers
- Defined in:
- lib/shieldpay/company.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
Returns the value of attribute address.
-
#country_code ⇒ Object
Returns the value of attribute country_code.
-
#created_on ⇒ Object
Returns the value of attribute created_on.
-
#customer_key ⇒ Object
Returns the value of attribute customer_key.
-
#email ⇒ Object
Returns the value of attribute email.
-
#identifier ⇒ Object
Returns the value of attribute identifier.
-
#kyc_status ⇒ Object
Returns the value of attribute kyc_status.
-
#locality ⇒ Object
Returns the value of attribute locality.
-
#name ⇒ Object
Returns the value of attribute name.
-
#phone ⇒ Object
Returns the value of attribute phone.
-
#post_code ⇒ Object
Returns the value of attribute post_code.
Class Method Summary collapse
-
.create(params = {}) ⇒ Object
Contact Params Parameter Optional? Description country_code no The country code for this organization (i.e. GB) Defaults to ShieldPay.configuration.country_code email no Email address for contact person identifier no Company number for your region (i.e. Companies House Number) phone no Contact phone number for company.
Instance Method Summary collapse
-
#initialize(attrs) ⇒ Company
constructor
A new instance of Company.
- #kyc_verified? ⇒ Boolean
Methods included from Helpers
stringify_keys, stringify_keys!
Constructor Details
#initialize(attrs) ⇒ Company
Returns a new instance of Company.
36 37 38 39 40 41 42 43 |
# File 'lib/shieldpay/company.rb', line 36 def initialize(attrs) @address = attrs["Address"] @created_on = Time.parse(attrs["CreatedOn"]) @email = attrs["Email"] @locality = attrs["Locality"] @name = attrs["CompanyName"] @post_code = attrs["PostalCode"] end |
Instance Attribute Details
#address ⇒ Object
Returns the value of attribute address.
5 6 7 |
# File 'lib/shieldpay/company.rb', line 5 def address @address end |
#country_code ⇒ Object
Returns the value of attribute country_code.
5 6 7 |
# File 'lib/shieldpay/company.rb', line 5 def country_code @country_code end |
#created_on ⇒ Object
Returns the value of attribute created_on.
5 6 7 |
# File 'lib/shieldpay/company.rb', line 5 def created_on @created_on end |
#customer_key ⇒ Object
Returns the value of attribute customer_key.
5 6 7 |
# File 'lib/shieldpay/company.rb', line 5 def customer_key @customer_key end |
#email ⇒ Object
Returns the value of attribute email.
5 6 7 |
# File 'lib/shieldpay/company.rb', line 5 def email @email end |
#identifier ⇒ Object
Returns the value of attribute identifier.
5 6 7 |
# File 'lib/shieldpay/company.rb', line 5 def identifier @identifier end |
#kyc_status ⇒ Object
Returns the value of attribute kyc_status.
5 6 7 |
# File 'lib/shieldpay/company.rb', line 5 def kyc_status @kyc_status end |
#locality ⇒ Object
Returns the value of attribute locality.
5 6 7 |
# File 'lib/shieldpay/company.rb', line 5 def locality @locality end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/shieldpay/company.rb', line 5 def name @name end |
#phone ⇒ Object
Returns the value of attribute phone.
5 6 7 |
# File 'lib/shieldpay/company.rb', line 5 def phone @phone end |
#post_code ⇒ Object
Returns the value of attribute post_code.
5 6 7 |
# File 'lib/shieldpay/company.rb', line 5 def post_code @post_code end |
Class Method Details
.create(params = {}) ⇒ Object
Contact Params Parameter Optional? Description country_code no The country code for this organization (i.e. GB) Defaults to ShieldPay.configuration.country_code email no Email address for contact person identifier no Company number for your region (i.e. Companies House Number) phone no Contact phone number for company
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/shieldpay/company.rb', line 16 def self.create(params={}) stringify_keys!(params) params["country_code"] ||= ShieldPay.configuration.country_code response = Request.new.post("/Customer/CreateCompany", params) customer_key = response.dig("Data", "CustomerKey") kyc_status = nil if customer_key.is_a?(Hash) kyc_status = customer_key["KYCStatus"] customer_key = customer_key["CustomerKey"] end new(response["Data"]["Data"]).tap do |c| c.country_code = params["country_code"] c.customer_key = customer_key c.identifier = params["identifier"] c.kyc_status = kyc_status c.phone = params["phone"] end end |
Instance Method Details
#kyc_verified? ⇒ Boolean
45 46 47 |
# File 'lib/shieldpay/company.rb', line 45 def kyc_verified? @kyc_status end |