Class: Quickeebooks::Windows::Service::ServiceBase

Inherits:
Object
  • Object
show all
Defined in:
lib/quickeebooks/windows/service/service_base.rb

Constant Summary collapse

XML_NS =
%{xmlns:ns2="http://www.intuit.com/sb/cdm/qbo" xmlns="http://www.intuit.com/sb/cdm/v2" xmlns:ns3="http://www.intuit.com/sb/cdm"}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(oauth_access_token = nil, realm_id = nil) ⇒ ServiceBase

Returns a new instance of ServiceBase.



27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/quickeebooks/windows/service/service_base.rb', line 27

def initialize(oauth_access_token = nil, realm_id = nil)
  @base_uri = 'https://services.intuit.com/sb'

  if !oauth_access_token.nil? && !realm_id.nil?
    msg = "Quickeebooks::Windows::ServiceBase - "
    msg += "This version of the constructor is deprecated. "
    msg += "Use the no-arg constructor and set the AccessToken and the RealmID using the accessors."
    warn(msg)
    access_token = oauth_access_token
    realm_id = realm_id
  end
end

Instance Attribute Details

#base_uriObject (readonly)

Returns the value of attribute base_uri.



21
22
23
# File 'lib/quickeebooks/windows/service/service_base.rb', line 21

def base_uri
  @base_uri
end

#last_response_bodyObject (readonly)

Returns the value of attribute last_response_body.



22
23
24
# File 'lib/quickeebooks/windows/service/service_base.rb', line 22

def last_response_body
  @last_response_body
end

#last_response_xmlObject (readonly)

Returns the value of attribute last_response_xml.



23
24
25
# File 'lib/quickeebooks/windows/service/service_base.rb', line 23

def last_response_xml
  @last_response_xml
end

#oauthObject

Returns the value of attribute oauth.



20
21
22
# File 'lib/quickeebooks/windows/service/service_base.rb', line 20

def oauth
  @oauth
end

#realm_idObject

Returns the value of attribute realm_id.



19
20
21
# File 'lib/quickeebooks/windows/service/service_base.rb', line 19

def realm_id
  @realm_id
end

Instance Method Details

#access_token=(token) ⇒ Object



40
41
42
# File 'lib/quickeebooks/windows/service/service_base.rb', line 40

def access_token=(token)
  @oauth = token
end

#guidObject



56
57
58
# File 'lib/quickeebooks/windows/service/service_base.rb', line 56

def guid
  UUIDTools::UUID.random_create.to_s.gsub('-', '')
end

#url_for_base(raw) ⇒ Object



52
53
54
# File 'lib/quickeebooks/windows/service/service_base.rb', line 52

def url_for_base(raw)
  "#{@base_uri}/#{raw}/v2/#{@realm_id}"
end

#url_for_resource(resource) ⇒ Object



48
49
50
# File 'lib/quickeebooks/windows/service/service_base.rb', line 48

def url_for_resource(resource)
  url_for_base(resource)
end