Active 0.0.42 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. data/.gitignore +6 -0
  2. data/.irbrc +21 -0
  3. data/.rspec +1 -0
  4. data/.rvmrc +2 -0
  5. data/Active.gemspec +28 -29
  6. data/Gemfile +4 -0
  7. data/History.txt +5 -2
  8. data/{README.txt → README.md} +4 -20
  9. data/Rakefile +11 -17
  10. data/lib/Active.rb +11 -79
  11. data/lib/active/activity.rb +7 -0
  12. data/lib/active/article.rb +7 -0
  13. data/lib/active/asset.rb +205 -0
  14. data/lib/active/errors.rb +9 -0
  15. data/lib/active/query.rb +225 -0
  16. data/lib/active/result.rb +7 -0
  17. data/lib/active/results.rb +6 -0
  18. data/lib/active/training.rb +7 -0
  19. data/lib/active/version.rb +3 -0
  20. data/lib/ext/hash_extensions.rb +8 -0
  21. data/spec/asset_spec.rb +47 -0
  22. data/spec/search_spec.rb +383 -432
  23. data/spec/spec_helper.rb +23 -2
  24. metadata +113 -116
  25. data/bin/Active +0 -7
  26. data/lib/.DS_Store +0 -0
  27. data/lib/services/.DS_Store +0 -0
  28. data/lib/services/IActivity.rb +0 -39
  29. data/lib/services/_ats.rb +0 -215
  30. data/lib/services/active_works.rb +0 -167
  31. data/lib/services/activity.rb +0 -512
  32. data/lib/services/address.rb +0 -17
  33. data/lib/services/ats.rb +0 -229
  34. data/lib/services/dto/user.rb +0 -9
  35. data/lib/services/gsa.rb +0 -205
  36. data/lib/services/reg_center.rb +0 -270
  37. data/lib/services/sanitize.rb +0 -108
  38. data/lib/services/search.rb +0 -494
  39. data/lib/services/validators.rb +0 -124
  40. data/rspec-tm +0 -1
  41. data/rvmrc +0 -1
  42. data/spec/.DS_Store +0 -0
  43. data/spec/Active_spec.rb +0 -28
  44. data/spec/activeworks_spec.rb +0 -60
  45. data/spec/activity_spec.rb +0 -421
  46. data/spec/ats_spec.rb +0 -106
  47. data/spec/benchmark/search_bench.rb +0 -55
  48. data/spec/custom_matchers_spec.rb +0 -27
  49. data/spec/gsa_spec.rb +0 -210
  50. data/spec/reg_spec.rb +0 -173
  51. data/spec/search_memcached_spec.rb +0 -42
  52. data/spec/validators_spec.rb +0 -19
  53. data/test/test_Active.rb +0 -0
  54. data/version.txt +0 -1
@@ -1,7 +1,7 @@
1
-
2
1
  require File.expand_path(File.join(File.dirname(__FILE__), %w[.. lib Active]))
2
+ require 'date'
3
3
 
4
- Spec::Runner.configure do |config|
4
+ RSpec.configure do |config|
5
5
  # == Mock Framework
6
6
  #
7
7
  # RSpec uses it's own mocking framework by default. If you prefer to
@@ -12,3 +12,24 @@ Spec::Runner.configure do |config|
12
12
  # config.mock_with :rr
13
13
  end
14
14
 
15
+ RSpec::Matchers.define :have_param do |expected|
16
+ match do |actual|
17
+ actual.include?(expected)
18
+ end
19
+
20
+ failure_message_for_should do |actual|
21
+ "expected #{actual.inspect} to have param #{expected.inspect}, but it didn't"
22
+ end
23
+
24
+ failure_message_for_should_not do |actual|
25
+ "expected #{actual.inspect} not to have param #{expected.inspect}, but it did"
26
+ end
27
+
28
+ description do
29
+ "have param #{expected}"
30
+ end
31
+ end
32
+
33
+ def open_url(str)
34
+ system("open \"#{str}\"")
35
+ end
metadata CHANGED
@@ -1,146 +1,143 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: Active
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 0
8
- - 42
9
- version: 0.0.42
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.7
5
+ prerelease:
10
6
  platform: ruby
