pandarus 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module Pandarus
2
- VERSION = '0.3.1' unless defined?(Pandarus::VERSION)
2
+ VERSION = '0.4.0' unless defined?(Pandarus::VERSION)
3
3
  end
data/pandarus.gemspec CHANGED
@@ -22,6 +22,7 @@ Gem::Specification.new do |gem|
22
22
  gem.add_development_dependency "rake"
23
23
  gem.add_development_dependency "bundler", ">= 1.0.0"
24
24
  gem.add_development_dependency "rspec", "~> 2.6"
25
+ gem.add_development_dependency "webmock"
25
26
  gem.add_development_dependency "debugger"
26
27
  gem.add_development_dependency "pry"
27
28
 
@@ -0,0 +1,42 @@
1
+ require_relative 'spec_helper'
2
+ require 'webmock/rspec'
3
+ require 'pandarus'
4
+
5
+ describe Pandarus::Client do
6
+ let(:prefix) { "http://localhost:3000/api" }
7
+ let(:token) { "1~eBVJyX3QYgGmRMjp5CoDkiFdpdUDyICl14e2HiRWtSzwVrAUbh36mfUXZP7pAkxS" }
8
+ let(:client) { Pandarus::Client.new(opts) }
9
+
10
+ context "without overridden params" do
11
+ let(:opts) { { :prefix => prefix, :token => token } }
12
+
13
+ it "raises when args are too few" do
14
+ lambda { client.list_account_admins }.should raise_error
15
+ end
16
+
17
+ it "does not raise when args are correct" do
18
+ stub_json_request("http://localhost:3000/api/v1/accounts/1/admins", "[]")
19
+ lambda { client.list_account_admins(1) }.should_not raise_error
20
+ end
21
+ end
22
+
23
+ context "with overridden params" do
24
+ let(:opts) { { :account_id => 1, :prefix => prefix, :token => token } }
25
+
26
+ it "uses overridden param account_id" do
27
+ stub_json_request("http://localhost:3000/api/v1/accounts/1/admins", "[]")
28
+ lambda { client.list_account_admins }.should_not raise_error
29
+ end
30
+ end
31
+
32
+ def stub_json_request(url, body, method=:any)
33
+ stub_request(method, url).
34
+ to_return(
35
+ :status => 200,
36
+ :body => body,
37
+ :headers => {
38
+ 'Content-Type' => 'application/json; charset=utf-8'
39
+ }
40
+ )
41
+ end
42
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pandarus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-02-05 00:00:00.000000000 Z
12
+ date: 2014-04-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -59,6 +59,22 @@ dependencies:
59
59
  - - ~>
60
60
  - !ruby/object:Gem::Version
61
61
  version: '2.6'
62
+ - !ruby/object:Gem::Dependency
63
+ name: webmock
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
62
78
  - !ruby/object:Gem::Dependency
63
79
  name: debugger
64
80
  requirement: !ruby/object:Gem::Requirement
@@ -142,9 +158,9 @@ files:
142
158
  - lib/pandarus/models/assignment_group.rb
143
159
  - lib/pandarus/models/assignment_override.rb
144
160
  - lib/pandarus/models/avatar.rb
161
+ - lib/pandarus/models/calendar_event.rb
162
+ - lib/pandarus/models/calendar_link.rb
145
163
  - lib/pandarus/models/collaborator.rb
146
- - lib/pandarus/models/collection.rb
147
- - lib/pandarus/models/collection_item.rb
148
164
  - lib/pandarus/models/column_datum.rb
149
165
  - lib/pandarus/models/comm_message.rb
150
166
  - lib/pandarus/models/communication_channel.rb
@@ -158,10 +174,12 @@ files:
158
174
  - lib/pandarus/models/course.rb
159
175
  - lib/pandarus/models/course_event.rb
160
176
  - lib/pandarus/models/course_event_link.rb
177
+ - lib/pandarus/models/course_progress.rb
161
178
  - lib/pandarus/models/custom_column.rb
162
179
  - lib/pandarus/models/day.rb
163
180
  - lib/pandarus/models/discovery_url.rb
164
181
  - lib/pandarus/models/enrollment.rb
182
+ - lib/pandarus/models/enrollment_term.rb
165
183
  - lib/pandarus/models/external_feed.rb
166
184
  - lib/pandarus/models/external_tool_tag_attributes.rb
167
185
  - lib/pandarus/models/favorite.rb
