target_api 0.0.1
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 +5 -0
- data/Gemfile +4 -0
- data/Rakefile +2 -0
- data/lib/.target_api.rb.swp +0 -0
- data/lib/target_api/version.rb +3 -0
- data/lib/target_api.rb +50 -0
- data/spec/.target_api_spec.rb.swp +0 -0
- data/spec/spec_helper.rb +3 -0
- data/spec/target_api_spec.rb +9 -0
- data/target_api.gemspec +24 -0
- metadata +105 -0
data/Gemfile
ADDED
data/Rakefile
ADDED
|
Binary file
|
data/lib/target_api.rb
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
require 'httparty'
|
|
2
|
+
|
|
3
|
+
class TargetApi
|
|
4
|
+
include HTTParty
|
|
5
|
+
@@API_KEY = ENV["TARGET_API_KEY"]
|
|
6
|
+
|
|
7
|
+
def self.get_base_url
|
|
8
|
+
"http://api.targetapi.com/#{@@API_KEY}/"
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def self.API_KEY=(value)
|
|
12
|
+
@@API_KEY = value
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def self.save_person(id, options={})
|
|
16
|
+
post("#{get_base_url}person/#{id}", :body => options)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def self.get_persons
|
|
20
|
+
get("#{get_base_url}persons")
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def self.get_profile(id)
|
|
24
|
+
get("#{get_base_url}person/#{id}/profile")
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def self.save_item(id, options={})
|
|
28
|
+
post("#{get_base_url}item/#{id}", :body => options)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def self.get_item(id)
|
|
32
|
+
get("#{get_base_url}item/#{id}")
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def self.get_items
|
|
36
|
+
get("#{get_base_url}items")
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def self.get_recommendations(id)
|
|
40
|
+
get("#{get_base_url}person/#{id}/recommendations")
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def self.submit_feedback(person_id, item_id, rating_value)
|
|
44
|
+
post("#{get_base_url}person/#{person_id}/rating/#{item_id}", :body => { :rating_value => rating_value })
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def self.get_ratings_for_person(person_id)
|
|
48
|
+
get("#{get_base_url}person/#{person_id}/ratings")
|
|
49
|
+
end
|
|
50
|
+
end
|
|
Binary file
|
data/spec/spec_helper.rb
ADDED
data/target_api.gemspec
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
|
3
|
+
require "target_api/version"
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |s|
|
|
6
|
+
s.name = "target_api"
|
|
7
|
+
s.version = TargetApi::VERSION
|
|
8
|
+
s.platform = Gem::Platform::RUBY
|
|
9
|
+
s.authors = ["Jonathan Birkholz"]
|
|
10
|
+
s.email = ["rookieone@gmail.com"]
|
|
11
|
+
s.homepage = "http://rubygems.org/gems/target_api"
|
|
12
|
+
s.summary = %q{Gem for the Target API}
|
|
13
|
+
s.description = %q{Gem for the Target API}
|
|
14
|
+
|
|
15
|
+
s.rubyforge_project = "target_api"
|
|
16
|
+
|
|
17
|
+
s.add_development_dependency "rspec"
|
|
18
|
+
s.add_development_dependency "httparty"
|
|
19
|
+
|
|
20
|
+
s.files = `git ls-files`.split("\n")
|
|
21
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
|
22
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
|
23
|
+
s.require_paths = ["lib"]
|
|
24
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: target_api
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
hash: 29
|
|
5
|
+
prerelease: false
|
|
6
|
+
segments:
|
|
7
|
+
- 0
|
|
8
|
+
- 0
|
|
9
|
+
- 1
|
|
10
|
+
version: 0.0.1
|
|
11
|
+
platform: ruby
|
|
12
|
+
authors:
|
|
13
|
+
- Jonathan Birkholz
|
|
14
|
+
autorequire:
|
|
15
|
+
bindir: bin
|
|
16
|
+
cert_chain: []
|
|
17
|
+
|
|
18
|
+
date: 2011-02-18 00:00:00 -06:00
|
|
19
|
+
default_executable:
|
|
20
|
+
dependencies:
|
|
21
|
+
- !ruby/object:Gem::Dependency
|
|
22
|
+
name: rspec
|
|
23
|
+
prerelease: false
|
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
|
25
|
+
none: false
|
|
26
|
+
requirements:
|
|
27
|
+
- - ">="
|
|
28
|
+
- !ruby/object:Gem::Version
|
|
29
|
+
hash: 3
|
|
30
|
+
segments:
|
|
31
|
+
- 0
|
|
32
|
+
version: "0"
|
|
33
|
+
type: :development
|
|
34
|
+
version_requirements: *id001
|
|
35
|
+
- !ruby/object:Gem::Dependency
|
|
36
|
+
name: httparty
|
|
37
|
+
prerelease: false
|
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
|
39
|
+
none: false
|
|
40
|
+
requirements:
|
|
41
|
+
- - ">="
|
|
42
|
+
- !ruby/object:Gem::Version
|
|
43
|
+
hash: 3
|
|
44
|
+
segments:
|
|
45
|
+
- 0
|
|
46
|
+
version: "0"
|
|
47
|
+
type: :development
|
|
48
|
+
version_requirements: *id002
|
|
49
|
+
description: Gem for the Target API
|
|
50
|
+
email:
|
|
51
|
+
- rookieone@gmail.com
|
|
52
|
+
executables: []
|
|
53
|
+
|
|
54
|
+
extensions: []
|
|
55
|
+
|
|
56
|
+
extra_rdoc_files: []
|
|
57
|
+
|
|
58
|
+
files:
|
|
59
|
+
- .gitignore
|
|
60
|
+
- Gemfile
|
|
61
|
+
- Rakefile
|
|
62
|
+
- lib/.target_api.rb.swp
|
|
63
|
+
- lib/target_api.rb
|
|
64
|
+
- lib/target_api/version.rb
|
|
65
|
+
- spec/.target_api_spec.rb.swp
|
|
66
|
+
- spec/spec_helper.rb
|
|
67
|
+
- spec/target_api_spec.rb
|
|
68
|
+
- target_api.gemspec
|
|
69
|
+
has_rdoc: true
|
|
70
|
+
homepage: http://rubygems.org/gems/target_api
|
|
71
|
+
licenses: []
|
|
72
|
+
|
|
73
|
+
post_install_message:
|
|
74
|
+
rdoc_options: []
|
|
75
|
+
|
|
76
|
+
require_paths:
|
|
77
|
+
- lib
|
|
78
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
79
|
+
none: false
|
|
80
|
+
requirements:
|
|
81
|
+
- - ">="
|
|
82
|
+
- !ruby/object:Gem::Version
|
|
83
|
+
hash: 3
|
|
84
|
+
segments:
|
|
85
|
+
- 0
|
|
86
|
+
version: "0"
|
|
87
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
88
|
+
none: false
|
|
89
|
+
requirements:
|
|
90
|
+
- - ">="
|
|
91
|
+
- !ruby/object:Gem::Version
|
|
92
|
+
hash: 3
|
|
93
|
+
segments:
|
|
94
|
+
- 0
|
|
95
|
+
version: "0"
|
|
96
|
+
requirements: []
|
|
97
|
+
|
|
98
|
+
rubyforge_project: target_api
|
|
99
|
+
rubygems_version: 1.3.7
|
|
100
|
+
signing_key:
|
|
101
|
+
specification_version: 3
|
|
102
|
+
summary: Gem for the Target API
|
|
103
|
+
test_files:
|
|
104
|
+
- spec/spec_helper.rb
|
|
105
|
+
- spec/target_api_spec.rb
|