goldshark_gem 0.2.3 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore CHANGED
@@ -1,7 +1,6 @@
1
1
  # rcov generated
2
2
  coverage
3
3
  coverage.data
4
-
5
4
  # rdoc generated
6
5
  rdoc
7
6
 
data/README.md CHANGED
@@ -4,7 +4,7 @@ Goldshark Gem
4
4
  To Install
5
5
  ---
6
6
 
7
- gem install goldshark\_gem
7
+ gem install goldshark_gem
8
8
 
9
9
  ###Put in Rails Gemfile
10
10
 
@@ -24,12 +24,12 @@ localization is the parameter key you will need to define in the YAML file. The
24
24
  en_us:
25
25
  tool_guid: '12343252'
26
26
  locale: 'en'
27
- api_root: 'http://gst.api.igodigital.com/v2_2' # this option is optional it gsaults to v2_2
27
+ api_root: 'http://gst.api.igodigital.com/v2_2' # this option is optional it defaults to v2_2
28
28
 
29
29
  fridge_finder:
30
30
  tool_guid: '3255423'
31
31
  locale: 'en'
32
- api_root: 'http://gst.api.igodigital.com/v2_2' # this option is optional it gsaults to v2_2
32
+ api_root: 'http://gst.api.igodigital.com/v2_2' # this option is optional it defaults to v2_2
33
33
 
34
34
  ###Without YAML config file
35
35
 
@@ -65,7 +65,7 @@ If the tool\_config.yml file is missing or you are not developing in the Rails e
65
65
  ###Load and Search a text
66
66
  After the text object is initialized. The find method returns the value as a string. (The text type is always defined unlike the text name so I picked that param to make the call).
67
67
 
68
- texts.load_texts
68
+ texts.load_text
69
69
 
70
70
  texts.find(text_type)
71
71
 
@@ -131,6 +131,7 @@ The following call will record the event passed on the gs.session\_id.
131
131
  gs.record_events(event_name)
132
132
 
133
133
  The following call will record microconversion based on the gs.session\_id and the retailer product id passed (param not optional).
134
+
134
135
  gs.micro_convert(retailer_product_id)
135
136
 
136
137
  ###PG CI interaction
@@ -15,5 +15,5 @@ Gem::Specification.new do |s|
15
15
  s.add_dependency 'activesupport'
16
16
  s.add_dependency 'libxml-ruby'
17
17
  s.require_paths = ["lib"]
18
- s.version = '0.2.3'
18
+ s.version = '0.2.4'
19
19
  end
@@ -36,6 +36,14 @@ module GS
36
36
  @locale = locale
37
37
  end
38
38
  end
39
+
40
+ def source(source = nil)
41
+ if source.nil?
42
+ @source
43
+ else
44
+ @source = source
45
+ end
46
+ end
39
47
 
40
48
  def url(url = nil)
41
49
  if url.nil?
@@ -46,10 +54,15 @@ module GS
46
54
  end
47
55
 
48
56
  def get_tool
57
+ if @source.nil?
58
+ source = ''
59
+ else
60
+ source = "&source=#{@source}"
61
+ end
49
62
  unless @session_id.nil?
50
- uri = URI.parse("#{@url}/#{@tool_guid}/tool.json?locale=#{@locale}&sid=#{@session_id}")
63
+ uri = URI.parse("#{@url}/#{@tool_guid}/tool.json?locale=#{@locale}&sid=#{@session_id}#{source}")
51
64
  else
52
- uri = URI.parse("#{@url}/#{@tool_guid}/tool.json?locale=#{@locale}")
65
+ uri = URI.parse("#{@url}/#{@tool_guid}/tool.json?locale=#{@locale}#{source}")
53
66
  end
54
67
  return get_call(uri)
55
68
  end
@@ -132,21 +145,36 @@ module GS
132
145
  end
133
146
 
134
147
  def recs(group_id, retailer_product_list)
135
- uri = URI.parse("#{@url}/#{@tool_guid}/recommend.json?group_id=#{group_id}&retailer_product_list=#{retailer_product_list}")
148
+ if @source.nil?
149
+ source = ''
150
+ else
151
+ source = "&source=#{@source}"
152
+ end
153
+ uri = URI.parse("#{@url}/#{@tool_guid}/recommend.json?group_id=#{group_id}&retailer_product_list=#{retailer_product_list}#{source}")
136
154
  return get_call(uri)
137
155
  end
138
156
 
139
157
  def record_events(event_name)
158
+ if @source.nil?
159
+ source = ''
160
+ else
161
+ source = "&source=#{@source}"
162
+ end
140
163
  if @session_id.nil?
141
- uri = URI.parse("#{@url}/#{@tool_guid}/record_event/#{event_name}.json")
164
+ uri = URI.parse("#{@url}/#{@tool_guid}/record_event/#{event_name}.json#{source}")
142
165
  else
143
- uri = URI.parse("#{@url}/#{@tool_guid}/record_event/#{event_name}.json?sid=#{@session_id}")
166
+ uri = URI.parse("#{@url}/#{@tool_guid}/record_event/#{event_name}.json?sid=#{@session_id}#{source}")
144
167
  end
145
168
  return get_call(uri)
146
169
  end
147
170
 
148
171
  def micro_convert(retailer_product_id)
149
- uri = URI.parse("#{@url}/#{@tool_guid}/micro_conversions.json?sid=#{@session_id}&retailer_product_id=#{retailer_product_id}")
172
+ if @source.nil?
173
+ source = ''
174
+ else
175
+ source = "&source=#{@source}"
176
+ end
177
+ uri = URI.parse("#{@url}/#{@tool_guid}/micro_conversions.json?sid=#{@session_id}&retailer_product_id=#{retailer_product_id}#{source}")
150
178
  return get_call(uri)
151
179
  end
152
180
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: goldshark_gem
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-25 00:00:00.000000000 Z
12
+ date: 2012-12-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport