commcare_api 0.1.0 → 0.2.0
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.
- checksums.yaml +4 -4
- data/README.md +10 -5
- data/lib/commcare_api.rb +36 -2
- data/lib/commcare_api/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4322550ad4a3e53f6e9388a4ed458495c18700aa
|
4
|
+
data.tar.gz: fb54c249c1a4249869bfd808ffe98973a265992d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5bdc99e28f71f00154d8d840c26b0277e499777d5f49159bd228a7d26662755b596e9411631a013a5dc517e7bf85cbf99727b0687f6daeffd5d17ab1ca03b8f3
|
7
|
+
data.tar.gz: e35b94ea9bfbf9dd04d160467aa75e6031265306961647009cfe80b6b7443144bcd503f8ac7686948dc610d1292a63a12e03d2b26fbdc856c6927db6c7700573
|
data/README.md
CHANGED
@@ -18,10 +18,15 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Supported APIs
|
20
20
|
|
21
|
-
* [List
|
22
|
-
* [Case
|
23
|
-
* [List
|
24
|
-
* [Form
|
21
|
+
* [List Cases](https://wiki.commcarehq.org/display/commcarepublic/List+Cases): `get_cases`
|
22
|
+
* [Case Data](https://wiki.commcarehq.org/display/commcarepublic/Case+Data): `get_case`
|
23
|
+
* [List Forms](https://wiki.commcarehq.org/display/commcarepublic/Form+Data): `get_forms`
|
24
|
+
* [Form Data](https://wiki.commcarehq.org/display/commcarepublic/Form+Data): `get_form`
|
25
|
+
* [List Groups](https://wiki.commcarehq.org/display/commcarepublic/List+Groups): `get_groups`
|
26
|
+
* [List Mobile Workers](https://wiki.commcarehq.org/display/commcarepublic/List+Mobile+Workers): `get_mobile_workers`, `get_mobile_worker`
|
27
|
+
* [List Web Users](https://wiki.commcarehq.org/display/commcarepublic/List+Web+Users): `get_web_users`, `get_web_user`
|
28
|
+
* [Data Forwarding (GET only)](https://wiki.commcarehq.org/display/commcarepublic/Data+Forwarding): `get_data_forwarding`
|
29
|
+
* [Application Structure](https://wiki.commcarehq.org/display/commcarepublic/Application+Structure+API): `get_application_structure`
|
25
30
|
|
26
31
|
## Usage
|
27
32
|
|
@@ -31,7 +36,7 @@ Or install it yourself as:
|
|
31
36
|
response = ccc.get_cases("my_domain", type: "my_case_type", date_modified_start: "2014-05-30", limit: 15)
|
32
37
|
puts response.body
|
33
38
|
|
34
|
-
Filters are added to the request with an options hash as shown above.
|
39
|
+
Filters are added to the request with an options hash as shown above. See [CommCare documentation](https://wiki.commcarehq.org/display/commcarepublic/CommCare+HQ+APIs) for possible filters.
|
35
40
|
|
36
41
|
## Contributing
|
37
42
|
|
data/lib/commcare_api.rb
CHANGED
@@ -8,10 +8,9 @@ module CommcareApi
|
|
8
8
|
|
9
9
|
class CommcareConnector
|
10
10
|
|
11
|
-
def initialize(user, password,
|
11
|
+
def initialize(user, password, version="0.5")
|
12
12
|
@user = user
|
13
13
|
@password = password
|
14
|
-
@format = format
|
15
14
|
@version = "v#{version}"
|
16
15
|
end
|
17
16
|
|
@@ -34,6 +33,41 @@ module CommcareApi
|
|
34
33
|
url = build_url(domain, "form/#{form_id}", options)
|
35
34
|
get_request(url)
|
36
35
|
end
|
36
|
+
|
37
|
+
def get_groups(domain, options = {})
|
38
|
+
url = build_url(domain, "group", options)
|
39
|
+
get_request(url)
|
40
|
+
end
|
41
|
+
|
42
|
+
def get_mobile_workers(domain, options = {})
|
43
|
+
url = build_url(domain, "user", options)
|
44
|
+
get_request(url)
|
45
|
+
end
|
46
|
+
|
47
|
+
def get_mobile_worker(domain, user_id, options = {})
|
48
|
+
url = build_url(domain, "user/#{user_id}", options)
|
49
|
+
get_request(url)
|
50
|
+
end
|
51
|
+
|
52
|
+
def get_web_users(domain)
|
53
|
+
url = build_url(domain, "web-user", {})
|
54
|
+
get_request(url)
|
55
|
+
end
|
56
|
+
|
57
|
+
def get_web_user(domain, user_id)
|
58
|
+
url = build_url(domain, "web-user/#{user_id}", {})
|
59
|
+
get_request(url)
|
60
|
+
end
|
61
|
+
|
62
|
+
def get_application_structure(domain)
|
63
|
+
url = build_url(domain, "application", {})
|
64
|
+
get_request(url)
|
65
|
+
end
|
66
|
+
|
67
|
+
def get_data_forwarding(domain)
|
68
|
+
url = build_url(domain, "data-forwarding", {})
|
69
|
+
get_request(url)
|
70
|
+
end
|
37
71
|
|
38
72
|
protected
|
39
73
|
|
data/lib/commcare_api/version.rb
CHANGED