Class: AchClient::AchWorks::CompanyInfo

Inherits:
AchClient::Abstract::CompanyInfo show all
Defined in:
lib/ach_client/providers/soap/ach_works/company_info.rb

Overview

This is the ACHworks “credentials” for your company

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(company_key:, company:, loc_i_d:, s_s_s:) ⇒ CompanyInfo

Since all these fields are generated by them, and don’t change, it really seems like they could use just one.

Parameters:

  • s_s_s (String)

    Arbitrary 3 letter code they give your company

  • loc_i_d (String)

    Another Arbitrary 4 letter code they give you…

  • company (String)

    Your user id string, used as a username

  • company_key (String)

    A key that they give you used as a password



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/ach_client/providers/soap/ach_works/company_info.rb', line 18

def initialize(
  company_key:,
  company:,
  loc_i_d:,
  s_s_s:
)
  @company = company
  @company_key = company_key
  @loc_i_d = loc_i_d
  @s_s_s = s_s_s
end

Instance Attribute Details

#companyObject (readonly)

Returns the value of attribute company.



6
7
8
# File 'lib/ach_client/providers/soap/ach_works/company_info.rb', line 6

def company
  @company
end

#company_keyObject (readonly)

Returns the value of attribute company_key.



6
7
8
# File 'lib/ach_client/providers/soap/ach_works/company_info.rb', line 6

def company_key
  @company_key
end

#loc_i_dObject (readonly)

Returns the value of attribute loc_i_d.



6
7
8
# File 'lib/ach_client/providers/soap/ach_works/company_info.rb', line 6

def loc_i_d
  @loc_i_d
end

#s_s_sObject (readonly)

Returns the value of attribute s_s_s.



6
7
8
# File 'lib/ach_client/providers/soap/ach_works/company_info.rb', line 6

def s_s_s
  @s_s_s
end

Class Method Details

.buildCompanyInfo

Returns instance built from configuration values.

Returns:

  • (CompanyInfo)

    instance built from configuration values



32
33
34
35
36
37
38
39
# File 'lib/ach_client/providers/soap/ach_works/company_info.rb', line 32

def self.build
  build_from_config([
    :company_key,
    :company,
    :loc_i_d,
    :s_s_s
  ])
end

Instance Method Details

#company_valid?Boolean

Returns:

  • (Boolean)

    whether or not the request was successful



51
52
53
# File 'lib/ach_client/providers/soap/ach_works/company_info.rb', line 51

def company_valid?
  connection_check_request(method: :check_company_status)
end

#connection_valid?Boolean

Wraps: tstsvr.achworks.com/dnet/achws.asmx?op=ConnectionCheck Checks validity of company info

Returns:

  • (Boolean)

    whether or not the request was successful



44
45
46
# File 'lib/ach_client/providers/soap/ach_works/company_info.rb', line 44

def connection_valid?
  connection_check_request(method: :connection_check)
end

#to_hashHash

Build a hash to send to ACHWorks under the InpCompanyInfo XML path

Returns:

  • (Hash)

    hash to send to ACHWorks



65
66
67
68
69
70
71
72
73
74
# File 'lib/ach_client/providers/soap/ach_works/company_info.rb', line 65

def to_hash
  {
    InpCompanyInfo: self.instance_variables.map do |var|
      {
        var.to_s.split('@').last.camelize.to_sym =>
          self.instance_variable_get(var)
      }
    end.reduce(&:merge)
  }
end

#valid?Boolean

Calls both company_valid? and connection_valid? Checks the validity of company info

Returns:

  • (Boolean)

    whether or not the validity check requests were successful



58
59
60
# File 'lib/ach_client/providers/soap/ach_works/company_info.rb', line 58

def valid?
  connection_valid? && company_valid?
end