arbor 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b40b7e043331526b3f456b3152614a69a44dda7d
4
- data.tar.gz: f419b0cde4c1b386f6e44aa31aabf4181d908cde
3
+ metadata.gz: 64122a62f0b9e516158b03e8b5d266f657476f10
4
+ data.tar.gz: 268303a8e512a6c3c44b7a376fea5d0a34461ec9
5
5
  SHA512:
6
- metadata.gz: d4bddb63a2ebdcf5bef0dfd76f210d8d41ce36454018cfc375c9d8893598ae430d17a498e3ad523d5585833264f5925349469c9f61f0772a678eecee007a5b47
7
- data.tar.gz: b27e93494734cd5582eba13330782acf49e8902e70a10919247c13660817aab7bce2e8aa2c34ee18b60cb945f2a8ca95890cdf4e37ac2917d400deb96307d0b2
6
+ metadata.gz: 7d4bdd3df1812a5d9eef4c1d42a681f903bc40a810a008a1599872a7fb75b1c0d349ce9f59a798f6eb88aa621586f502688dad9bb8f95be2b6b9090796357d7b
7
+ data.tar.gz: 645f9481964bab457316396b6371db56efae7e8a997eab376121ead4d9cced1ef6846649eb0b2cdb76bb83d28bbcf82ad9bb15a86fffbb904164fcd5af03bc5c
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Ruby Interface for Arbor API
2
2
 
3
- A Ruby interface to [Arbor Education API](http://www.arbor-education.com/en/developers-stakeholder).
3
+ A Ruby interface to [Arbor Education API](http://www.arbor-education.com/en/developers).
4
4
 
5
5
  ## Installation
6
6
 
data/lib/arbor/api.rb CHANGED
@@ -18,6 +18,19 @@ module Arbor
18
18
  unmarshall_data(data, resource)
19
19
  end
20
20
 
21
+ def changelog(type, from_revision = 0)
22
+ resource = parse_resource_name(type)
23
+
24
+ data = get("/rest-v2/#{resource.dasherize.tr('/', '_')}/changelog?from-revision=#{from_revision}")
25
+
26
+ data['changes'].each do |c|
27
+ c['entityType'] = "change"
28
+ @highest_revision = [highest_revision, BigDecimal.new(c['toRevision'])].max
29
+ end
30
+
31
+ unmarshall_data(data, 'changes')
32
+ end
33
+
21
34
  private
22
35
  def unmarshall_data(data, resource)
23
36
  singular_resource = resource.singularize.camelize(:lower).gsub('::', '_')
data/lib/arbor/client.rb CHANGED
@@ -7,13 +7,14 @@ module Arbor
7
7
  class Client
8
8
  include Arbor::API
9
9
  include Arbor::Utils
10
- attr_accessor :host, :username, :password, :settings
10
+ attr_accessor :host, :username, :password, :settings, :highest_revision
11
11
 
12
12
  def initialize(*args)
13
13
  @settings = args.last.is_a?(Hash) ? args.pop : {}
14
14
  raise ArgumentError, "must supply a subdomain, username and password" if args.length < 3
15
15
  subdomain, @username, @password = args
16
16
  @host = "https://#{subdomain}.uk.arbor.sc"
17
+ @highest_revision = 0
17
18
  end
18
19
 
19
20
  [:get, :post].each do |verb|
@@ -6,7 +6,7 @@ module Arbor
6
6
  def self.create(type = :unknown)
7
7
  class_name = type.to_s.classify
8
8
 
9
- unless Arbor::Model.const_defined?(class_name)
9
+ unless Arbor::Model.const_defined?(class_name, false)
10
10
  type_class = Class.new(Arbor::Model::Abstract)
11
11
  Arbor::Model.const_set(class_name, type_class)
12
12
  end
data/lib/arbor/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Arbor
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
data/lib/arbor.rb CHANGED
@@ -145,5 +145,6 @@ module Arbor
145
145
  :triggers, :unenrolment_reasons, :universities, :university_staffs,
146
146
  :usage_log_entries, :users, :user_defined_fields, :user_defined_records,
147
147
  :user_notifications, :user_roles, :user_role_assignments, :vision_tests,
148
- :widgets, :widget_types, :workitems, :workitem_assignments, :"uk_dfe/upn_assignments"]
148
+ :widgets, :widget_types, :workitems, :workitem_assignments,
149
+ :"uk_dfe/upn_assignments", :changes]
149
150
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arbor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Campbell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-07 00:00:00.000000000 Z
11
+ date: 2016-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport