Class: CreditDevice::Inquiry
- Inherits:
-
Object
- Object
- CreditDevice::Inquiry
- Defined in:
- lib/credit_device/inquery.rb
Instance Attribute Summary collapse
-
#company_id ⇒ Object
readonly
Returns the value of attribute company_id.
-
#language ⇒ Object
readonly
Returns the value of attribute language.
-
#product_type ⇒ Object
readonly
Returns the value of attribute product_type.
Instance Method Summary collapse
-
#initialize(product_type = CreditDevice::Type::ProductType::D44CI701, company_id = nil, language = "NL", **_parameter) ⇒ Inquiry
constructor
A new instance of Inquiry.
- #path ⇒ Object
- #request_inquiry ⇒ Object
- #set_type(type) ⇒ Object
Constructor Details
#initialize(product_type = CreditDevice::Type::ProductType::D44CI701, company_id = nil, language = "NL", **_parameter) ⇒ Inquiry
Returns a new instance of Inquiry.
7 8 9 10 11 |
# File 'lib/credit_device/inquery.rb', line 7 def initialize(product_type = CreditDevice::Type::ProductType::D44CI701, company_id = nil, language = "NL", **_parameter) @product_type = set_type(product_type) @company_id = company_id @language = language end |
Instance Attribute Details
#company_id ⇒ Object (readonly)
Returns the value of attribute company_id.
5 6 7 |
# File 'lib/credit_device/inquery.rb', line 5 def company_id @company_id end |
#language ⇒ Object (readonly)
Returns the value of attribute language.
5 6 7 |
# File 'lib/credit_device/inquery.rb', line 5 def language @language end |
#product_type ⇒ Object (readonly)
Returns the value of attribute product_type.
5 6 7 |
# File 'lib/credit_device/inquery.rb', line 5 def product_type @product_type end |
Instance Method Details
#path ⇒ Object
18 19 20 |
# File 'lib/credit_device/inquery.rb', line 18 def path "inquiries" end |
#request_inquiry ⇒ Object
13 14 15 16 |
# File 'lib/credit_device/inquery.rb', line 13 def request_inquiry params = { company_id: @company_id, product: @product_type, language: @language }.to_json CreditDevice::Client.new(:post, path, params).request end |
#set_type(type) ⇒ Object
22 23 24 25 |
# File 'lib/credit_device/inquery.rb', line 22 def set_type(type) raise "type invalid, parameters are: #{CreditDevice::Type::ProductType::TYPES.join(',')}" unless CreditDevice::Type::ProductType::TYPES.include? type type end |