Class: Centaman::Service::CreateSecondaryMembers
- Inherits:
-
Centaman::Service
- Object
- Wrapper
- Centaman::Service
- Centaman::Service::CreateSecondaryMembers
- Includes:
- JsonWrapper
- Defined in:
- lib/centaman/service/create_secondary_members.rb
Constant Summary
Constants inherited from Wrapper
Instance Attribute Summary collapse
-
#primary_member_id ⇒ Object
readonly
Returns the value of attribute primary_member_id.
-
#secondary_members ⇒ Object
readonly
Returns the value of attribute secondary_members.
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
#primary_member_id ⇒ Object (readonly)
Returns the value of attribute primary_member_id.
7 8 9 |
# File 'lib/centaman/service/create_secondary_members.rb', line 7 def primary_member_id @primary_member_id end |
#secondary_members ⇒ Object (readonly)
Returns the value of attribute secondary_members.
7 8 9 |
# File 'lib/centaman/service/create_secondary_members.rb', line 7 def secondary_members @secondary_members end |
Instance Method Details
#after_init(args) ⇒ Object
9 10 11 12 |
# File 'lib/centaman/service/create_secondary_members.rb', line 9 def after_init(args) @primary_member_id = args.fetch(:primary_member_id, nil) @secondary_members = args.fetch(:secondary_members, []) end |
#build_object(resp) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/centaman/service/create_secondary_members.rb', line 22 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
14 15 16 |
# File 'lib/centaman/service/create_secondary_members.rb', line 14 def endpoint '/member_services/Member' end |
#object_class ⇒ Object
18 19 20 |
# File 'lib/centaman/service/create_secondary_members.rb', line 18 def object_class Centaman::Object::Member end |
#options_hash ⇒ Object
29 30 31 32 |
# File 'lib/centaman/service/create_secondary_members.rb', line 29 def request_body = secondary_members.map { |m| build_member(m) } request_body.to_json end |