11
- authors:
12
- - Jonathan Spooner, Brian Levine
7
+ authors:
8
+ - Jonathan Spooner, Marc Leglise
13
9
  autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
-
17
- date: 2011-02-17 00:00:00 -08:00
18
- default_executable:
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
21
- name: savon
12
+ date: 2012-01-03 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: json
16
+ requirement: &70100667115100 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '1'
22
+ type: :runtime
22
23
  prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- segments:
28
- - 0
29
- - 7
30
- - 9
31
- version: 0.7.9
24
+ version_requirements: *70100667115100
25
+ - !ruby/object:Gem::Dependency
26
+ name: hashie
27
+ requirement: &70100667114600 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: '1'
32
33
  type: :runtime
33
- version_requirements: *id001
34
- - !ruby/object:Gem::Dependency
35
- name: dalli
36
34
  prerelease: false
37
- requirement: &id002 !ruby/object:Gem::Requirement
38
- requirements:
39
- - - ">="
40
- - !ruby/object:Gem::Version
41
- segments:
42
- - 0
43
- - 9
44
- - 8
45
- version: 0.9.8
35
+ version_requirements: *70100667114600
36
+ - !ruby/object:Gem::Dependency
37
+ name: activesupport
38
+ requirement: &70100667114140 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>'
42
+ - !ruby/object:Gem::Version
43
+ version: '3'
46
44
  type: :runtime
47
- version_requirements: *id002
48
- - !ruby/object:Gem::Dependency
49
- name: bones
50
45
  prerelease: false
51
- requirement: &id003 !ruby/object:Gem::Requirement
52
- requirements:
53
- - - ">="
54
- - !ruby/object:Gem::Version
55
- segments:
56
- - 3
57
- - 4
58
- - 7
59
- version: 3.4.7
46
+ version_requirements: *70100667114140
47
+ - !ruby/object:Gem::Dependency
48
+ name: htmlentities
49
+ requirement: &70100667113680 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>'
53
+ - !ruby/object:Gem::Version
54
+ version: '4'
55
+ type: :runtime
56
+ prerelease: false
57
+ version_requirements: *70100667113680
58
+ - !ruby/object:Gem::Dependency
59
+ name: rspec
60
+ requirement: &70100667113220 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ~>
64
+ - !ruby/object:Gem::Version
65
+ version: '2'
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: *70100667113220
69
+ - !ruby/object:Gem::Dependency
70
+ name: metric_fu
71
+ requirement: &70100667112760 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ~>
75
+ - !ruby/object:Gem::Version
76
+ version: '2'
60
77
  type: :development
61
- version_requirements: *id003
78
+ prerelease: false
79
+ version_requirements: *70100667112760
62
80
  description: Search api for Active Network
63
- email: jspooner [at] gmail.com
64
- executables:
65
- - Active
81
+ email:
82
+ - jspooner@gmail.com
83
+ executables: []
66
84
  extensions: []
67
-
68
- extra_rdoc_files:
85
+ extra_rdoc_files:
69
86
  - History.txt
70
- - README.txt
71
- - bin/Active
72
- - lib/.DS_Store
73
- - lib/services/.DS_Store
74
- - version.txt
75
- files:
87
+ - README.md
88
+ files:
89
+ - .gitignore
90
+ - .irbrc
91
+ - .rspec
92
+ - .rvmrc
76
93
  - Active.gemspec
94
+ - Gemfile
77
95
  - History.txt
78
- - README.txt
96
+ - README.md
79
97
  - Rakefile
80
- - bin/Active
81
- - lib/.DS_Store
82
98
  - lib/Active.rb
