Class: CardConnect::Service::ProfileGetRequest
- Inherits:
-
Object
- Object
- CardConnect::Service::ProfileGetRequest
- Includes:
- Utils
- Defined in:
- lib/cardconnect/services/profile/profile_get_request.rb
Constant Summary collapse
- REQUIRED_FIELDS =
Making acctid required here even though this conflicts with information in the CardConnect docs because I can’t get a successful response from their API unless I pass an acctid. Please let me know if you know how to fix this.
[:profileid, :acctid, :merchid]
- OPTIONAL_FIELDS =
[]
- 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 ProfileGetRequest.
-
#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 ProfileGetRequest
23 24 25 26 27 |
# File 'lib/cardconnect/services/profile/profile_get_request.rb', line 23 def initialize(attrs = {}) @errors = [] set_attributes(attrs, FIELDS) validate_required_fields end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
17 18 19 |
# File 'lib/cardconnect/services/profile/profile_get_request.rb', line 17 def errors @errors end |
Instance Method Details
#payload ⇒ Object
Builds the request payload
35 36 37 |
# File 'lib/cardconnect/services/profile/profile_get_request.rb', line 35 def payload "/#{profileid}/#{acctid}/#{merchid}" end |
#valid? ⇒ Boolean
Indicates that the request is valid once it is built.
30 31 32 |
# File 'lib/cardconnect/services/profile/profile_get_request.rb', line 30 def valid? errors.empty? end |