sklik-api 0.0.12 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,10 +1,10 @@
1
1
  source "http://rubygems.org"
2
2
 
3
3
  gem "json"
4
- gem "unicode", "~> 0.4.0"
5
- gem "text", "~> 0.2.0"
6
- gem "i18n", "~> 0.6.0"
7
- gem "activesupport", "~> 3.1.0"
4
+ gem "unicode"
5
+ gem "text"
6
+ gem "i18n"
7
+ gem "activesupport"
8
8
 
9
9
 
10
10
  group :development do
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.12
1
+ 0.0.13
@@ -18,7 +18,8 @@ class SklikApi
18
18
 
19
19
  #prepare connection to sklik
20
20
  def connection
21
- server = XMLRPC::Client.new3(:host => "api.sklik.cz", :path => "/RPC2", :port => 443, :use_ssl => true, :timeout => @args[:timeout])
21
+ path = (ENV['RACK_ENV'] || ENV['RAILS']) == "test" ? "/sandbox/RPC2" : "/RPC2"
22
+ server = XMLRPC::Client.new3(:host => "api.sklik.cz", :path => path, :port => 443, :use_ssl => true, :timeout => @args[:timeout])
22
23
  server.instance_variable_get(:@http).instance_variable_set(:@verify_mode, OpenSSL::SSL::VERIFY_NONE)
23
24
  #fix of UTF-8 encoding
24
25
  server.extend(XMLRPCWorkAround)
@@ -59,7 +60,7 @@ class SklikApi
59
60
  begin
60
61
  #get response from sklik
61
62
  param = connection.call( method, get_session, *args ).symbolize_keys
62
- if param[:status] == 200
63
+ if [200,404].include?(param[:status])
63
64
  return yield(param)
64
65
  elsif param[:status] == 406
65
66
  raise ArgumentError, "Sklik returned: #{method}: #{param[:statusMessage]} #{args.inspect}"
data/lib/sklik-api.rb CHANGED
@@ -15,7 +15,6 @@ require 'active_support'
15
15
  require 'active_support/inflector'
16
16
  require 'active_support/inflector/inflections'
17
17
  require 'active_support/core_ext/hash/keys'
18
- require 'active_support/core_ext/class/inheritable_attributes'
19
18
  require 'active_support/core_ext'
20
19
 
21
20
  require 'date'
data/sklik-api.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "sklik-api"
8
- s.version = "0.0.12"
8
+ s.version = "0.0.13"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Ondrej Bartas"]
12
- s.date = "2012-07-12"
12
+ s.date = "2012-08-29"
13
13
  s.description = "Sklik advertising PPC api for creating campaigns and updating them when they runs"
14
14
  s.email = "ondrej@bartas.cz"
15
15
  s.extra_rdoc_files = [
@@ -37,8 +37,7 @@ Gem::Specification.new do |s|
37
37
  "sklik-api.gemspec",
38
38
  "test/fake_web.rb",
39
39
  "test/helper.rb",
40
- "test/unit/campaign.rb",
41
- "test/unit/client.rb"
40
+ "test/unit/campaign.rb"
42
41
  ]
43
42
  s.homepage = "http://github.com/ondrejbartas/sklik-api"
44
43
  s.licenses = ["MIT"]
@@ -51,10 +50,10 @@ Gem::Specification.new do |s|
51
50
 
52
51
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
53
52
  s.add_runtime_dependency(%q<json>, [">= 0"])
54
- s.add_runtime_dependency(%q<unicode>, ["~> 0.4.0"])
55
- s.add_runtime_dependency(%q<text>, ["~> 0.2.0"])
56
- s.add_runtime_dependency(%q<i18n>, ["~> 0.6.0"])
57
- s.add_runtime_dependency(%q<activesupport>, ["~> 3.1.0"])
53
+ s.add_runtime_dependency(%q<unicode>, [">= 0"])
54
+ s.add_runtime_dependency(%q<text>, [">= 0"])
55
+ s.add_runtime_dependency(%q<i18n>, [">= 0"])
56
+ s.add_runtime_dependency(%q<activesupport>, [">= 0"])
58
57
  s.add_development_dependency(%q<rack-test>, [">= 0"])
59
58
  s.add_development_dependency(%q<shoulda-context>, [">= 0"])
60
59
  s.add_development_dependency(%q<turn>, ["~> 0.8.2"])
@@ -67,10 +66,10 @@ Gem::Specification.new do |s|
67
66
  s.add_development_dependency(%q<rcov>, ["= 0.9.10"])
68
67
  else
69
68
  s.add_dependency(%q<json>, [">= 0"])
