tpdata 1.1.0 → 1.1.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,9 @@
1
+ language: ruby
2
+
3
+ bundler_args: --without coverage
4
+ rvm:
5
+ - 1.9.3
6
+ - jruby-19mode # JRuby in 1.9 mode
7
+ - rbx-19mode
8
+ - ruby-head
9
+ - jruby-head
data/Gemfile CHANGED
@@ -1,2 +1,17 @@
1
+ RUBY_ENGINE = 'ruby' unless defined? RUBY_ENGINE
1
2
  source :rubygems
2
3
  gemspec
4
+
5
+ gem 'rake'
6
+ gem 'rspec'
7
+ gem 'webmock'
8
+ gem 'yard'
9
+
10
+ group :coverage do
11
+ gem 'simplecov'
12
+ gem 'simplecov-rcov'
13
+ end
14
+
15
+ if RUBY_ENGINE == 'jruby'
16
+ gem 'jruby-openssl'
17
+ end
data/README.md CHANGED
@@ -101,13 +101,13 @@ A DELETE:
101
101
 
102
102
  media.delete('Media','27550715', schema:'1.4.0',form:'cjson',token:'Nez8Y9ScVDxPxLDmUsg_ESCDYJCJwPBk',account:'My_Account')
103
103
 
104
- Needed params here are the Object, Object ID(s), schema, form, token, and account.
104
+ Needed params here are the Object, Object ID(s), schema, form, token, and account. To specify no ID, pass 'none' as the parameter.
105
105
 
106
106
  Notify:
107
107
 
108
108
  The Notify endpoint is supported as well.
109
109
 
110
- media.notify(token:'Nez8Y9ScVDxPxLDmUsg_ESCDYJCJwPBk', size:'10', since:'11111111')
110
+ media.notify(size:'10', since:'11111111')
111
111
 
112
112
 
113
113
  ## LICENSE:
data/Rakefile CHANGED
@@ -1,13 +1,12 @@
1
- # -*- ruby -*-
2
-
3
1
  require 'rspec/core/rake_task'
4
2
 
5
- desc "Run specs"
6
- RSpec::Core::RakeTask.new(:spec)
7
-
8
3
  task default: :spec
9
4
 
10
- task :coverage do |t|
5
+ desc "Run Specs"
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ desc "Build Spec Coverage"
9
+ task :coverage do
11
10
  ENV["COVERAGE"] = 'true'
12
11
  Rake::Task[:spec].execute
13
12
  end
@@ -12,15 +12,22 @@ module ThePlatform
12
12
  @objects = params[:objects]
13
13
  end
14
14
 
15
+ # List the available services to build objects with
16
+ def self.services
17
+ service = []
18
+ ThePlatform.const_get(:SERVICE).keys.each { |k| service << k }
19
+ service
20
+ end
21
+
15
22
  # Set the different available params to configure
16
23
  def self.keys
17
24
  @keys ||= [:schema, :form, :token]
18
25
  end
19
26
 
20
27
  # MetaMagic to initialize SERVICE hash into methods to create SERVICE objects
21
- (class << self; self; end).instance_eval do
28
+ class_eval do
22
29
  SERVICE.keys.each do |data|
23
- define_method(data) { self.new(endpoint: SERVICE[data][:endpoint], objects: SERVICE[data][:objects]) }
30
+ define_singleton_method(data) { self.new(endpoint: SERVICE[data][:endpoint], objects: SERVICE[data][:objects]) }
24
31
  end
25
32
  end
26
33
 
@@ -73,7 +80,8 @@ module ThePlatform
73
80
 
74
81
  # DELETE objects
75
82
  #
76
- # To DELETE Objects, pass the Object type and comma separated IDs
83
+ # To DELETE Objects, pass the Object type and comma separated IDs, or specify 'none' for ID if DELETE'ing
84
+ # via query.
77
85
  #
78
86
  # Needed parameters: schema, form, token, and account
79
87
  #
@@ -81,7 +89,9 @@ module ThePlatform
81
89
  # token:'Nez8Y9ScVDxPxLDmUsg_ESCDYJCJwPBk',account:'Ruby Test Account')
82
90
  def delete(object,id=[],options={})
83
91
  set_uri
84
- self.class.delete("/#{object}/#{id}", query: extras.merge(options))
92
+ set_header options
93
+ set_id = "/#{id}" unless id =~ /none/i
94
+ self.class.delete("/#{object}#{set_id}", query: extras.merge(options))
85
95
  end