83
- - lib/services/.DS_Store
84
- - lib/services/IActivity.rb
85
- - lib/services/_ats.rb
86
- - lib/services/active_works.rb
87
- - lib/services/activity.rb
88
- - lib/services/address.rb
89
- - lib/services/ats.rb
90
- - lib/services/dto/user.rb
91
- - lib/services/gsa.rb
92
- - lib/services/reg_center.rb
93
- - lib/services/sanitize.rb
94
- - lib/services/search.rb
95
- - lib/services/validators.rb
96
- - rspec-tm
97
- - rvmrc
98
- - spec/.DS_Store
99
- - spec/Active_spec.rb
100
- - spec/activeworks_spec.rb
101
- - spec/activity_spec.rb
102
- - spec/ats_spec.rb
103
- - spec/benchmark/search_bench.rb
104
- - spec/custom_matchers_spec.rb
105
- - spec/gsa_spec.rb
106
- - spec/reg_spec.rb
107
- - spec/search_memcached_spec.rb
99
+ - lib/active/activity.rb
100
+ - lib/active/article.rb
101
+ - lib/active/asset.rb
102
+ - lib/active/errors.rb
103
+ - lib/active/query.rb
104
+ - lib/active/result.rb
105
+ - lib/active/results.rb
106
+ - lib/active/training.rb
107
+ - lib/active/version.rb
108
+ - lib/ext/hash_extensions.rb
109
+ - spec/asset_spec.rb
108
110
  - spec/search_spec.rb
109
111
  - spec/spec.opts
110
112
  - spec/spec_helper.rb
111
- - spec/validators_spec.rb
112
- - test/test_Active.rb
113
- - version.txt
114
- has_rdoc: true
115
113
  homepage: http://developer.active.com/docs/Activecom_Search_API_Reference
116
114
  licenses: []
117
-
118
- post_install_message: " --------------------------\n Welcome to Active Network\n --------------------------\n"
119
- rdoc_options:
115
+ post_install_message:
116
+ rdoc_options:
120
117
  - --main
121
- - README.txt
122
- require_paths:
118
+ - README.md
119
+ require_paths:
123
120
  - lib
124
- required_ruby_version: !ruby/object:Gem::Requirement
125
- requirements:
126
- - - ">="
127
- - !ruby/object:Gem::Version
128
- segments:
129
- - 0
130
- version: "0"
131
- required_rubygems_version: !ruby/object:Gem::Requirement
132
- requirements:
133
- - - ">="
134
- - !ruby/object:Gem::Version
135
- segments:
136
- - 0
137
- version: "0"
121
+ required_ruby_version: !ruby/object:Gem::Requirement
122
+ none: false
123
+ requirements:
124
+ - - ! '>='
125
+ - !ruby/object:Gem::Version
126
+ version: '0'
127
+ required_rubygems_version: !ruby/object:Gem::Requirement
128
+ none: false
129
+ requirements:
130
+ - - ! '>='
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
138
133
  requirements: []
139
-
140
134
  rubyforge_project: Active
141
- rubygems_version: 1.3.6
135
+ rubygems_version: 1.8.10
142
136
  signing_key:
143
137
  specification_version: 3
144
138
  summary: Search api for Active Network