70
- s.add_dependency(%q<unicode>, ["~> 0.4.0"])
71
- s.add_dependency(%q<text>, ["~> 0.2.0"])
72
- s.add_dependency(%q<i18n>, ["~> 0.6.0"])
73
- s.add_dependency(%q<activesupport>, ["~> 3.1.0"])
69
+ s.add_dependency(%q<unicode>, [">= 0"])
70
+ s.add_dependency(%q<text>, [">= 0"])
71
+ s.add_dependency(%q<i18n>, [">= 0"])
72
+ s.add_dependency(%q<activesupport>, [">= 0"])
74
73
  s.add_dependency(%q<rack-test>, [">= 0"])
75
74
  s.add_dependency(%q<shoulda-context>, [">= 0"])
76
75
  s.add_dependency(%q<turn>, ["~> 0.8.2"])
@@ -84,10 +83,10 @@ Gem::Specification.new do |s|
84
83
  end
85
84
  else
86
85
  s.add_dependency(%q<json>, [">= 0"])
87
- s.add_dependency(%q<unicode>, ["~> 0.4.0"])
88
- s.add_dependency(%q<text>, ["~> 0.2.0"])
89
- s.add_dependency(%q<i18n>, ["~> 0.6.0"])
90
- s.add_dependency(%q<activesupport>, ["~> 3.1.0"])
86
+ s.add_dependency(%q<unicode>, [">= 0"])
87
+ s.add_dependency(%q<text>, [">= 0"])
88
+ s.add_dependency(%q<i18n>, [">= 0"])
89
+ s.add_dependency(%q<activesupport>, [">= 0"])
91
90
  s.add_dependency(%q<rack-test>, [">= 0"])
92
91
  s.add_dependency(%q<shoulda-context>, [">= 0"])
93
92
  s.add_dependency(%q<turn>, ["~> 0.8.2"])
@@ -66,8 +66,7 @@ class CampaignTest < Test::Unit::TestCase
66
66
  end
67
67
 
68
68
  should "be found" do
69
- assert_equal SklikApi::Campaign.find(:campaign_id => 390265).size, 1
70
- assert SklikApi::Campaign.find(:customer_id => 192495).size > 0
69
+ assert SklikApi::Campaign.find().size > 0, "In sklik sandbox should be some campaigns"
71
70
  end
72
71
 
73
72
  should "return stats" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sklik-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.13
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-12 00:00:00.000000000 Z
12
+ date: 2012-08-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
16
- requirement: &70187437372220 !ruby/object:Gem::Requirement
16
+ requirement: &70165102749880 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,54 +21,54 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70187437372220
24
+ version_requirements: *70165102749880
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: unicode
27
- requirement: &70187437371520 !ruby/object:Gem::Requirement
27
+ requirement: &70165102748660 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
- - - ~>
30
+ - - ! '>='
31
31
  - !ruby/object:Gem::Version
32
- version: 0.4.0
32
+ version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70187437371520
35
+ version_requirements: *70165102748660
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: text
38
- requirement: &70187437405280 !ruby/object:Gem::Requirement
38
+ requirement: &70165102745140 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
- - - ~>
41
+ - - ! '>='
42
42
  - !ruby/object:Gem::Version
43
- version: 0.2.0
43
+ version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70187437405280
46
+ version_requirements: *70165102745140
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: i18n
49
- requirement: &70187437404600 !ruby/object:Gem::Requirement
49
+ requirement: &70165102744260 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
- - - ~>
52
+ - - ! '>='
53
53
  - !ruby/object:Gem::Version
54
- version: 0.6.0
54
+ version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70187437404600
57
+ version_requirements: *70165102744260
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: activesupport
60
- requirement: &70187437403940 !ruby/object:Gem::Requirement
60
+ requirement: &70165102743000 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
- - - ~>
63
+ - - ! '>='
64
64
  - !ruby/object:Gem::Version
65
- version: 3.1.0
65
+ version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70187437403940
68
+ version_requirements: *70165102743000
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rack-test
71
- requirement: &70187437403220 !ruby/object:Gem::Requirement
71
+ requirement: &70165086747280 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70187437403220
79
+ version_requirements: *70165086747280
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: shoulda-context
82
- requirement: &70187437402640 !ruby/object:Gem::Requirement
82
+ requirement: &70165086746120 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *70187437402640
90
+ version_requirements: *70165086746120
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: turn
93
- requirement: &70187437402060 !ruby/object:Gem::Requirement
93
+ requirement: &70165086745640 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ~>
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: 0.8.2
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *70187437402060
101
+ version_requirements: *70165086745640
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: minitest
104
- requirement: &70187437401520 !ruby/object:Gem::Requirement
104
+ requirement: &70165086745160 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ! '>='
@@ -109,10 +109,10 @@ dependencies:
109
109
  version: '0'
110
110
  type: :development
111
111
  prerelease: false
112
- version_requirements: *70187437401520
112
+ version_requirements: *70165086745160
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: ansi
115
- requirement: &70187437400840 !ruby/object:Gem::Requirement
115
+ requirement: &70165086744600 !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
118
118
  - - ~>
