sk_sdk 0.1.1 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.2.1
@@ -13,9 +13,9 @@ For bundler add this to the Gemfile
13
13
  # or directly require a used class
14
14
  gem "sk_sdk", :require => "sk_sdk/base"
15
15
 
16
- Dependencies (gem's):
16
+ Dependencies (gems):
17
17
 
18
- * activeresupport
18
+ * activesupport
19
19
  * activeresource
20
20
 
21
21
  == Authorization
@@ -35,7 +35,7 @@ library, it merely sets an AUTHORIZATION header if you added a token in the
35
35
  connection settings.
36
36
 
37
37
  AUTHORIZATION: Bearer YourAccessToken
38
-
38
+
39
39
  More on oAuth here:
40
40
  * {oAuth helper class}[https://github.com/salesking/sk_sdk/blob/master/lib/sk_sdk/oauth.rb]
41
41
  * {oAuth docs}[http://dev.blog.salesking.eu/docs/authentication/].
@@ -150,7 +150,7 @@ Returned JSON data for a listings, abbreviated:
150
150
  "prev": "/api/clients?page=0",
151
151
  "next": "/api/clients?page=2",
152
152
  "self": "/api/clients?page=1"
153
- },
153
+ },
154
154
  }
155
155
 
156
156
  === Filtering
@@ -175,7 +175,7 @@ Available filters are defined in each json-schema's instances link ({see invoice
175
175
  To create a resource make a POST request containing the json for a single resource.
176
176
 
177
177
  Header: content-type application/json
178
- POST https://my-sub.salesking.eu/invoices.json
178
+ POST https://my-sub.salesking.eu/invoices.json
179
179
 