86
96
 
87
97
  # NOTIFY endpoint
@@ -92,8 +102,9 @@ module ThePlatform
92
102
  #
93
103
  # ThePlatform::Data.mds.notify(token:'G1yP1Zsp7nEHW2fug6glIQCjfjIIIl', size:'10', since:'289334341')
94
104
  def notify(options={})
105
+ set_header options
95
106
  self.class.base_uri @endpoint
96
- self.class.get("/notify", query: options)
107
+ self.class.get("/notify", query: extras.merge(options))
97
108
  end
98
109
 
99
110
  private
@@ -16,7 +16,7 @@ module ThePlatform
16
16
 
17
17
  # Return ALL THE TOKEN!
18
18
  #
19
- # ThePlatform::Identity.token(username:'USERNAME', password:'PASSWORD', schema:'1.0', form:'(json|xml|rss)')
19
+ # ThePlatform::Identity.token(username:'USERNAME', password:'PASSWORD', schema:'1.0', form:'(json|xml)')
20
20
  #
21
21
  # _duration: and _idleTimeout: are optional. Resorts to thePlatform defaults if not defined
22
22
  def token(options = {})
@@ -26,7 +26,7 @@ module ThePlatform
26
26
 
27
27
  # Invalidate a given Token
28
28
  #
29
- # ThePlatform::Identity.invalidate!(token, schema:'1.0', form:'(json|xml|rss)')
29
+ # ThePlatform::Identity.invalidate!(token, schema:'1.0', form:'(json|xml)')
30
30
  def invalidate!(tokens, options = {})
31
31
  base_uri IDENTITY
32
32
  get("/signOut?_token=#{tokens}", query: extras.merge(options))
@@ -34,7 +34,7 @@ module ThePlatform
34
34
 
35
35
  # Return the number of tokens in an account.
36
36
  #
37
- # ThePlatform::Identity.count(username:'USERNAME', password:'PASSWORD',schema:'1.0', form:'(json|xml|rss)')
37
+ # ThePlatform::Identity.count(username:'USERNAME', password:'PASSWORD',schema:'1.0', form:'(json|xml)')
38
38
  def count(options = {})
39
39
  base_uri IDENTITY
40
40
  get("/getTokenCount", query: extras.merge(options))
@@ -10,6 +10,14 @@ describe ThePlatform::Data do
10
10
 
11
11
  end
12
12
 
13
+ describe 'services' do
14
+
15
+ it 'should return available services to call' do
16
+ ThePlatform::Data.services.should == ThePlatform.const_get(:SERVICE).keys
17
+ end
18
+
19
+ end
20
+
13
21
  describe 'endpoints' do
14
22
 
15
23
  it 'should make for new class methods' do
@@ -1,7 +1,6 @@
1
1
  require 'rubygems'
2
2
  require 'rspec'
3
3
  require 'webmock/rspec'
4
- require 'json'
5
4
 
6
5
  RSpec.configure do |config|
7
6
  config.order = 'random'
@@ -9,17 +8,12 @@ end
9
8
 
10
9
  if ENV["COVERAGE"] == 'true'
11
10
  require 'simplecov'
12
-
13
- # add legacy rcov output (so Jenkins/Sonor play well)
14
11
  require 'simplecov-rcov'
15
- class SimpleCov::Formatter::MergedFormatter
16
- def format(result)
17
- SimpleCov::Formatter::HTMLFormatter.new.format(result)
18
- SimpleCov::Formatter::RcovFormatter.new.format(result)
19
- end
20
- end
21
- SimpleCov.formatter = SimpleCov::Formatter::MergedFormatter
22
12
 
13
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
14
+ SimpleCov::Formatter::HTMLFormatter,
15
+ SimpleCov::Formatter::RcovFormatter
16
+ ]
23
17
  SimpleCov.start
24
18
  end
25
19
 
@@ -3,14 +3,14 @@ version = File.read(File.expand_path("../tpdata_version",__FILE__)).strip
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'tpdata'
5
5
  s.version = version
6
- s.date = '2012-10-03'
7
- s.authors = ['Ben Woodall, Bryan Stenson']
6
+
7
+ s.summary = "RESTful wrapper for thePlatform"
8
+ s.description = "Tpdata gem is a wrapper for the RESTful interface for thePlatform for Media's Data Services."
9
+
10
+ s.authors = ["Ben Woodall","Bryan Stenson"]
8
11
  s.email = 'mail@benwoodall.com'
