collegiatelink 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -17,6 +17,7 @@ module CollegiateLink
17
17
  }
18
18
  @opts = {
19
19
  sharedkey: sharedkey,
20
+ debug: true,
20
21
  }
21
22
  @@proxy = Net::HTTP
22
23
  end
@@ -40,8 +41,7 @@ module CollegiateLink
40
41
  # See CollegiateLink::Request#initialize for a list of optional parameters
41
42
  #
42
43
  def organizations(params = {})
43
- orgs = request('organization/list', params)
44
- orgs.map{ |o| CollegiateLink::Organization.parse(o.to_s) }
44
+ orgs = request('organization/list', CollegiateLink::Organization, params)
45
45
  end
46
46
 
47
47
  ##
@@ -65,30 +65,29 @@ module CollegiateLink
65
65
  params[:startdate] = params[:startdate].to_i * 1000
66
66
  params[:enddate] = params[:enddate].to_i * 1000
67
67
 
68
- events = request('event/list', params)
69
- events.map{ |o| CollegiateLink::Event.parse(o.to_s) }
68
+ events = request('event/list', CollegiateLink::Event, params)
70
69
  end
71
70
 
72
71
  def roster(id, params = {})
73
72
  params.merge!(:id => id)
74
73
 
75
- members = request('organization/roster', params)
76
- members.map{ |m| CollegiateLink::Member.parse(m.to_s) }
74
+ members = request('organization/roster', CollegiateLink::Member, params)
77
75
  end
78
76
 
79
77
  private
80
78
 
81
- def request(action, params = {})
79
+ def request(action, model, params = {})
82
80
  cl_request = CollegiateLink::Request.new(action, params.merge(@params), @opts)
83
81
  cl_resp = cl_request.perform
84
82
 
85
- all_items = cl_resp.items
83
+ all_items = cl_resp.items.map { |i| model.parse(i.to_s) }
86
84
 
87
85
  while cl_resp.has_next_page?
88
- cl_resp = cl_request.request_for_next_page.perform
89
- all_items += cl_resp.items
86
+ cl_request = cl_request.request_for_next_page
87
+ cl_resp = cl_request.perform
88
+ all_items += cl_resp.items.map { |i| model.parse(i.to_s) }
90
89
  end
91
-
90
+
92
91
  all_items
93
92
  end
94
93
  end
@@ -112,6 +112,8 @@ module CollegiateLink
112
112
  element :startdate, Integer
113
113
  element :userstartdate, Integer
114
114
  element :userenddate, Integer
115
+ element :positionTemplate, String
116
+ element :positionType, String
115
117
 
116
118
  def current?
117
119
  use_startdate = (userstartdate > 0) ? userstartdate : startdate
@@ -148,5 +150,9 @@ module CollegiateLink
148
150
  def active_positions
149
151
  positions.keep_if { |p| p.current? }
150
152
  end
153
+
154
+ def ==(other)
155
+ self.id == other.id
156
+ end
151
157
  end
152
158
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: collegiatelink
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
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: 2012-01-26 00:00:00.000000000 Z
12
+ date: 2012-02-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: guid