Class: CardConnect::Service::ProfilePutRequest
- Inherits:
-
Object
- Object
- CardConnect::Service::ProfilePutRequest
- Includes:
- Utils
- Defined in:
- lib/cardconnect/services/profile/profile_put_request.rb
Constant Summary collapse
- REQUIRED_FIELDS =
[:merchid, :account]
- OPTIONAL_FIELDS =
[:profile, :defaultacct, :profileupdate, :accttype, :profileid, :bankaba, :expiry, :name, :address, :city, :region, :country, :phone, :postal, :ssnl4, :email, :license]
- FIELDS =
REQUIRED_FIELDS + OPTIONAL_FIELDS
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
Instance Method Summary collapse
-
#initialize(attrs = {}) ⇒ Object
constructor
Initializes a new Profile Request.
-
#payload ⇒ Object
Builds the request payload.
-
#valid? ⇒ Boolean
Indicates that the request is valid once it is built.
Methods included from Utils
#set_attributes, #symbolize_keys
Constructor Details
#initialize(attrs = {}) ⇒ Object
Initializes a new Profile Request
21 22 23 24 25 |
# File 'lib/cardconnect/services/profile/profile_put_request.rb', line 21 def initialize(attrs = {}) @errors = [] set_attributes(attrs, FIELDS) validate_required_fields end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
15 16 17 |
# File 'lib/cardconnect/services/profile/profile_put_request.rb', line 15 def errors @errors end |
Instance Method Details
#payload ⇒ Object
Builds the request payload
33 34 35 36 37 38 39 |
# File 'lib/cardconnect/services/profile/profile_put_request.rb', line 33 def payload payload = {} FIELDS.each do |field| payload.merge!({field => send(field)}) end payload end |
#valid? ⇒ Boolean
Indicates that the request is valid once it is built.
28 29 30 |
# File 'lib/cardconnect/services/profile/profile_put_request.rb', line 28 def valid? errors.empty? end |