@@ -120,10 +120,10 @@ dependencies:
120
120
  version: 1.2.5
121
121
  type: :development
122
122
  prerelease: false
123
- version_requirements: *70187437400840
123
+ version_requirements: *70165086744600
124
124
  - !ruby/object:Gem::Dependency
125
125
  name: jeweler
126
- requirement: &70187437400140 !ruby/object:Gem::Requirement
126
+ requirement: &70165086744020 !ruby/object:Gem::Requirement
127
127
  none: false
128
128
  requirements:
129
129
  - - ~>
@@ -131,10 +131,10 @@ dependencies:
131
131
  version: 1.8.3
132
132
  type: :development
133
133
  prerelease: false
134
- version_requirements: *70187437400140
134
+ version_requirements: *70165086744020
135
135
  - !ruby/object:Gem::Dependency
136
136
  name: fakeweb
137
- requirement: &70187437399540 !ruby/object:Gem::Requirement
137
+ requirement: &70165086743500 !ruby/object:Gem::Requirement
138
138
  none: false
139
139
  requirements:
140
140
  - - ! '>='
@@ -142,10 +142,10 @@ dependencies:
142
142
  version: '0'
143
143
  type: :development
144
144
  prerelease: false
145
- version_requirements: *70187437399540
145
+ version_requirements: *70165086743500
146
146
  - !ruby/object:Gem::Dependency
147
147
  name: thin
148
- requirement: &70187437398900 !ruby/object:Gem::Requirement
148
+ requirement: &70165086742980 !ruby/object:Gem::Requirement
149
149
  none: false
150
150
  requirements:
151
151
  - - ! '>='
@@ -153,10 +153,10 @@ dependencies:
153
153
  version: '0'
154
154
  type: :development
155
155
  prerelease: false
156
- version_requirements: *70187437398900
156
+ version_requirements: *70165086742980
157
157
  - !ruby/object:Gem::Dependency
158
158
  name: shotgun
159
- requirement: &70187437398300 !ruby/object:Gem::Requirement
159
+ requirement: &70165086742320 !ruby/object:Gem::Requirement
160
160
  none: false
161
161
  requirements:
162
162
  - - ! '>='
@@ -164,10 +164,10 @@ dependencies:
164
164
  version: '0'
165
165
  type: :development
166
166
  prerelease: false
167
- version_requirements: *70187437398300
167
+ version_requirements: *70165086742320
168
168
  - !ruby/object:Gem::Dependency
169
169
  name: rcov
170
- requirement: &70187437397680 !ruby/object:Gem::Requirement
170
+ requirement: &70165086741800 !ruby/object:Gem::Requirement
171
171
  none: false
172
172
  requirements:
173
173
  - - =
@@ -175,7 +175,7 @@ dependencies:
175
175
  version: 0.9.10
176
176
  type: :development
177
177
  prerelease: false
178
- version_requirements: *70187437397680
178
+ version_requirements: *70165086741800
179
179
  description: Sklik advertising PPC api for creating campaigns and updating them when
180
180
  they runs
181
181
  email: ondrej@bartas.cz
@@ -206,7 +206,6 @@ files:
206
206
  - test/fake_web.rb
207
207
  - test/helper.rb
208
208
  - test/unit/campaign.rb
209
- - test/unit/client.rb
210
209
  homepage: http://github.com/ondrejbartas/sklik-api
211
210
  licenses:
212
211
  - MIT
@@ -222,7 +221,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
222
221
  version: '0'
223
222
  segments:
224
223
  - 0
225
- hash: 3224656535573863894
224
+ hash: 2939750912901063758
226
225
  required_rubygems_version: !ruby/object:Gem::Requirement
227
226
  none: false
228
227
  requirements:
data/test/unit/client.rb DELETED
@@ -1,27 +0,0 @@
1
- # -*- encoding : utf-8 -*-
2
- require 'helper'
3
- class ClientTest < Test::Unit::TestCase
4
- context "Client" do
5
-
6
- should "be initialized" do
7
- assert_nothing_raised do
8
- SklikApi::Client.new()
9
- end
10
- end
11
-
12
- should "found all Clients" do
13
- assert_equal SklikApi::Client.find().size, 2
14
- end
15
-
16
- should "be found by id" do
17
- assert_equal SklikApi::Client.find(:customer_id => 192107).first.args[:email], "test-ataxo@seznam.cz"
18
- assert_equal SklikApi::Client.find(:customer_id => 192495).first.args[:email], "test3-ataxo@seznam.cz"
19
- end
20
-
21
- should "be found by email" do
22
- assert_equal SklikApi::Client.find(:email => "test-ataxo@seznam.cz").first.args[:customer_id], 192107
23
- assert_equal SklikApi::Client.find(:email => "test3-ataxo@seznam.cz").first.args[:customer_id], 192495
24
- end
25
-
26
- end
27
- end