145
- test_files:
146
- - test/test_Active.rb
139
+ test_files:
140
+ - spec/asset_spec.rb
141
+ - spec/search_spec.rb
142
+ - spec/spec.opts
143
+ - spec/spec_helper.rb
data/bin/Active DELETED
@@ -1,7 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require File.expand_path(
4
- File.join(File.dirname(__FILE__), %w[.. lib Active]))
5
-
6
- # Put your code here
7
-
Binary file
Binary file
@@ -1,39 +0,0 @@
1
- # require './defaultDriver.rb'
2
-
3
- module Active
4
- module Services
5
-
6
- class IActivity
7
-
8
- attr_accessor
9
-
10
- attr_accessor :title, :url, :categories, :address, :start_date, :start_time, :end_time, :end_date, :category, :desc,
11
- :asset_id, :asset_type_id, :data, :online_registration
12
-
13
- attr_reader :asset_type_id
14
-
15
- def validated_address(address)
16
- #ensure a hash with the proper keys
17
- returnAddress = HashWithIndifferentAccess.new({ :name =>"", :address => "", :city => "", :state => "",:zip => "", :lat => "", :lng => "", :country => ""})
18
- returnAddress.merge!(address)
19
- # validations
20
-
21
- returnAddress["zip"] = Validators.valid_zip(returnAddress["zip"])
22
- returnAddress["state"] = Validators.valid_state(returnAddress["state"])
23
-
24
- # ensure no nil
25
- returnAddress.keys.each do |key|
26
- returnAddress[key] = "" if returnAddress[key].nil?
27
- end
28
- returnAddress
29
- end
30
-
31
- def source
32
- raise StandardError, "You must override this method"
33
- end
34
-
35
- end
36
-
37
- end
38
-
39
- end
@@ -1,215 +0,0 @@
1
- require 'digest/sha1'
2
- module Active
3
- module Services
4
-
5
- class ATSError < StandardError; end
6
-
7
- class ATS < IActivity
8
-
9
- attr_reader :metadata_loaded
10
- # EXAMPLE Data hash
11
- # {"destinationID"=>"", "assetId"=>"A9EF9D79-F859-4443-A9BB-91E1833DF2D5", "substitutionUrl"=>"1878023", "city"=>"Antioch", "contactName"=>"City of Antioch", "trackbackurl"=>"http://www.active.com/page/Event_Details.htm?event_id=1878023&assetId=A9EF9D79-F859-4443-A9BB-91E1833DF2D5", "category"=>"Activities", "zip"=>"94531", "userCommentText"=>nil, "location"=>"Multi-use Room (prewett) - Prewett Family Park & Center", "latitude"=>"37.95761", :asset_id=>"A9EF9D79-F859-4443-A9BB-91E1833DF2D5", "searchWeight"=>"1", "country"=>"United States", "participationCriteria"=>"All", "dma"=>"San Francisco - Oakland - San Jose", "isSearchable"=>"true", :asset_name=>"Fitness, Pilates Mat Class (16 Yrs. &amp; Up)", :substitution_url=>"1878023", :asset_type_id=>"EA4E860A-9DCD-4DAA-A7CA-4A77AD194F65", "row"=>"1", "image1"=>"http://www.active.com/images/events/hotrace.gif", "startDate"=>"2010-09-13", "contactPhone"=>"925-779-7070", :asset_type_name=>"Active.com Event Registration", "onlineDonationAvailable"=>"0", "avgUserRating"=>nil, "market"=>"San Francisco - Oakland - San Jose", "assetTypeId"=>"EA4E860A-9DCD-4DAA-A7CA-4A77AD194F65", "assetName"=>"Fitness, Pilates Mat Class (16 Yrs. & Up)", "channel"=>"Not Specified", "seourl"=>"http://www.active.com/not-specified-recware-activities/antioch-ca/fitness-pilates-mat-class-16-yrs-and-up-2010", :xmlns=>"http://api.asset.services.active.com", :url=>"http://www.active.com/page/Event_Details.htm?event_id=1878023", "mediaType"=>"Recware Activities", "startTime"=>"18:15:00", "endTime"=>"18:15:00", "contactEmail"=>"dadams@ci.antioch.ca.us", "eventResults"=>nil, "longitude"=>"-121.7936", "endDate"=>"2010-09-13", "onlineRegistrationAvailable"=>"true", "onlineMembershipAvailable"=>"0", "state"=>"California"}
12
- # {"destinationID"=>"", "assetId"=>"D9A22F33-8A14-4175-8D5B-D11578212A98", "substitutionUrl"=>"1847738", "city"=>"Encino", "contactName"=>"Lilliane Ballesteros", "trackbackurl"=>"http://www.active.com/page/Event_Details.htm?event_id=1847738&assetId=D9A22F33-8A14-4175-8D5B-D11578212A98", "category"=>"Activities", "zip"=>"91406", "userCommentText"=>nil, "location"=>"Balboa Park/Lake Balboa", "latitude"=>"34.19933", :asset_id=>"D9A22F33-8A14-4175-8D5B-D11578212A98", "searchWeight"=>"1", "country"=>"United States", "participationCriteria"=>"All", "dma"=>"Los Angeles", "isSearchable"=>"1", :asset_name=>"2nd Annual weSPARK 10K Run &amp; 5K Run Walk", :substitution_url=>"1847738", :asset_type_id=>"EA4E860A-9DCD-4DAA-A7CA-4A77AD194F65", "row"=>"1", "image1"=>"http://www.active.com/images/events/hotrace.gif", "startDate"=>"2010-11-14", "contactPhone"=>"818-906-3022", :asset_type_name=>"Active.com Event Registration", "onlineDonationAvailable"=>"0", "avgUserRating"=>nil, "market"=>"Los Angeles", "assetTypeId"=>"EA4E860A-9DCD-4DAA-A7CA-4A77AD194F65", "assetName"=>"2nd Annual weSPARK 10K Run & 5K Run Walk", "channel"=>["Running", "Walking"], "seourl"=>"http://www.active.com/running/encino-ca/2nd-annual-wespark-10k-run-and-5k-run-walk-2010", :xmlns=>"http://api.asset.services.active.com", :url=>"http://www.active.com/page/Event_Details.htm?event_id=1847738", "mediaType"=>["Event", "Event\\10K", "Event\\5K"], "startTime"=>"8:00:00", "endTime"=>"8:00:00", "contactEmail"=>"lilliane@wespark.org", "eventResults"=>nil, "longitude"=>"-118.4924", "endDate"=>"2010-11-14", "onlineRegistrationAvailable"=>"1", "onlineMembershipAvailable"=>"0", "state"=>"California", "estParticipants"=>"1400", "eventURL"=>"http://www.wespark.org"}
13
-
14
- def initialize(data={},preload_metadata=false)
15
- # need to hold on to original data
16
- @data = data
17
- @asset_id = data[:asset_id]
18
- @url = data[:url]
19
- @asset_type_id = data[:asset_type_id]
20
- @title = data[:asset_name] if data[:asset_name]
21
- @substitution_url = data[:substitution_url]
22
- # @metadata_loaded = false
23
- # load_metadata if preload_metadata
24
- end
25
-
26
- def source
27
- :ats
28
- end
29
-
30
-
31
- def title
32
- # load_metadata unless @metadata_loaded
33
- # if @data.has_key?("assetName")
34
- @data["assetName"]
35
- # else
36
- # @title
37
- # end
38
- end
39
-
40
- def url
41
- # load_metadata unless @metadata_loaded
42
- if @data.has_key?("seourl")
43
- @data["seourl"]
44
- elsif @data.has_key?("trackbackurl")
45
- @data["trackbackurl"]
46
- else
47
- @url
48
- end
49
- end
50
-
51
- def categories
52
- # load_metadata unless @metadata_loaded
53
- categories = @data["channel"]
54
- if categories.class==String
55
- [@data["channel"]]
56
- else
57
- @data["channel"]
58
- end
59
- end
60
-
61
- def address
62
- # load_metadata unless @metadata_loaded
63
- @address = validated_address({
64
- :name => @data["location"],
65
- :address => @data["address"],
66
- :city => @data["city"],
67
- :state => @data["state"],
68
- :zip => @data["zip"],
69
- :lat => @data["latitude"],
70
- :lng => @data["longitude"],
71
- :country => @data["country"]
72
- })
73
- end
74
-
75
- def start_date
76
- # load_metadata unless @metadata_loaded
77
- if @data.has_key?("startDate")
78
- if @data.has_key?("startTime")
79
- (DateTime.parse "#{@data["startDate"]} #{@data["startTime"]}")
80
- else
81
- (DateTime.parse @data["startDate"])
82
- end
83
- else
84
- nil
85
- end
86
- end
87
-
88
- def start_time
89
- start_date
90
- end
91
-
92
- def end_date
93
- # load_metadata unless @metadata_loaded
94
- if @data.has_key?("endDate")
95
- if @data.has_key?("endTime")
96
- (DateTime.parse "#{@data["endDate"]} #{@data["endTime"]}")
97
- else
98
- (DateTime.parse @data["endDate"])
99
- end
100
- else
101
- nil
102
- end
103
- end
104
-
105
- def end_time
106
- end_date
107
- end
108
-
109
-
110
- def category
111
- categories.first
112
- end
113
-
114
- def desc
115
- # load_metadata unless @metadata_loaded
116
- if @data.has_key?("allText")
117
- @data["allText"]
118
- elsif @data.has_key?("summary")
119
- @data["summary"]
120
- end
121
- end
122
-
123
- def contact_name
124
- # load_metadata unless @metadata_loaded
125
- @data["contactName"] if @data.has_key?("contactName")
126
- end
127
-
128
- def contact_email
129
- # load_metadata unless @metadata_loaded
130
- @data["contactEmail"] if @data.has_key?("contactEmail")
131
- end
132
-
133
- def substitutionUrl
134
- @data[:substitution_url]
135
- end
136
-
137
-
138
- # EXAMPLE
139
- # lazy load the data for some_crazy_method
140
- # def some_crazy
141
- # return @some_crazy unless @some_crazy.nil?
142
- # @some_crazy = @data[:some_crazy_method_from_ats].split replace twist bla bla bla
143
- # end
144
-
145
- def self.find_by_id(id)
146
- begin
147
- c = Savon::Client.new("http://api.amp.active.com/asset-service/services/AssetService")
148
- c.request.headers["Api-Key"] = "6npky9t57235vps5cetm3s7k"
149
- r = c.get_asset_by_id! do |soap|
150
- soap.namespace = "http://api.asset.services.active.com"
151
- soap.body = "<context><userId></userId><applicationId></applicationId></context><assetId>#{id}</assetId>"
152
- end
153
- ats = ATS.new(r.to_hash[:get_asset_by_id_response][:out])
154
- ats.load_metadata
155
-
156
- return ats
157
-
158
- rescue Savon::SOAPFault => e
159
- raise ATSError, "Couldn't find activity with the id of #{id} error #{e.inspect}"
160
- return
161
- end
162
- end
163
-
164
- def load_metadata
165
- metadata = ATS.get_asset_metadata(@asset_id)
166
- @data.merge! Hash.from_xml(metadata.to_hash[:get_asset_metadata_response][:out])["importSource"]["asset"]
167
- @metadata_loaded=true
168
- end
169
-
170
- private
171
-
172
- def self.get_asset_metadata(id)
173
- c = Savon::Client.new("http://api.amp.active.com/asset-service/services/AssetService")
174
- c.request.headers["Api-Key"] = "6npky9t57235vps5cetm3s7k"
175
- r = c.get_asset_metadata! do |soap|
176
- soap.namespace = "http://api.asset.services.active.com"
177
- soap.body = "<context><userId></userId><applicationId></applicationId></context><assetId>#{id}</assetId>"
178
- end
179
- return r
180
- end
181
-
182
- #
183
- # def self.get_asset_metadata(id)
184
- # search_hash = Digest::SHA1.hexdigest("ats_m_#{id}")
185
- # if Active.CACHE
186
- # cached_version = Active.CACHE.get(search_hash)
187
- # return cached_version if cached_version
188
- # end
189
- #
190
- # c = Savon::Client.new("http://api.amp.active.com/asset-service/services/AssetService")
191
- # c.request.headers["Api-Key"] = "6npky9t57235vps5cetm3s7k"
192
- # r = c.get_asset_metadata! do |soap|
193
- # soap.namespace = "http://api.asset.services.active.com"
194
- # soap.body = "<context><userId></userId><applicationId></applicationId></context><assetId>#{id}</assetId>"
195
- # end
196
- # ats = ATS.new(r.to_hash[:get_asset_metadata_response][:out])
197
- # Active.CACHE.set(search_hash, ats) if Active.CACHE
198
- # return ats
199
- # end
200
-
201
- def self.get_asset_by_id(id)
202
- c = Savon::Client.new("http://api.amp.active.com/asset-service/services/AssetService")
203
- c.request.headers["Api-Key"] = "6npky9t57235vps5cetm3s7k"
204
- r = c.get_asset_by_id! do |soap|
205
- soap.namespace = "http://api.asset.services.active.com"
206
- soap.body = "<context><userId></userId><applicationId></applicationId></context><assetId>#{id}</assetId>"
207
- end
208
- ats = ATS.new(r.to_hash[:get_asset_by_id_response][:out])
209
- return ats
210
- end
211
-
212
-
213
- end # end ats
214
- end
215
- end