Class: Centaman::Service::CostRate

Inherits:
Centaman::Service show all
Includes:
JsonWrapper
Defined in:
lib/centaman/service/cost_rate.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

Instance Method Summary collapse

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

#emailObject (readonly)

Returns the value of attribute email.



4
5
6
# File 'lib/centaman/service/cost_rate.rb', line 4

def email
  @email
end

#first_nameObject (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_nameObject (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

#endpointObject



16
17
18
# File 'lib/centaman/service/cost_rate.rb', line 16

def endpoint
  '/ticket_services/TimedTicket'
end

#object_classObject



12
13
14
# File 'lib/centaman/service/cost_rate.rb', line 12

def object_class
  Centaman::Object::CostRate
end

#optionsObject



20
21
22
23
24
25
26
# File 'lib/centaman/service/cost_rate.rb', line 20

def options
  super + [
    { key: 'FirstName', value: first_name },
    { key: 'LastName', value: last_name },
    { key: 'Email', value: email }
  ]
end