Class: Centaman::Service::CreateCustomer

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

Overview

:nodoc:

Constant Summary

Constants inherited from Centaman::Service

DEFAULT_TIMEOUT_TIME

Constants inherited from Wrapper

Wrapper::FIXIE

Instance Attribute Summary collapse

Attributes inherited from Wrapper

#api_password, #api_token, #api_username

Instance Method Summary collapse

Methods included from JsonWrapper

#additional_hash_to_serialize_after_response, #build_object, #build_objects, #objects

Methods inherited from Centaman::Service

#after_post, #fetch_all, #payload, #payload_key, #post, #wrap_request_in_case_of_timeout

Methods inherited from Wrapper

#generate_token, #headers, #initialize, #options

Constructor Details

This class inherits a constructor from Centaman::Wrapper

Instance Attribute Details

#emailObject (readonly)

Returns the value of attribute email.



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

def email
  @email
end

#first_nameObject (readonly)

Returns the value of attribute first_name.



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

def first_name
  @first_name
end

#last_nameObject (readonly)

Returns the value of attribute last_name.



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

def last_name
  @last_name
end

#phoneObject (readonly)

Returns the value of attribute phone.



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

def phone
  @phone
end

Instance Method Details

#addressObject

rubocop:disable Metrics/MethodLength



23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/centaman/service/create_customer.rb', line 23

def address
  {
    'Street1' => '',
    'Street2' => '',
    'City' => '',
    'State' => '',
    'Postalcode' => '',
    'Country' => '',
    'HomePhone' => phone,
    'WorkPhone' => '',
    'MobilePhone' => ''
  }
end

#after_init(args) ⇒ Object



7
8
9
10
11
12
# File 'lib/centaman/service/create_customer.rb', line 7

def after_init(args)
  @first_name = args[:first_name]
  @last_name = args[:last_name]
  @email = args[:email]
  @phone = args[:phone]
end

#endpointObject



14
15
16
# File 'lib/centaman/service/create_customer.rb', line 14

def endpoint
  '/ticket_services/TimedTicket'
end

#object_classObject



18
19
20
# File 'lib/centaman/service/create_customer.rb', line 18

def object_class
  Centaman::Object::Customer
end

#options_hashObject

rubocop:disable Metrics/MethodLength



39
40
41
42
43
44
45
46
# File 'lib/centaman/service/create_customer.rb', line 39

def options_hash
  {
    'FirstName' => first_name,
    'LastName' => last_name,
    'Email' => email,
    'Address' => address
  }.to_json
end