Class: CardConnect::Service::ProfileGetRequest

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Methods included from Utils

#set_attributes, #symbolize_keys

Constructor Details

#initialize(attrs = {}) ⇒ Object

Initializes a new ProfileGetRequest

Parameters:

  • attrs (Hash) (defaults to: {})


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

#errorsObject (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

#payloadObject

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.

Returns:

  • (Boolean)


30
31
32
# File 'lib/cardconnect/services/profile/profile_get_request.rb', line 30

def valid?
  errors.empty?
end