Class: CreditDevice::Inquiry

Inherits:
Object
  • Object
show all
Defined in:
lib/credit_device/inquery.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_idObject (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

#languageObject (readonly)

Returns the value of attribute language.



5
6
7
# File 'lib/credit_device/inquery.rb', line 5

def language
  @language
end

#product_typeObject (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

#pathObject



18
19
20
# File 'lib/credit_device/inquery.rb', line 18

def path
  "inquiries"
end

#request_inquiryObject



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