Class: Centaman::Service::AddOn

Inherits:
Centaman::Service show all
Includes:
JsonWrapper
Defined in:
lib/centaman/service/add_on.rb

Constant Summary

Constants inherited from Wrapper

Wrapper::DEFAULT_TIMEOUT_TIME

Instance Attribute Summary collapse

Attributes inherited from Wrapper

#api_password, #api_token, #api_url, #api_username, #proxie_host, #proxie_password, #proxie_port, #proxie_user

Class Method Summary collapse

Instance Method Summary collapse

Methods included from JsonWrapper

#build_object, #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, #options_hash, #payload, #payload_key, #proxy_hash, #wrap_request_in_case_of_timeout

Constructor Details

This class inherits a constructor from Centaman::Wrapper

Instance Attribute Details

#membership_type_idObject (readonly)

Returns the value of attribute membership_type_id.



5
6
7
# File 'lib/centaman/service/add_on.rb', line 5

def membership_type_id
  @membership_type_id
end

Class Method Details

.find(membership_type_id, id) ⇒ Object



19
20
21
22
# File 'lib/centaman/service/add_on.rb', line 19

def self.find(membership_type_id, id)
  obj = new(membership_type_id: membership_type_id)
  obj.objects.detect { |obj| obj.id == id }
end

Instance Method Details

#additional_hash_to_serialize_after_responseObject



24
25
26
# File 'lib/centaman/service/add_on.rb', line 24

def additional_hash_to_serialize_after_response
  { membership_type_id: membership_type_id }
end

#after_init(args) ⇒ Object



7
8
9
# File 'lib/centaman/service/add_on.rb', line 7

def after_init(args)
  @membership_type_id = args.fetch(:membership_type_id, nil).try(:to_i)
end

#endpointObject



11
12
13
# File 'lib/centaman/service/add_on.rb', line 11

def endpoint
  "/member_services/MembershipType?PackageID=#{membership_type_id}"
end

#object_classObject



15
16
17
# File 'lib/centaman/service/add_on.rb', line 15

def object_class
  Centaman::Object::AddOn
end