9
12
  s.homepage = 'http://github.com/benwoody/tpdata'
10
13
 
11
- s.summary = %q{RESTful wrapper for thePlatform}
12
- s.description = %q{Tpdata gem is a wrapper for the RESTful interface for thePlatform for Media's Data Services.}
13
-
14
14
  s.files = `git ls-files`.split("\n")
15
15
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
16
  s.require_paths = ["lib"]
@@ -18,11 +18,5 @@ Gem::Specification.new do |s|
18
18
  s.extra_rdoc_files = ["README.md"]
19
19
 
20
20
  s.add_dependency 'httparty', "~> 0.9.0"
21
- s.add_development_dependency 'rake'
22
- s.add_development_dependency 'rspec'
23
- s.add_development_dependency 'yard'
24
- s.add_development_dependency 'webmock'
25
- s.add_development_dependency 'simplecov'
26
- s.add_development_dependency 'simplecov-rcov'
27
21
 
28
22
  end
@@ -1 +1 @@
1
- 1.1.0
1
+ 1.1.5
metadata CHANGED
@@ -1,19 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tpdata
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
8
- - Ben Woodall, Bryan Stenson
8
+ - Ben Woodall
9
+ - Bryan Stenson
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2012-10-03 00:00:00.000000000 Z
13
+ date: 2012-12-04 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: httparty
16
- requirement: &84022590 !ruby/object:Gem::Requirement
17
+ requirement: &88048550 !ruby/object:Gem::Requirement
17
18
  none: false
18
19
  requirements:
19
20
  - - ~>
@@ -21,73 +22,7 @@ dependencies:
21
22
  version: 0.9.0
22
23
  type: :runtime
23
24
  prerelease: false
24
- version_requirements: *84022590
25
- - !ruby/object:Gem::Dependency
26
- name: rake
27
- requirement: &84022240 !ruby/object:Gem::Requirement
28
- none: false
29
- requirements:
30
- - - ! '>='
31
- - !ruby/object:Gem::Version
32
- version: '0'
33
- type: :development
34
- prerelease: false
35
- version_requirements: *84022240
36
- - !ruby/object:Gem::Dependency
37
- name: rspec
38
- requirement: &84021660 !ruby/object:Gem::Requirement
39
- none: false
40
- requirements:
41
- - - ! '>='
42
- - !ruby/object:Gem::Version
43
- version: '0'
44
- type: :development
45
- prerelease: false
46
- version_requirements: *84021660
47
- - !ruby/object:Gem::Dependency
48
- name: yard
49
- requirement: &84021210 !ruby/object:Gem::Requirement
50
- none: false
51
- requirements:
52
- - - ! '>='
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- type: :development
56
- prerelease: false
57
- version_requirements: *84021210
58
- - !ruby/object:Gem::Dependency
59
- name: webmock
60
- requirement: &84020820 !ruby/object:Gem::Requirement
61
- none: false
62
- requirements:
63
- - - ! '>='
64
- - !ruby/object:Gem::Version
65
- version: '0'
66
- type: :development
67
- prerelease: false
68
- version_requirements: *84020820
69
- - !ruby/object:Gem::Dependency
70
- name: simplecov
71
- requirement: &84044910 !ruby/object:Gem::Requirement
72
- none: false
73
- requirements:
74
- - - ! '>='
75
- - !ruby/object:Gem::Version
76
- version: '0'
77
- type: :development
78
- prerelease: false
79
- version_requirements: *84044910
80
- - !ruby/object:Gem::Dependency
81
- name: simplecov-rcov
82
- requirement: &84043620 !ruby/object:Gem::Requirement
83
- none: false
84
- requirements:
85
- - - ! '>='
86
- - !ruby/object:Gem::Version
87
- version: '0'
88
- type: :development
89
- prerelease: false
90
- version_requirements: *84043620
25
+ version_requirements: *88048550
91
26
  description: Tpdata gem is a wrapper for the RESTful interface for thePlatform for
92
27
  Media's Data Services.
93
28
  email: mail@benwoodall.com
@@ -97,6 +32,7 @@ extra_rdoc_files:
97
32
  - README.md
98
33
  files:
99
34
  - .gitignore
35
+ - .travis.yml
100
36
  - Gemfile
101
37
  - Manifest.txt
102
38
  - README.md