dhis2 2.3.7 → 2.3.8

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: 2db2c0f90a0889c1c8d69bbba0d0960289e9afd7
4
- data.tar.gz: 7a7b013a8d2ced4b77c939cbcac23a949f68f48c
3
+ metadata.gz: 31237affd866d0b4d8f2f3d206ee0f4e87fc0887
4
+ data.tar.gz: 3342245ed20209d6cf8d14b43b6afd84c1a2195f
5
5
  SHA512:
6
- metadata.gz: ed252220cb1844dd29924f8be097a61f011d0ffc33682f0d19bb866693f16071356df7f6edb2739d2a0187eae3bf9d12f04b8e9dee71ac29431f6441a102fd6d
7
- data.tar.gz: 910e88d474e0ae7452d7cc4e83f122ecf6858f326769bf188d1dcfae0f3598e561b54bfcfeffb39459c94e4ecfe6eedb0a1c553fea60bea0b885d7e36d00f954
6
+ metadata.gz: 7b92380e27981c30c95779d27b2cfa9310280c29e672859428a638e7bd1f801ca27d4c1106d8ba3ae9cda577e7785f575d43c9dde777a725576cda4047100b39
7
+ data.tar.gz: a0cd65724a439e6467aac2673bf21bc853cb1ebdc0d21ca3d2dafccb0a1be7c7db0e4a3719bf3372b2a98e814a318e842bc3c8746965f20b893c31a15305c8f3
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.3.0
1
+ 2.3.1
data/.travis.yml CHANGED
@@ -1,5 +1,13 @@
1
+ env:
2
+ global:
3
+ - GIT_COMMITTED_AT=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then git log -1 --pretty=format:%ct; else git log -1 --skip 1 --pretty=format:%ct; fi)
1
4
  sudo: false
2
5
  language: ruby
3
- rvm:
4
- - 2.3.0
6
+ cache: bundler
5
7
  before_install: gem install bundler -v 1.12.5
8
+ before_script:
9
+ - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
10
+ - chmod +x ./cc-test-reporter
11
+ script:
12
+ - "bundle exec rspec"
13
+ - if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT; fi
data/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  <a href="https://codeclimate.com/github/BLSQ/dhis2"><img src="https://codeclimate.com/github/BLSQ/dhis2/badges/gpa.svg" /></a>
4
4
  [![Gem Version](https://badge.fury.io/rb/dhis2.svg)](https://badge.fury.io/rb/dhis2)
5
+ [![Build Status](https://travis-ci.org/BLSQ/dhis2.svg?branch=master)](https://travis-ci.org/BLSQ/dhis2)
6
+ [![Test Coverage](https://codeclimate.com/github/BLSQ/dhis2/badges/coverage.svg)](https://codeclimate.com/github/BLSQ/dhis2/coverage)
5
7
 
6
8
  Basic DHIS2 API client for Ruby.
7
9
 
@@ -144,6 +146,7 @@ The API is currently limited to actions on the following elements:
144
146
  * `SystemInfo`
145
147
  * `Attribute`
146
148
  * `Indicator`
149
+ * `IndicatorGroup`
147
150
  * `DataElementGroup`
148
151
  * `User`
149
152
  * `Report`
data/lib/dhis2.rb CHANGED
@@ -27,6 +27,7 @@ require_relative "dhis2/api/data_value_set"
27
27
  require_relative "dhis2/api/data_value"
28
28
  require_relative "dhis2/api/organisation_unit_level"
29
29
  require_relative "dhis2/api/indicator"
30
+ require_relative "dhis2/api/indicator_group"
30
31
  require_relative "dhis2/api/analytic"
31
32
  require_relative "dhis2/api/organisation_unit_group"
32
33
  require_relative "dhis2/api/organisation_unit_group_set"
@@ -41,6 +42,15 @@ require_relative "dhis2/api/report"
41
42
 
42
43
  module Dhis2
43
44
  class << self
45
+ def play(debug = false)
46
+ Dhis2::Client.new(
47
+ url: "https://play.dhis2.org/demo/",
48
+ user: "admin",
49
+ password: "district",
50
+ debug: debug
51
+ )
52
+ end
53
+
44
54
  def client
45
55
  if @client.nil?
46
56
  @client ||= if config.user.nil? && config.password.nil?
@@ -48,7 +58,8 @@ module Dhis2
48
58
  else
49
59
  Dhis2::Client.new(url: config.url,
50
60
  user: config.user,
51
- password: config.password)
61
+ password: config.password,
62
+ debug: config.debug)
52
63
  end
53
64
  else
54
65
  @client
@@ -51,7 +51,7 @@ module Dhis2
51
51
  end
52
52
 
53
53
  def build_where_url(options)
54
- children = options[:children] || true
54
+ children = options[:children].nil? ? true : options[:children]
55
55
  organisation_unit_id = options[:organisation_unit]
56
56
  organisation_unit_group = options[:organisation_unit_group]
57
57
  if organisation_unit_id
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dhis2
4
+ module Api
5
+ class IndicatorGroup < Base
6
+ end
7
+ end
8
+ end
@@ -9,6 +9,12 @@ module Dhis2
9
9
  end
10
10
  end
11
11
 
12
+ def group_set_ids
13
+ [organisation_unit_group_set, group_sets].flatten.compact.map do |group_set|
14
+ group_set["id"]
15
+ end
16
+ end
17
+
12
18
  class << self
13
19
  def create(client, orgunit_groups)
14
20
  orgunit_groups = [orgunit_groups].flatten
data/lib/dhis2/client.rb CHANGED
@@ -60,6 +60,7 @@ module Dhis2
60
60
  @base_url = url.to_s
61
61
  @verify_ssl = options[:no_ssl_verification] ? OpenSSL::SSL::VERIFY_NONE : OpenSSL::SSL::VERIFY_PEER
62
62
  @timeout = options[:timeout] ? options[:timeout].to_i : 120
63
+ @debug = options[:debug] && options[:debug] == true
63
64
  end
64
65
  end
65
66
 
@@ -96,8 +97,12 @@ module Dhis2
96
97
  }
97
98
 
98
99
  raw_response = RestClient::Request.execute(query)
99
- response = raw_response.nil? || raw_response == "" ? {} : JSON.parse(raw_response)
100
- response = self.class.deep_change_case(response, :underscore)
100
+
101
+ response = raw_response.nil? || raw_response == "" ? {} : JSON.parse(raw_response)
102
+
103
+ puts [raw_response.request.url, query[:payload], response].join("\t") if @debug
104
+
105
+ response = self.class.deep_change_case(response, :underscore)
101
106
 
102
107
  if response.class == Hash && response["import_type_summaries"] &&
103
108
  response["import_type_summaries"][0] &&
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Dhis2
4
4
  class Configuration
5
- attr_accessor :url, :user, :password
5
+ attr_accessor :url, :user, :password, :debug
6
6
  end
7
7
  end
data/lib/dhis2/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dhis2
4
- VERSION = "2.3.7"
4
+ VERSION = "2.3.8"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dhis2
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.7
4
+ version: 2.3.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Van Aken
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-08-07 00:00:00.000000000 Z
11
+ date: 2017-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -204,6 +204,7 @@ files:
204
204
  - lib/dhis2/api/data_value_set.rb
205
205
  - lib/dhis2/api/event.rb
206
206
  - lib/dhis2/api/indicator.rb
207
+ - lib/dhis2/api/indicator_group.rb
207
208
  - lib/dhis2/api/organisation_unit.rb
208
209
  - lib/dhis2/api/organisation_unit_group.rb
209
210
  - lib/dhis2/api/organisation_unit_group_set.rb