Class: Centaman::Service::CostRate
- Inherits:
-
Centaman::Service
- Object
- Wrapper
- Centaman::Service
- Centaman::Service::CostRate
- Includes:
- JsonWrapper
- Defined in:
- lib/centaman/service/cost_rate.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.
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_objects(resp) ⇒ Object
- #endpoint ⇒ Object
- #object_class ⇒ Object
- #options ⇒ Object
Methods included from JsonWrapper
#additional_hash_to_serialize_after_response, #build_object, #final_object_class, #objects
Methods inherited from Centaman::Service
#after_post, #fetch_all, #post, #put
Methods inherited from Wrapper
#generate_token, #headers, #initialize, #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
#email ⇒ Object (readonly)
Returns the value of attribute email.
4 5 6 |
# File 'lib/centaman/service/cost_rate.rb', line 4 def email @email end |
#first_name ⇒ Object (readonly)
Returns the value of attribute first_name.
4 5 6 |
# File 'lib/centaman/service/cost_rate.rb', line 4 def first_name @first_name end |
#last_name ⇒ Object (readonly)
Returns the value of attribute last_name.
4 5 6 |
# File 'lib/centaman/service/cost_rate.rb', line 4 def last_name @last_name end |
Instance Method Details
#after_init(args = {}) ⇒ Object
6 7 8 9 10 |
# File 'lib/centaman/service/cost_rate.rb', line 6 def after_init(args = {}) @first_name = args.fetch(:first_name, nil) @last_name = args.fetch(:last_name, nil) @email = args.fetch(:email, nil) end |
#build_objects(resp) ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/centaman/service/cost_rate.rb', line 28 def build_objects(resp) return [] unless resp.respond_to?(:map) return build_object(resp) if resp.respond_to?(:merge) @tickets = resp.map do |ticket_hash| object_class.new(ticket_hash.merge(additional_hash_to_serialize_after_response)) end end |
#endpoint ⇒ Object
16 17 18 |
# File 'lib/centaman/service/cost_rate.rb', line 16 def endpoint '/ticket_services/TimedTicket' end |
#object_class ⇒ Object
12 13 14 |
# File 'lib/centaman/service/cost_rate.rb', line 12 def object_class Centaman::Object::CostRate end |
#options ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/centaman/service/cost_rate.rb', line 20 def super + [ { key: 'FirstName', value: first_name }, { key: 'LastName', value: last_name }, { key: 'Email', value: email } ] end |