fuelsdk 0.0.2 → 0.0.3

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/README.md CHANGED
@@ -9,17 +9,12 @@ The Fuel SDK for Ruby provides easy access to ExactTarget's Fuel API Family serv
9
9
  ## Requirements ##
10
10
  Ruby Version 1.9.3
11
11
 
12
- Gems:
13
-
14
- - [savon (2.x)](http://rubygems.org/gems/savon)
15
- - [json (1.7.x)](http://rubygems.org/gems/json)
16
- - [jwt (0.1.6)](https://rubygems.org/gems/jwt)
17
-
18
-
19
12
  ## Getting Started ##
20
- After downloading the project, rename the config.yaml.template file to config.yaml.
13
+ Add this line to your application's Gemfile:
21
14
 
22
- Edit config.yaml so you can input the ClientID and Client Secret values provided when you registered your application. If you are building a HubExchange application for the Interactive Marketing Hub then, you must also provide the Application Signature (appsignature). Only change the value for the defaultwsdl configuration item if instructed by ExactTarget.
15
+ ```ruby
16
+ gem 'fuelsdk'
17
+ ```
23
18
 
24
19
  If you have not registered your application or you need to lookup your Application Key or Application Signature values, please go to App Center at [Code@: ExactTarget's Developer Community](http://code.exacttarget.com/appcenter "Code@ App Center").
25
20
 
@@ -68,8 +63,8 @@ Print out the results for viewing
68
63
  :"@xsi:type"=>"List"}
69
64
  ],
70
65
  @code=200,
71
- @status=true,
72
- @moreResults=false,
66
+ @success?=true,
67
+ @more?=false,
73
68
  @request_id="41f0f293-954f-4ac7-8e7a-0a5756022218"
74
69
  >
75
70
  </pre>
@@ -14,327 +14,6 @@ module FuelSDK
14
14
  end
15
15
 
16
16
  =begin
17
- class ET_Constructor
18
- attr_accessor :status, :code, :message, :results, :request_id, :moreResults
19
-
20
- def initialize(response = nil, rest = false)
21
- @results = []
22
- #if !response.nil? && !rest then
23
- # @@body = response.body
24
-
25
- # if ((!response.soap_fault?) or (!response.http_error?)) then
26
- # @code = response.http.code
27
- # @status = true
28
- # elsif (response.soap_fault?) then
29
- # @code = response.http.code
30
- # @message = @@body[:fault][:faultstring]
31
- # @status = false
32
- # elsif (response.http_error?) then
33
- # @code = response.http.code
34
- # @status = false
35
- # end
36
- #elsif
37
- @code = response.code
38
- @status = true
39
- if @code != "200" then
40
- @status = false
41
- end
42
-
43
- begin
44
- @results = JSON.parse(response.body)
45
- rescue
46
- @message = response.body
47
- end
48
-
49
- end
50
- end
51
- end
52
-
53
- class ET_BaseObject
54
- attr_accessor :authStub, :props
55
- attr_reader :obj, :lastRequestID, :endpoint
56
-
57
- def initialize
58
- @authStub = nil
59
- @props = nil
60
- @filter = nil
61
- @lastRequestID = nil
62
- @endpoint = nil
63
- end
64
- end
65
-
66
- class ET_GetSupportRest < ET_BaseObject
67
- attr_reader :urlProps, :urlPropsRequired, :lastPageNumber
68
-
69
- def get(props = nil)
70
- if props and props.is_a? Hash then
71
- @props = props
72
- end
73
-
74
- completeURL = @endpoint
75
- additionalQS = {}
76
-
77
- if @props and @props.is_a? Hash then
78
- @props.each do |k,v|
79
- if @urlProps.include?(k) then
80
- completeURL.sub!("{#{k}}", v)
81
- else
82
- additionalQS[k] = v
83
- end
84
- end
85
- end
86
-
87
- @urlPropsRequired.each do |value|
88
- if !@props || !@props.has_key?(value) then
89
- raise "Unable to process request due to missing required prop: #{value}"
90
- end
91
- end
92
-
93
- @urlProps.each do |value|
94
- completeURL.sub!("/{#{value}}", "")
95
- end
96
-
97
- obj = ET_GetRest.new(@authStub, completeURL,additionalQS)
98
-
99
- if obj.results.has_key?('page') then
100
- @lastPageNumber = obj.results['page']
101
- pageSize = obj.results['pageSize']
102
- if obj.results.has_key?('count') then
103
- count = obj.results['count']
104
- elsif obj.results.has_key?('totalCount') then
105
- count = obj.results['totalCount']
106
- end
107
-
108
- if !count.nil? && count > (@lastPageNumber * pageSize) then
109
- obj.moreResults = true
110
- end
111
- end
112
- return obj
113
- end
114
-
115
- def getMoreResults()
116
- if props and props.is_a? Hash then
117
- @props = props
118
- end
119
-
120
- originalPageValue = "1"
121
- removePageFromProps = false
122
-
123
- if !@props.nil? && @props.has_key?('$page') then
124
- originalPageValue = @props['page']
125
- else
126
- removePageFromProps = true
127
- end
128
-
129
- if @props.nil?
130
- @props = {}
131
- end
132
-
133
- @props['$page'] = @lastPageNumber + 1
134
-
135
- obj = self.get
136
-
137
- if removePageFromProps then
138
- @props.delete('$page')
139
- else
140
- @props['$page'] = originalPageValue
141
- end
142
-
143
- return obj
144
- end
145
- end
146
-
147
- class ET_CUDSupportRest < ET_GetSupportRest
148
-
149
- def post()
150
- completeURL = @endpoint
151
-
152
- if @props and @props.is_a? Hash then
153
- @props.each do |k,v|
154
- if @urlProps.include?(k) then
155
- completeURL.sub!("{#{k}}", v)
156
- end
157
- end
158
- end
159
-
160
- @urlPropsRequired.each do |value|
161
- if !@props || !@props.has_key?(value) then
162
- raise "Unable to process request due to missing required prop: #{value}"
163
- end
164
- end
165
-
166
- # Clean Optional Parameters from Endpoint URL first
167
- @urlProps.each do |value|
168
- completeURL.sub!("/{#{value}}", "")
169
- end
170
-
171
- ET_PostRest.new(@authStub, completeURL, @props)
172
- end
173
-
174
- def patch()
175
- completeURL = @endpoint
176
- # All URL Props are required when doing Patch
177
- @urlProps.each do |value|
178
- if !@props || !@props.has_key?(value) then
179
- raise "Unable to process request due to missing required prop: #{value}"
180
- end
181
- end
182
-
183
- if @props and @props.is_a? Hash then
184
- @props.each do |k,v|
185
- if @urlProps.include?(k) then
186
- completeURL.sub!("{#{k}}", v)
187
- end
188
- end
189
- end
190
-
191
- obj = ET_PatchRest.new(@authStub, completeURL, @props)
192
- end
193
-
194
- def delete()
195
- completeURL = @endpoint
196
- # All URL Props are required when doing Patch
197
- @urlProps.each do |value|
198
- if !@props || !@props.has_key?(value) then
199
- raise "Unable to process request due to missing required prop: #{value}"
200
- end
201
- end
202
-
203
- if @props and @props.is_a? Hash then
204
- @props.each do |k,v|
205
- if @urlProps.include?(k) then
206
- completeURL.sub!("{#{k}}", v)
207
- end
208
- end
209
- end
210
-
211
- ET_DeleteRest.new(@authStub, completeURL)
212
- end
213
-
214
- end
215
-
216
-
217
- class ET_GetRest < ET_Constructor
218
- def initialize(authStub, endpoint, qs = nil)
219
- authStub.refreshToken
220
-
221
- if qs then
222
- qs['access_token'] = authStub.authToken
223
- else
224
- qs = {"access_token" => authStub.authToken}
225
- end
226
-
227
- uri = URI.parse(endpoint)
228
- uri.query = URI.encode_www_form(qs)
229
- http = Net::HTTP.new(uri.host, uri.port)
230
- http.use_ssl = true
231
- request = Net::HTTP::Get.new(uri.request_uri)
232
- requestResponse = http.request(request)
233
-
234
- @moreResults = false
235
-
236
- obj = super(requestResponse, true)
237
- return obj
238
- end
239
- end
240
-
241
-
242
- class ET_ContinueRest < ET_Constructor
243
- def initialize(authStub, endpoint, qs = nil)
244
- authStub.refreshToken
245
-
246
- if qs then
247
- qs['access_token'] = authStub.authToken
248
- else
249
- qs = {"access_token" => authStub.authToken}
250
- end
251
-
252
- uri = URI.parse(endpoint)
253
- uri.query = URI.encode_www_form(qs)
254
- http = Net::HTTP.new(uri.host, uri.port)
255
- http.use_ssl = true
256
- request = Net::HTTP::Get.new(uri.request_uri)
257
- requestResponse = http.request(request)
258
-
259
- @moreResults = false
260
-
261
- super(requestResponse, true)
262
- end
263
- end
264
-
265
-
266
- class ET_PostRest < ET_Constructor
267
- def initialize(authStub, endpoint, payload)
268
- authStub.refreshToken
269
-
270
- qs = {"access_token" => authStub.authToken}
271
- uri = URI.parse(endpoint)
272
- uri.query = URI.encode_www_form(qs)
273
- http = Net::HTTP.new(uri.host, uri.port)
274
- http.use_ssl = true
275
- request = Net::HTTP::Post.new(uri.request_uri)
276
- request.body = payload.to_json
277
- request.add_field "Content-Type", "application/json"
278
- requestResponse = http.request(request)
279
-
280
- super(requestResponse, true)
281
-
282
- end
283
- end
284
-
285
- class ET_PatchRest < ET_Constructor
286
- def initialize(authStub, endpoint, payload)
287
- authStub.refreshToken
288
-
289
- qs = {"access_token" => authStub.authToken}
290
- uri = URI.parse(endpoint)
291
- uri.query = URI.encode_www_form(qs)
292
- http = Net::HTTP.new(uri.host, uri.port)
293
- http.use_ssl = true
294
- request = Net::HTTP::Patch.new(uri.request_uri)
295
- request.body = payload.to_json
296
- request.add_field "Content-Type", "application/json"
297
- requestResponse = http.request(request)
298
- super(requestResponse, true)
299
-
300
- end
301
- end
302
-
303
- class ET_DeleteRest < ET_Constructor
304
- def initialize(authStub, endpoint)
305
- authStub.refreshToken
306
-
307
- qs = {"access_token" => authStub.authToken}
308
-
309
- uri = URI.parse(endpoint)
310
- uri.query = URI.encode_www_form(qs)
311
- http = Net::HTTP.new(uri.host, uri.port)
312
- http.use_ssl = true
313
- request = Net::HTTP::Delete.new(uri.request_uri)
314
- requestResponse = http.request(request)
315
- super(requestResponse, true)
316
-
317
- end
318
- end
319
-
320
- class ET_Campaign < ET_CUDSupportRest
321
- def initialize
322
- super
323
- @endpoint = 'https://www.exacttargetapis.com/hub/v1/campaigns/{id}'
324
- @urlProps = ["id"]
325
- @urlPropsRequired = []
326
- end
327
-
328
- class Asset < ET_CUDSupportRest
329
- def initialize
330
- super
331
- @endpoint = 'https://www.exacttargetapis.com/hub/v1/campaigns/{id}/assets/{assetId}'
332
- @urlProps = ["id", "assetId"]
333
- @urlPropsRequired = ["id"]
334
- end
335
- end
336
- end
337
-
338
17
  class ET_DataExtension < ET_CUDSupport
339
18
  attr_accessor :columns
340
19
 
@@ -556,17 +235,4 @@ end
556
235
  end
557
236
  end
558
237
  end
559
-
560
- class ET_TriggeredSend < ET_CUDSupport
561
- attr_accessor :subscribers
562
- def initialize
563
- super
564
- @obj = 'TriggeredSendDefinition'
565
- end
566
-
567
- def send
568
- @tscall = {"TriggeredSendDefinition" => @props, "Subscribers" => @subscribers}
569
- ET_Post.new(@authStub, "TriggeredSend", @tscall)
570
- end
571
- end
572
238
  =end
@@ -14,6 +14,7 @@ module FuelSDK
14
14
  def continue
15
15
  rsp = nil
16
16
  if more?
17
+ @request['options']['page'] = @results['page'].to_i + 1
17
18
  rsp = unpack @client.rest_get(@request['url'], @request['options'])
18
19
  else
19
20
  puts 'No more data'
@@ -1,3 +1,3 @@
1
1
  module FuelSDK
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fuelsdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: