Class: Centaman::Service::CreatePrimaryMember
- Inherits:
-
Centaman::Service
- Object
- Wrapper
- Centaman::Service
- Centaman::Service::CreatePrimaryMember
- Includes:
- JsonWrapper
- Defined in:
- lib/centaman/service/create_primary_member.rb
Constant Summary
Constants inherited from Wrapper
Instance Attribute Summary collapse
-
#email ⇒ Object
readonly
Returns the value of attribute email.
-
#first_name ⇒ Object
readonly
Returns the value of attribute first_name.
-
#last_name ⇒ Object
readonly
Returns the value of attribute last_name.
-
#password ⇒ Object
readonly
Returns the value of attribute password.
Attributes inherited from Wrapper
#api_password, #api_token, #api_url, #api_username, #proxie_host, #proxie_password, #proxie_port, #proxie_user
Instance Method Summary collapse
- #after_init(args) ⇒ Object
- #build_object(resp) ⇒ Object
- #endpoint ⇒ Object
- #object_class ⇒ Object
- #options_hash ⇒ Object
Methods included from JsonWrapper
#additional_hash_to_serialize_after_response, #build_objects, #final_object_class, #objects
Methods inherited from Centaman::Service
#after_post, #fetch_all, #post, #put
Methods inherited from Wrapper
#generate_token, #headers, #initialize, #options, #payload, #payload_key, #proxy_hash, #wrap_request_in_case_of_timeout
Constructor Details
This class inherits a constructor from Centaman::Wrapper
Instance Attribute Details
#email ⇒ Object (readonly)
Returns the value of attribute email.
7 8 9 |
# File 'lib/centaman/service/create_primary_member.rb', line 7 def email @email end |
#first_name ⇒ Object (readonly)
Returns the value of attribute first_name.
7 8 9 |
# File 'lib/centaman/service/create_primary_member.rb', line 7 def first_name @first_name end |
#last_name ⇒ Object (readonly)
Returns the value of attribute last_name.
7 8 9 |
# File 'lib/centaman/service/create_primary_member.rb', line 7 def last_name @last_name end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
7 8 9 |
# File 'lib/centaman/service/create_primary_member.rb', line 7 def password @password end |
Instance Method Details
#after_init(args) ⇒ Object
9 10 11 12 13 14 |
# File 'lib/centaman/service/create_primary_member.rb', line 9 def after_init(args) @first_name = args[:first_name].try(:squish) @last_name = args[:last_name].try(:squish) @email = args[:email].try(:squish) @password = args[:password] || SecureRandom.hex end |
#build_object(resp) ⇒ Object
24 25 26 27 28 |
# File 'lib/centaman/service/create_primary_member.rb', line 24 def build_object(resp) return build_objects(resp) if resp.respond_to?(:map) return create_error(resp) unless resp.respond_to?(:merge) @build_object ||= object_class.new(resp.merge(additional_hash_to_serialize_after_response)) end |
#endpoint ⇒ Object
16 17 18 |
# File 'lib/centaman/service/create_primary_member.rb', line 16 def endpoint '/member_services/Member' end |
#object_class ⇒ Object
20 21 22 |
# File 'lib/centaman/service/create_primary_member.rb', line 20 def object_class Centaman::Object::Member end |
#options_hash ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/centaman/service/create_primary_member.rb', line 30 def [ { 'FirstName' => first_name.try(:upcase), 'LastName' => last_name.try(:upcase), 'Email' => email.try(:upcase), 'Password' => password, 'IsPrimary' => true } ].to_json end |