180
180
  {"invoice": {
181
181
  "title": "Your service subscription 2011",
@@ -196,8 +196,8 @@ To create a resource make a POST request containing the json for a single resour
196
196
  Header: content-type application/json
197
197
  PUT /api/clients/:id
198
198
  {
199
- 'client':
200
- {
199
+ 'client':
200
+ {
201
201
  'gender':'male',
202
202
  'first_name': "Andrew"
203
203
  }
@@ -215,7 +215,7 @@ A DELETE request to a resource url deletes and returns the deleted object:
215
215
  * This client does NOT rely on parsing the JSON Schema, since ActiveResource(AR) creates the Getter/Setter methods.
216
216
  * We added some patches for AR to fix JSON parsing issues, due to our nesting.
217
217
  * non-restful routes can be accessed by custom methods {see examples in AR}[https://github.com/rails/rails/blob/master/activeresource/lib/active_resource/custom_methods.rb]
218
-
218
+
219
219
  E.g calling the print method a a document:
220
220
  Invoice.find('uuid').post(:print, :template_id => 'pdf-template-uuid')
221
221
 
@@ -6,7 +6,7 @@ module ActiveResource
6
6
 
7
7
  # override ARes method to parse only the client part
8
8
  def load_attributes_from_response(response)
9
- if !response['Content-Length'].blank? && response['Content-Length'] != "0" && !response.body.nil? && response.body.strip.size > 0
9
+ if (response['Transfer-Encoding'] == 'chunked' || (!response['Content-Length'].blank? && response['Content-Length'] != "0")) && !response.body.nil? && response.body.strip.size > 0
10
10
  load( self.class.format.decode(response.body)[self.class.element_name] )
11
11
  @persisted = true
12
12
  end
@@ -22,4 +22,4 @@ module ActiveResource
22
22
  collection.collect! { |record| instantiate_record(record, prefix_options) }
23
23
  end
24
24
  end
25
- end
25
+ end
data/lib/sk_sdk/base.rb CHANGED
@@ -15,7 +15,7 @@ class SK::SDK::Base < ActiveResource::Base
15
15
  self.format = :json
16
16
  # hook before init in activeresource base because json comes in nested:
17
17
  # {client={data}
18
- if ActiveResource::VERSION::MAJOR == 3 #TODO Damn this is dirty .. we really need to get rid of backwards compat
18
+ if ActiveResource::VERSION::MAJOR == 3 && ActiveResource::VERSION::MINOR > 0
19
19
  def initialize(attributes = {}, *args)
20
20
  attr = attributes[self.class.element_name] || attributes
21
21
  super(attr, *args)
@@ -43,7 +43,7 @@ class SK::SDK::Base < ActiveResource::Base
43
43
  self.format = :json # f*** xml
44
44
  if opts[:token] #oAuth access token in header
45
45
  self.headers['Authorization'] = "Bearer #{opts[:token]}"
46
- else
46
+ else
47
47
  self.user = opts[:user]
48
48
  self.password = opts[:password]
49
49
  end
data/sk_sdk.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{sk_sdk}
8
- s.version = "0.1.1"
8
+ s.version = "0.2.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Georg Leciejewski"]
12
- s.date = %q{2011-12-21}
11
+ s.authors = [%q{Georg Leciejewski}]
12
+ s.date = %q{2012-05-21}
13
13
  s.description = %q{Connect your business world with SalesKing. This gem gives ruby developers a jump-start for building SalesKing Business Apps. It provides classes to handle oAuth, make RESTfull API requests and parses JSON Schema }
14
14
  s.email = %q{gl@salesking.eu}
15
15
  s.extra_rdoc_files = [
@@ -50,8 +50,8 @@ Gem::Specification.new do |s|
50
50
  "spec/spec_helper.rb"
51
51
  ]
52
52
  s.homepage = %q{http://github.com/salesking/sk_sdk}
53
- s.require_paths = ["lib"]
54
- s.rubygems_version = %q{1.6.2}
53
+ s.require_paths = [%q{lib}]
54
+ s.rubygems_version = %q{1.8.6}
55
55
  s.summary = %q{SalesKing SDK Ruby}
56
56
 
57
57
  if s.respond_to? :specification_version then
@@ -42,7 +42,7 @@ describe SK::SDK::Base, "make new class" do
42
42
  end
43
43
 
44
44
  it "should create save method" do
45
- c = Client.new
45
+ c = Client.new
46
46
  c.respond_to?(:save).should be_true
47
47
  end
48
48
 
@@ -57,7 +57,7 @@ describe SK::SDK::Base, "make new class" do
57
57
 
58
58
  it "should allow multiple parameters in initializer" do
59
59
  expect {
60
- if ActiveResource::VERSION::MAJOR == 3
60
+ if ActiveResource::VERSION::MAJOR == 3 && ActiveResource::VERSION::MINOR > 0
61
61
  Client.new({ :first_name => 'herbert' }, true)
62
62
  else
63
63
  Client.new({ :first_name => 'herbert' })
metadata CHANGED
@@ -1,116 +1,91 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: sk_sdk
3
- version: !ruby/object:Gem::Version
4
- hash: 25
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.1
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 1
9
- - 1
10
- version: 0.1.1
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Georg Leciejewski
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-12-21 00:00:00 +01:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
12
+ date: 2012-05-21 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
22
15
  name: curb
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &70341335516100 !ruby/object:Gem::Requirement
25
17
  none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 0
32
- version: "0"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
33
22
  type: :runtime
34
- version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
36
- name: activesupport
37
23
  prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *70341335516100
25
+ - !ruby/object:Gem::Dependency
26
+ name: activesupport
27
+ requirement: &70341335515380 !ruby/object:Gem::Requirement
39
28
  none: false
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- hash: 3
44
- segments:
45
- - 0
46
- version: "0"
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
47
33
  type: :runtime
48
- version_requirements: *id002
49
- - !ruby/object:Gem::Dependency
50
- name: sk_api_schema
51
34
  prerelease: false
52
- requirement: &id003 !ruby/object:Gem::Requirement
35
+ version_requirements: *70341335515380
36
+ - !ruby/object:Gem::Dependency
37
+ name: sk_api_schema
38
+ requirement: &70341335514260 !ruby/object:Gem::Requirement
53
39
  none: false
54
- requirements:
55
- - - ">="
56
- - !ruby/object:Gem::Version
57
- hash: 3
58
- segments:
59
- - 0
60
- version: "0"
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
61
44
  type: :runtime
62
- version_requirements: *id003
63
- - !ruby/object:Gem::Dependency
64
- name: activeresource
65
45
  prerelease: false
66
- requirement: &id004 !ruby/object:Gem::Requirement
46
+ version_requirements: *70341335514260
47
+ - !ruby/object:Gem::Dependency
48
+ name: activeresource
49
+ requirement: &70341335513260 !ruby/object:Gem::Requirement
67
50
  none: false
68
- requirements:
69
- - - ">="
70
- - !ruby/object:Gem::Version
71
- hash: 3
72
- segments:
73
- - 0
74
- version: "0"
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
75
55
  type: :runtime
76
- version_requirements: *id004
77
- - !ruby/object:Gem::Dependency
78
- name: rspec
79
56
  prerelease: false
80
- requirement: &id005 !ruby/object:Gem::Requirement
57
+ version_requirements: *70341335513260
58
+ - !ruby/object:Gem::Dependency
59
+ name: rspec
60
+ requirement: &70341335512600 !ruby/object:Gem::Requirement
81
61
  none: false
82
- requirements:
83
- - - ">="
84
- - !ruby/object:Gem::Version
85
- hash: 3
86
- segments:
87
- - 0
88
- version: "0"
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
89
66
  type: :development
90
- version_requirements: *id005
91
- - !ruby/object:Gem::Dependency
92
- name: rcov
93
67
  prerelease: false
94
- requirement: &id006 !ruby/object:Gem::Requirement
68
+ version_requirements: *70341335512600
69
+ - !ruby/object:Gem::Dependency
70
+ name: rcov
71
+ requirement: &70341335511640 !ruby/object:Gem::Requirement
95
72
  none: false
96
- requirements:
97
- - - ">="
98
- - !ruby/object:Gem::Version
99
- hash: 3
100
- segments:
101
- - 0
102
- version: "0"
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
103
77
  type: :development
104
- version_requirements: *id006
105
- description: "Connect your business world with SalesKing. This gem gives ruby developers a jump-start for building SalesKing Business Apps. It provides classes to handle oAuth, make RESTfull API requests and parses JSON Schema "
78
+ prerelease: false
79
+ version_requirements: *70341335511640
80
+ description: ! 'Connect your business world with SalesKing. This gem gives ruby developers
81
+ a jump-start for building SalesKing Business Apps. It provides classes to handle
82
+ oAuth, make RESTfull API requests and parses JSON Schema '
106
83
  email: gl@salesking.eu
107
84
  executables: []
108
-
109
85
  extensions: []
110
-
111
- extra_rdoc_files:
86
+ extra_rdoc_files:
112
87
  - README.rdoc
113
- files:
88
+ files:
114
89
  - MIT-LICENSE
115
90
  - README.rdoc
116
91
  - Rakefile
@@ -143,39 +118,28 @@ files:
143
118
  - spec/sk_sdk/sync_field_spec.rb
144
119
  - spec/sk_sdk/sync_spec.rb
145
120
  - spec/spec_helper.rb
146
- has_rdoc: true
147
121
  homepage: http://github.com/salesking/sk_sdk
148
122
  licenses: []
149
-
150
123
  post_install_message:
151
124
  rdoc_options: []
152
-
153
- require_paths:
125
+ require_paths:
154
126
  - lib
155
- required_ruby_version: !ruby/object:Gem::Requirement
127
+ required_ruby_version: !ruby/object:Gem::Requirement
156
128
  none: false
157
- requirements:
158
- - - ">="
159
- - !ruby/object:Gem::Version
160
- hash: 3
161
- segments:
162
- - 0
163
- version: "0"
164
- required_rubygems_version: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ! '>='
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ required_rubygems_version: !ruby/object:Gem::Requirement
165
134
  none: false
166
- requirements:
167
- - - ">="
168
- - !ruby/object:Gem::Version
169
- hash: 3
170
- segments:
171
- - 0
172
- version: "0"
135
+ requirements:
136
+ - - ! '>='
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
173
139
  requirements: []
174
-
175
140
  rubyforge_project:
176
- rubygems_version: 1.6.2
141
+ rubygems_version: 1.8.6
177
142
  signing_key:
178
143
  specification_version: 3
179
144
  summary: SalesKing SDK Ruby
180
145
  test_files: []
181
-