@@ -174,6 +192,8 @@ files:
174
192
  - lib/pandarus/models/grade_change_event_links.rb
175
193
  - lib/pandarus/models/grader.rb
176
194
  - lib/pandarus/models/grading_rules.rb
195
+ - lib/pandarus/models/grading_scheme_entry.rb
196
+ - lib/pandarus/models/grading_standard.rb
177
197
  - lib/pandarus/models/group.rb
178
198
  - lib/pandarus/models/group_category.rb
179
199
  - lib/pandarus/models/group_membership.rb
@@ -194,6 +214,7 @@ files:
194
214
  - lib/pandarus/models/profile.rb
195
215
  - lib/pandarus/models/progress.rb
196
216
  - lib/pandarus/models/quiz.rb
217
+ - lib/pandarus/models/quiz_permissions.rb
197
218
  - lib/pandarus/models/quiz_question.rb
198
219
  - lib/pandarus/models/quiz_report.rb
199
220
  - lib/pandarus/models/report.rb
@@ -216,6 +237,7 @@ files:
216
237
  - lib/pandarus/version.rb
217
238
  - lib/pandarus.rb
218
239
  - spec/api_base_spec.rb
240
+ - spec/client_spec.rb
219
241
  - spec/sis_import_spec.rb
220
242
  - spec/spec_helper.rb
221
243
  - spec/user_spec.rb
@@ -246,6 +268,7 @@ specification_version: 3
246
268
  summary: REST APIs
247
269
  test_files:
248
270
  - spec/api_base_spec.rb
271
+ - spec/client_spec.rb
249
272
  - spec/sis_import_spec.rb
250
273
  - spec/spec_helper.rb
251
274
  - spec/user_spec.rb
@@ -1,22 +0,0 @@
1
- require "pandarus/model_base"
2
-
3
- # This is an autogenerated file. See readme.md.
4
- module Pandarus
5
- class Collection < ModelBase
6
- attr_accessor :id, :name, :visibility, :followed_by_user, :followers_count, :items_count
7
-
8
-
9
- def self.attribute_map
10
- {
11
- :id => {:external => "id", :container => false, :type => "Integer"},
12
- :name => {:external => "name", :container => false, :type => "String"},
13
- :visibility => {:external => "visibility", :container => false, :type => "String"},
14
- :followed_by_user => {:external => "followed_by_user", :container => false, :type => nil},
15
- :followers_count => {:external => "followers_count", :container => false, :type => "Integer"},
16
- :items_count => {:external => "items_count", :container => false, :type => "Integer"}
17
-
18
- }
19
- end
20
- end
21
- end
22
-
@@ -1,33 +0,0 @@
1
- require "pandarus/model_base"
2
-
3
- # This is an autogenerated file. See readme.md.
4
- module Pandarus
5
- class CollectionItem < ModelBase
6
- attr_accessor :id, :collection_id, :item_type, :link_url, :post_count, :upvote_count, :upvoted_by_user, :root_item_id, :image_url, :image_pending, :title, :description, :user_comment, :html_preview, :url, :created_at, :user
7
-
8
-
9
- def self.attribute_map
10
- {
11
- :id => {:external => "id", :container => false, :type => "Integer"},
12
- :collection_id => {:external => "collection_id", :container => false, :type => "Integer"},
13
- :item_type => {:external => "item_type", :container => false, :type => "String"},
14
- :link_url => {:external => "link_url", :container => false, :type => "String"},
15
- :post_count => {:external => "post_count", :container => false, :type => "Integer"},
16
- :upvote_count => {:external => "upvote_count", :container => false, :type => "Integer"},
17
- :upvoted_by_user => {:external => "upvoted_by_user", :container => false, :type => nil},
18
- :root_item_id => {:external => "root_item_id", :container => false, :type => "Integer"},
19
- :image_url => {:external => "image_url", :container => false, :type => "String"},
20
- :image_pending => {:external => "image_pending", :container => false, :type => nil},
21
- :title => {:external => "title", :container => false, :type => "String"},
22
- :description => {:external => "description", :container => false, :type => "String"},
23
- :user_comment => {:external => "user_comment", :container => false, :type => "String"},
24
- :html_preview => {:external => "html_preview", :container => false, :type => "String"},
25
- :url => {:external => "url", :container => false, :type => "String"},
26
- :created_at => {:external => "created_at", :container => false, :type => "DateTime"},
27
- :user => {:external => "user", :container => false, :type => "User"}
28
-
29
- }
30
- end
31
- end
32
- end
33
-