Class: Microbilt::Requests::CreateForm
- Inherits:
-
Object
- Object
- Microbilt::Requests::CreateForm
- Includes:
- Helpers
- Defined in:
- lib/microbilt/requests/create_form.rb
Instance Attribute Summary collapse
-
#callback_type ⇒ Object
readonly
Returns the value of attribute callback_type.
-
#callback_url ⇒ Object
Returns the value of attribute callback_url.
-
#contact_by ⇒ Object
readonly
Returns the value of attribute contact_by.
-
#do_not_request_phones ⇒ Object
readonly
Returns the value of attribute do_not_request_phones.
-
#final_url ⇒ Object
Returns the value of attribute final_url.
Instance Method Summary collapse
- #call(customer) ⇒ Object
-
#initialize(options = nil) ⇒ CreateForm
constructor
A new instance of CreateForm.
- #to_params ⇒ Object
Methods included from Helpers
Constructor Details
#initialize(options = nil) ⇒ CreateForm
Returns a new instance of CreateForm.
9 10 11 12 13 14 15 |
# File 'lib/microbilt/requests/create_form.rb', line 9 def initialize( = nil) .keys.each do |k| self.send("#{k}=", [k]) end if do_not_request_phones = false if do_not_request_phones.nil? end |
Instance Attribute Details
#callback_type ⇒ Object
Returns the value of attribute callback_type.
7 8 9 |
# File 'lib/microbilt/requests/create_form.rb', line 7 def callback_type @callback_type end |
#callback_url ⇒ Object
Returns the value of attribute callback_url.
6 7 8 |
# File 'lib/microbilt/requests/create_form.rb', line 6 def callback_url @callback_url end |
#contact_by ⇒ Object
Returns the value of attribute contact_by.
7 8 9 |
# File 'lib/microbilt/requests/create_form.rb', line 7 def contact_by @contact_by end |
#do_not_request_phones ⇒ Object
Returns the value of attribute do_not_request_phones.
7 8 9 |
# File 'lib/microbilt/requests/create_form.rb', line 7 def do_not_request_phones @do_not_request_phones end |
#final_url ⇒ Object
Returns the value of attribute final_url.
6 7 8 |
# File 'lib/microbilt/requests/create_form.rb', line 6 def final_url @final_url end |
Instance Method Details
#call(customer) ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/microbilt/requests/create_form.rb', line 27 def call(customer) response = http_connection.post do |req| req.url Microbilt::Configuration::CREATE_FORM_URI req.headers['Content-Type'] = Microbilt::Configuration::CONTENT_TYPE req.params = all_params(customer) end handle_response(response) end |
#to_params ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/microbilt/requests/create_form.rb', line 17 def to_params { 'CallbackUrl' => callback_url, 'CallbackType' => callback_type.to_s, 'FinalURL' => final_url, 'ContactBy' => contact_by.to_s.upcase, 'DoNotRequestPhones' => do_not_request_phones.to_s } end |