Class: Ean::API

Inherits:
Object
  • Object
show all
Defined in:
lib/ean/api.rb

Constant Summary collapse

@@instance =
nil

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#cidObject

Returns the value of attribute cid.



3
4
5
# File 'lib/ean/api.rb', line 3

def cid
  @cid
end

#currency_codeObject

Returns the value of attribute currency_code.



3
4
5
# File 'lib/ean/api.rb', line 3

def currency_code
  @currency_code
end

#customer_ip_addressObject

Returns the value of attribute customer_ip_address.



3
4
5
# File 'lib/ean/api.rb', line 3

def customer_ip_address
  @customer_ip_address
end

#customer_session_idObject

Returns the value of attribute customer_session_id.



3
4
5
# File 'lib/ean/api.rb', line 3

def customer_session_id
  @customer_session_id
end

#customer_user_agentObject

Returns the value of attribute customer_user_agent.



3
4
5
# File 'lib/ean/api.rb', line 3

def customer_user_agent
  @customer_user_agent
end

#keyObject

Returns the value of attribute key.



3
4
5
# File 'lib/ean/api.rb', line 3

def key
  @key
end

#localeObject

Returns the value of attribute locale.



3
4
5
# File 'lib/ean/api.rb', line 3

def locale
  @locale
end

#minor_revObject

Returns the value of attribute minor_rev.



3
4
5
# File 'lib/ean/api.rb', line 3

def minor_rev
  @minor_rev
end

#secretObject

Returns the value of attribute secret.



3
4
5
# File 'lib/ean/api.rb', line 3

def secret
  @secret
end

#sigObject

Returns the value of attribute sig.



3
4
5
# File 'lib/ean/api.rb', line 3

def sig
  @sig
end

#versionObject

Returns the value of attribute version.



3
4
5
# File 'lib/ean/api.rb', line 3

def version
  @version
end

Class Method Details

.instanceObject



29
30
31
# File 'lib/ean/api.rb', line 29

def self.instance
  @@instance
end

.make(cid, key, secret, params = {}) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/ean/api.rb', line 17

def self.make(cid, key, secret, params={})
  @@instance               = self.new
  @@instance.cid           = cid
  @@instance.key           = key
  @@instance.sig           = params[:sig].present? ? params[:sig] : ""
  @@instance.secret        = secret
  @@instance.version       = params[:version].present? ? params[:version] : "3"
  @@instance.locale        = params[:locale].present? ? params[:locale] : "en_US"
  @@instance.minor_rev     = params[:minor_rev].present? ? params[:minor_rev] : "4"
  @@instance.currency_code = params[:currency_code].present? ? params[:currency_code] : "USD"
end