bloomerang_api 0.2.2 → 1.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 12419c1537204bdc71893c92afe16c7b2a289e01c85ce54bb5abcbe64f98f89f
4
- data.tar.gz: f574f0aab37184607b8db02121e3d405fb61ca2a362b710b74f5719dd8032d82
3
+ metadata.gz: 9903ebd5cdcf4b4391848bafdbb4d9efc27425747fdd9cae0708b8e27face094
4
+ data.tar.gz: 0306a903c3af7793c1d0818a825977d272589eae65147b47202ca1ae422c0771
5
5
  SHA512:
6
- metadata.gz: 3304cdfacf46810a4cbf16a03959626792734d8ded999c85b70707d407927f14239403f98c1a6d579e107c2dfaf20db575c501919c2e96812965765f1660b427
7
- data.tar.gz: 05f2d08d94b4cb4a9e4d98641b45a94491f42e108e9ed912f4256adc2abf97b3c7067702389d5e6839bae8c1df5e9f2c2d72b0ee229a13d2aff3aa26dc373a54
6
+ metadata.gz: 40ac8a464c0c2a25d7556c86702a8d6e7c023a62adaf49515f81fa3072f53b05805c7257b4e56b6f2c99e7470f96888b6b5596e979c5b8439ad2c54fb9040c08
7
+ data.tar.gz: 0dd925a4a930586421519f2fbf5cf939d2b20fd29756e7606cb8079309f06de5059578babd326bfcbce652569e85fbf60e32f1a70d17b56b53d7e1e4b1c6732d
data/README.md CHANGED
@@ -23,7 +23,7 @@ This gem adds support [__all__ other endpoints](https://github.com/chiperific/bl
23
23
  Add this line to your application's Gemfile:
24
24
 
25
25
  ```ruby
26
- gem "bloomerang_api", "~> 0.2"
26
+ gem "bloomerang_api", "~> 1.0"
27
27
  ```
28
28
 
29
29
  And then execute:
@@ -66,6 +66,30 @@ Or install it yourself as:
66
66
  $ rails generate bloomerang:initializer
67
67
  ```
68
68
 
69
+ This will create the file `./config/initializers/bloomerang.rb` where you can set your API key:
70
+
71
+ ```ruby
72
+ require 'bloomerang'
73
+
74
+ Bloomerang.configure do |config|
75
+ ### Set your Bloomerang API key:
76
+ # Generate your v2.0 API key from your Bloomerang user settings:
77
+ # https://crm.bloomerang.co/Settings/User/Edit
78
+ #
79
+ # UNSECURE: DO NOT ADD THE KEY DIRECTLY TO THIS FILE!
80
+ # It will be exposed in your source code.
81
+ # Instead, use a secure method to store your API key
82
+ #
83
+ # Rails credentials example (preferred):
84
+ # Learn about encrypted credentials: https://edgeguides.rubyonrails.org/security.html#custom-credentials
85
+ # config.api_key = Rails.application.credentials.dig(:bloomerang, :api_key)
86
+ #
87
+ # ENV or dotenv example:
88
+ # Learn about dotenv gem: https://github.com/bkeepers/dotenv
89
+ # config.api_key = ENV["BLOOMERANG_API_KEY"]
90
+ end
91
+ ```
92
+
69
93
  ### WARNING: NO SANDBOX, PRODUCTION ONLY
70
94
 
71
95
  Bloomerang does not offer a sandbox environment or any way to test API calls without actually affecting your production data.
@@ -80,7 +104,7 @@ The standard structure of all endpoints is as follows:
80
104
 
81
105
  - Reading records:
82
106
  - `#fetch`: a GET request that returns a batch of records, 50 by default (see paging/batching below for more)
83
- - `#get`: a GET request returns a single record that matches the provided ID
107
+ - `#show`: a GET request returns a single record that matches the provided ID
84
108
 
85
109
  - Creating, updating and deleting records:
86
110
  - `#create`: a POST request that creates a record based on the provided `body` variable.
@@ -26,7 +26,7 @@ module Bloomerang
26
26
  # take integer, default: 50, simple paging system
27
27
  # constituent array[integer], separated by pipes: "1|2|3"
28
28
  # id array[integer], separated by pipes: "1|2|3"
29
- def fetch(params = {})
29
+ def self.fetch(params = {})
30
30
  get("addresses", params)
31
31
  end
32
32
 
@@ -35,7 +35,7 @@ module Bloomerang
35
35
  #
36
36
  ## Params:
37
37
  # id integer
38
- def get(id)
38
+ def self.show(id)
39
39
  get("addresses/#{id}")
40
40
  end
41
41
 
@@ -44,7 +44,7 @@ module Bloomerang
44
44
  #
45
45
  # Params:
46
46
  # body see API for fields
47
- def create(body)
47
+ def self.create(body)
48
48
  post("address", {}, body)
49
49
  end
50
50
 
@@ -54,7 +54,7 @@ module Bloomerang
54
54
  # Params:
55
55
  # id integer
56
56
  # body see API for fields
57
- def update(id, body)
57
+ def self.update(id, body)
58
58
  put("address/#{id}", {}, body)
59
59
  end
60
60
 
@@ -63,7 +63,7 @@ module Bloomerang
63
63
  #
64
64
  # Params:
65
65
  # id integer
66
- def delete(id)
66
+ def self.delete(id)
67
67
  delete("address/#{id}", {})
68
68
  end
69
69
  end
@@ -19,7 +19,7 @@ module Bloomerang
19
19
  # id array[integer], separated by pipes: "1|2|3"
20
20
  # isActive boolean, Filters to either active or inactive appeals
21
21
  # search string, Filters to appeals with names that match any part of the search string
22
- def fetch(params)
22
+ def self.fetch(params)
23
23
  get("appeals", params)
24
24
  end
25
25
 
@@ -28,7 +28,7 @@ module Bloomerang
28
28
  #
29
29
  # Params:
30
30
  # id integer
31
- def get(id)
31
+ def self.show(id)
32
32
  get("appeal/#{id}")
33
33
  end
34
34
 
@@ -37,7 +37,7 @@ module Bloomerang
37
37
  #
38
38
  # Params:
39
39
  # body see API for fields
40
- def create(body)
40
+ def self.create(body)
41
41
  post("appeal", {}, body)
42
42
  end
43
43
 
@@ -47,7 +47,7 @@ module Bloomerang
47
47
  # Params:
48
48
  # id integer
49
49
  # body see API for fields
50
- def update(id, body)
50
+ def self.update(id, body)
51
51
  put("appeal/#{id}", {}, body)
52
52
  end
53
53
  end
@@ -7,40 +7,39 @@ module Bloomerang
7
7
  ## Bloomerang::Base
8
8
  # Primary interface for Faraday
9
9
  class Base
10
- API_URL = "https://api.bloomerang.co/v2"
11
- API_KEY = ENV["BLOOMERANG_API_KEY"]
12
-
13
- def get(path, params = {})
10
+ def self.get(path, params = {})
14
11
  response = connection(params).get(path)
15
12
  JSON.parse response.body
16
13
  end
17
14
 
18
- def delete(path, params = {})
15
+ def self.delete(path, params = {})
19
16
  response = connection(params).delete(path)
20
17
  JSON.parse response.body
21
18
  end
22
19
 
23
- def post(path, params, body)
20
+ def self.post(path, params, body)
24
21
  response = connection(params).post(path, body.to_json)
25
22
  JSON.parse response.body
26
23
  end
27
24
 
28
- def put(path, params, body)
25
+ def self.put(path, params, body)
29
26
  response = connection(params).put(path, body.to_json)
30
27
  JSON.parse response.body
31
28
  end
32
29
 
33
- private
34
-
35
- def connection(params)
36
- Faraday.new(
37
- url: API_URL,
38
- headers: {
39
- "Content-Type" => "application/json",
40
- "X-API-Key" => API_KEY
41
- },
42
- params: params
43
- )
30
+ class << self
31
+ private
32
+
33
+ def connection(params)
34
+ Faraday.new(
35
+ url: Bloomerang.configuration.api_url,
36
+ headers: {
37
+ "Content-Type" => "application/json",
38
+ "X-API-Key" => Bloomerang.configuration.api_key
39
+ },
40
+ params: params
41
+ )
42
+ end
44
43
  end
45
44
  end
46
45
  end
@@ -26,7 +26,7 @@ module Bloomerang
26
26
  # IsActive boolean
27
27
  # search string, returns matches on any part of name
28
28
  # hasGoal boolean, have either non-zero-dollar or zero-dollar goals
29
- def fetch(params = {})
29
+ def self.fetch(params = {})
30
30
  get("campaigns", params)
31
31
  end
32
32
 
@@ -35,7 +35,7 @@ module Bloomerang
35
35
  #
36
36
  # Params:
37
37
  # id integer
38
- def get(id)
38
+ def self.show(id)
39
39
  get("campaign/#{id}")
40
40
  end
41
41
 
@@ -45,7 +45,7 @@ module Bloomerang
45
45
  ## Params:
46
46
  # id integer
47
47
  # body JSON object, see API for fields
48
- def update(id, body)
48
+ def self.update(id, body)
49
49
  put("campaign/#{id}", {}, body)
50
50
  end
51
51
 
@@ -54,7 +54,7 @@ module Bloomerang
54
54
  #
55
55
  ## Params:
56
56
  # body JSON object, see API for fields
57
- def create(body)
57
+ def self.create(body)
58
58
  post("campaign", {}, body)
59
59
  end
60
60
 
@@ -64,7 +64,7 @@ module Bloomerang
64
64
  # Returns: JSON: The list of campaigns that are active and have a non-zero goal.
65
65
  #
66
66
  ## Params: none
67
- def refresh_summaries
67
+ def self.refresh_summaries
68
68
  get("campaigns/refreshsummaries")
69
69
  end
70
70
  end
@@ -1,7 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bloomerang
4
+ ## Bloomerang::Configuration
4
5
  class Configuration
5
- attr_accessor :api_key
6
+ attr_accessor :api_key, :api_url
7
+
8
+ def initialize
9
+ @api_url = "https://api.bloomerang.co/v2"
10
+ @api_key = nil
11
+ end
6
12
  end
7
13
  end
@@ -53,8 +53,6 @@ module Bloomerang
53
53
  # CustomValues array[Objects], Objects are either OneValueAssignment or MultipleValueAssignments
54
54
  # AuditTrail AuditTrail (Object)
55
55
  class Constituent < Base
56
- # for backwards compatability
57
-
58
56
  ### Fetch all constituents
59
57
  ## https://bloomerang.co/product/integrations-data-management/api/rest-api/#/Constituents/get_constituents
60
58
  #
@@ -67,8 +65,7 @@ module Bloomerang
67
65
  # id array[integer], separated by pipes: "1|2|3"
68
66
  # orderBy string, Available values : Id (default), CreatedDate, LastModifiedDate
69
67
  # orderDirection string, Available values : Asc, Desc
70
- def fetch(params = {})
71
- # TODO: BREAKING CHANGE: used to accept no arguments
68
+ def self.fetch(params = {})
72
69
  get("constituents", params)
73
70
  end
74
71
 
@@ -77,7 +74,7 @@ module Bloomerang
77
74
  #
78
75
  # Params:
79
76
  # id integer
80
- def get(id)
77
+ def self.show(id)
81
78
  get("constituent/#{id}")
82
79
  end
83
80
 
@@ -90,7 +87,7 @@ module Bloomerang
90
87
  # id integer
91
88
  #
92
89
  # Returns: array of Relationships
93
- def fetch_relationships(id, params = {})
90
+ def self.fetch_relationships(id, params = {})
94
91
  get("constituent/#{id}/relationships", params)
95
92
  end
96
93
 
@@ -104,7 +101,7 @@ module Bloomerang
104
101
  # id integer
105
102
  #
106
103
  # Returns: paged list of TimelineEntrySummary models
107
- def fetch_timeline(id, params = {})
104
+ def self.fetch_timeline(id, params = {})
108
105
  get("constituent/#{id}/timeline", params)
109
106
  end
110
107
 
@@ -114,7 +111,7 @@ module Bloomerang
114
111
  # Params:
115
112
  # id integer
116
113
  # body see API for fields
117
- def update_communication_settings(id, body)
114
+ def self.update_communication_settings(id, body)
118
115
  put("/constituent/#{id}/updateCommunicationSettings", {}, body)
119
116
  end
120
117
 
@@ -125,7 +122,7 @@ module Bloomerang
125
122
  # skip integer, default: 0, simple paging system
126
123
  # take integer, default: 50, simple paging system
127
124
  # search string, searches on Full Name with
128
- def search(params = {})
125
+ def self.search(params = {})
129
126
  get("constituents/search", params)
130
127
  end
131
128
 
@@ -144,7 +141,7 @@ module Bloomerang
144
141
  # there is a create-only endpoint, but
145
142
  # given the risk of duplicate records, this should be the default method
146
143
  # for create-only over merge-or-create
147
- def create(body)
144
+ def self.create(body)
148
145
  # "When merging, the database will look for a possible duplicate defined as a
149
146
  # name plus one piece of contact info (address, email, or phone). If a duplicate
150
147
  # is found, the data passed in will be merged into an existing constituent.
@@ -167,7 +164,7 @@ module Bloomerang
167
164
  # A more secure pattern would be to create the Constituent
168
165
  # then use the returned Constituent ID to check for Emails, Addresses and Phones,
169
166
  # and add records if necessary
170
- def create_with_secondary(body)
167
+ def self.create_with_secondary(body)
171
168
  post("constituent", {}, body)
172
169
  end
173
170
 
@@ -177,7 +174,7 @@ module Bloomerang
177
174
  # Params:
178
175
  # id integer
179
176
  # body see API for fields
180
- def update(id, body)
177
+ def self.update(id, body)
181
178
  put("constituent/#{id}", {}, body)
182
179
  end
183
180
 
@@ -190,7 +187,7 @@ module Bloomerang
190
187
  # NOTE: There is a GET version as well,
191
188
  # but POST was chosen for future Model usage
192
189
  # e.g. body = Constituent.duplicate_check_attributes
193
- def find_duplicates(body)
190
+ def self.find_duplicates(body)
194
191
  post("constituent/duplicates", {}, body)
195
192
  end
196
193
 
@@ -199,7 +196,7 @@ module Bloomerang
199
196
  #
200
197
  # Params:
201
198
  # id integer
202
- def delete(id)
199
+ def self.delete(id)
203
200
  delete("constituent/#{id}")
204
201
  end
205
202
  end
@@ -18,7 +18,7 @@ module Bloomerang
18
18
  #
19
19
  # Params:
20
20
  # type string, Available values: Constituent, Transaction, Interaction, Note, Benevon
21
- def categories(type)
21
+ def self.categories(type)
22
22
  get("/customFieldCategories/#{type}/")
23
23
  end
24
24
 
@@ -28,7 +28,7 @@ module Bloomerang
28
28
  # Params:
29
29
  # type string, Available values: Constituent, Transaction, Interaction, Note, Benevon
30
30
  # isActive boolean, Default value: true
31
- def fields(type, params = {})
31
+ def self.fields(type, params = {})
32
32
  get("/customFields/#{type}/", params)
33
33
  end
34
34
 
@@ -38,7 +38,7 @@ module Bloomerang
38
38
  # Params:
39
39
  # type string, Available values : Constituent, Transaction, Interaction, Note, Benevon
40
40
  # isActive boolean, Default value: true
41
- def values(type, params = {})
41
+ def self.values(type, params = {})
42
42
  get("/customValues/#{type}/", params)
43
43
  end
44
44
 
@@ -49,7 +49,7 @@ module Bloomerang
49
49
  # type string, Available values : Constituent, Transaction, Interaction, Note, Benevon
50
50
  # fieldId integer
51
51
  # isActive boolean, Default value: true
52
- def values_by_field(type, field_id, params = {})
52
+ def self.values_by_field(type, field_id, params = {})
53
53
  get("/customValues/#{type}/#{field_id}", params)
54
54
  end
55
55
  end
@@ -20,7 +20,7 @@ module Bloomerang
20
20
  # take integer, default: 50, simple paging system
21
21
  # constituent array[integer], separated by pipes: "1|2|3"
22
22
  # id array[integer], separated by pipes: "1|2|3"
23
- def fetch(params = {})
23
+ def self.fetch(params = {})
24
24
  get("emails", params)
25
25
  end
26
26
 
@@ -29,7 +29,7 @@ module Bloomerang
29
29
  #
30
30
  # Params:
31
31
  # id integer
32
- def get(id)
32
+ def self.show(id)
33
33
  get("email/#{id}")
34
34
  end
35
35
 
@@ -38,7 +38,7 @@ module Bloomerang
38
38
  #
39
39
  # Params:
40
40
  # body JSON object, see API for fields
41
- def create(body)
41
+ def self.create(body)
42
42
  post("email", {}, body)
43
43
  end
44
44
 
@@ -48,7 +48,7 @@ module Bloomerang
48
48
  # Params:
49
49
  # id integer
50
50
  # body JSON object, see API for fields
51
- def update(id, body)
51
+ def self.update(id, body)
52
52
  put("email/#{id}", {}, body)
53
53
  end
54
54
 
@@ -57,7 +57,7 @@ module Bloomerang
57
57
  #
58
58
  # Params:
59
59
  # id integer
60
- def delete(id)
60
+ def self.delete(id)
61
61
  delete("email/#{id}")
62
62
  end
63
63
  end
@@ -20,7 +20,7 @@ module Bloomerang
20
20
  # take integer, default: 50, simple paging system
21
21
  # id array[integer], separated by pipes: "1|2|3"
22
22
  # isActive boolean
23
- def fetch(params = {})
23
+ def self.fetch(params = {})
24
24
  get("emailInterests", params)
25
25
  end
26
26
 
@@ -29,7 +29,7 @@ module Bloomerang
29
29
  #
30
30
  # Params:
31
31
  # id integer
32
- def get(id)
32
+ def self.show(id)
33
33
  get("emailInterest/#{id}")
34
34
  end
35
35
  end
@@ -20,7 +20,7 @@ module Bloomerang
20
20
  # id array[integer], separated by pipes: "1|2|3"
21
21
  # isActive boolean
22
22
  # search string, Filters to funds with names that match any part of the search string
23
- def fetch(params = {})
23
+ def self.fetch(params = {})
24
24
  get("funds", params)
25
25
  end
26
26
 
@@ -29,7 +29,7 @@ module Bloomerang
29
29
  #
30
30
  # Params:
31
31
  # id integer
32
- def get(id)
32
+ def self.show(id)
33
33
  get("fund/#{id}")
34
34
  end
35
35
 
@@ -38,7 +38,7 @@ module Bloomerang
38
38
  #
39
39
  # Params:
40
40
  # body JSON object, see API for fields
41
- def create(body)
41
+ def self.create(body)
42
42
  post("fund", {}, body)
43
43
  end
44
44
 
@@ -48,7 +48,7 @@ module Bloomerang
48
48
  # Params:
49
49
  # id integer
50
50
  # body JSON object, see API for fields
51
- def update(id, body)
51
+ def self.update(id, body)
52
52
  put("fund/#{id}", {}, body)
53
53
  end
54
54
  end
@@ -28,7 +28,7 @@ module Bloomerang
28
28
  # take integer, default: 50, simple paging system
29
29
  # lastModified string, date in iso8601 format, Filters to constituents last modified after the specified date
30
30
  # id array[integer], separated by pipes: "1|2|3"
31
- def fetch(params = {})
31
+ def self.fetch(params = {})
32
32
  get("households", params)
33
33
  end
34
34
 
@@ -37,7 +37,7 @@ module Bloomerang
37
37
  #
38
38
  # Params:
39
39
  # id integer
40
- def get(id)
40
+ def self.show(id)
41
41
  get("household/#{id}")
42
42
  end
43
43
 
@@ -48,7 +48,7 @@ module Bloomerang
48
48
  # skip integer, default: 0, simple paging system
49
49
  # take integer, default: 50, simple paging system
50
50
  # search string, searches on household name and constituent full name, matches any part of string
51
- def search(params = {})
51
+ def self.search(params = {})
52
52
  # TODO: BREAKING CHANGE: query changed to params
53
53
  Constituent.search(params)
54
54
  end
@@ -58,7 +58,7 @@ module Bloomerang
58
58
  #
59
59
  # Params:
60
60
  # body JSON object, see API for fields
61
- def create(body)
61
+ def self.create(body)
62
62
  post("household", {}, body)
63
63
  end
64
64
 
@@ -68,7 +68,7 @@ module Bloomerang
68
68
  # Params:
69
69
  # id integer
70
70
  # body JSON object, see API for fields
71
- def update(id, body)
71
+ def self.update(id, body)
72
72
  put("household/#{id}", {}, body)
73
73
  end
74
74
 
@@ -77,7 +77,7 @@ module Bloomerang
77
77
  #
78
78
  # Params:
79
79
  # id integer
80
- def delete(id)
80
+ def self.delete(id)
81
81
  delete("household/#{id}")
82
82
  end
83
83
 
@@ -87,7 +87,7 @@ module Bloomerang
87
87
  # Params:
88
88
  # id integer
89
89
  # body JSON object, see API for fields
90
- def update_communication_settings(id, body)
90
+ def self.update_communication_settings(id, body)
91
91
  put("household/#{id}/updateCommunicationSettings", {}, body)
92
92
  end
93
93
  end
@@ -38,7 +38,7 @@ module Bloomerang
38
38
  # id array[integer], separated by pipes: "1|2|3"
39
39
  # orderBy string, Available values : Id (default), CreatedDate, LastModifiedDate
40
40
  # orderDirection string, Available values : Asc, Desc
41
- def fetch(params = {})
41
+ def self.fetch(params = {})
42
42
  get("interactions", params)
43
43
  end
44
44
 
@@ -47,7 +47,7 @@ module Bloomerang
47
47
  #
48
48
  # Params:
49
49
  # body JSON object, see API for fields
50
- def create(body)
50
+ def self.create(body)
51
51
  post("interaction", {}, body)
52
52
  end
53
53
 
@@ -56,7 +56,7 @@ module Bloomerang
56
56
  #
57
57
  # Params:
58
58
  # id integer
59
- def get(id)
59
+ def self.show(id)
60
60
  get("interaction/#{id}")
61
61
  end
62
62
 
@@ -66,7 +66,7 @@ module Bloomerang
66
66
  # Params:
67
67
  # id integer
68
68
  # body JSON object, see API for fields
69
- def update(id, body)
69
+ def self.update(id, body)
70
70
  put("interaction/#{id}", {}, body)
71
71
  end
72
72
 
@@ -75,7 +75,7 @@ module Bloomerang
75
75
  #
76
76
  # Params:
77
77
  # id integer
78
- def delete(id)
78
+ def self.delete(id)
79
79
  delete("interaction/#{id}")
80
80
  end
81
81
  end
@@ -21,7 +21,7 @@ module Bloomerang
21
21
  # id array[integer], separated by pipes: "1|2|3"
22
22
  # orderBy string, Available values : Id (default), CreatedDate, LastModifiedDate
23
23
  # orderDirection string, Available values : Asc, Desc
24
- def fetch(params = {})
24
+ def self.fetch(params = {})
25
25
  get("notes", params)
26
26
  end
27
27
 
@@ -30,7 +30,7 @@ module Bloomerang
30
30
  #
31
31
  # Params:
32
32
  # body JSON object, see API for fields
33
- def create(body)
33
+ def self.create(body)
34
34
  post("note", {}, body)
35
35
  end
36
36
 
@@ -39,7 +39,7 @@ module Bloomerang
39
39
  #
40
40
  # Params:
41
41
  # id integer
42
- def get(id)
42
+ def self.show(id)
43
43
  get("note/#{id}")
44
44
  end
45
45
 
@@ -49,7 +49,7 @@ module Bloomerang
49
49
  # Params:
50
50
  # id integer
51
51
  # body JSON object, see API for fields
52
- def update(id, body)
52
+ def self.update(id, body)
53
53
  put("note/#{id}", {}, body)
54
54
  end
55
55
 
@@ -58,7 +58,7 @@ module Bloomerang
58
58
  #
59
59
  # Params:
60
60
  # id integer
61
- def delete(id)
61
+ def self.delete(id)
62
62
  delete("note/#{id}")
63
63
  end
64
64
  end
@@ -18,7 +18,7 @@ module Bloomerang
18
18
  # take integer, default: 50, simple paging system
19
19
  # constituent array[integer], separated by pipes: "1|2|3"
20
20
  # id array[integer], separated by pipes: "1|2|3"
21
- def fetch(params = {})
21
+ def self.fetch(params = {})
22
22
  get("phones", params)
23
23
  end
24
24
 
@@ -27,7 +27,7 @@ module Bloomerang
27
27
  #
28
28
  # Params:
29
29
  # body JSON object, see API for fields
30
- def create(body)
30
+ def self.create(body)
31
31
  post("phone", {}, body)
32
32
  end
33
33
 
@@ -36,7 +36,7 @@ module Bloomerang
36
36
  #
37
37
  # Params:
38
38
  # id integer
39
- def get(id)
39
+ def self.show(id)
40
40
  get("phone/#{id}")
41
41
  end
42
42
 
@@ -46,7 +46,7 @@ module Bloomerang
46
46
  # Params:
47
47
  # id integer
48
48
  # body JSON object, see API for fields
49
- def update(id, body)
49
+ def self.update(id, body)
50
50
  put("phone/#{id}", {}, body)
51
51
  end
52
52
 
@@ -55,7 +55,7 @@ module Bloomerang
55
55
  #
56
56
  # Params:
57
57
  # id integer
58
- def delete(id)
58
+ def self.delete(id)
59
59
  delete("phone/#{id}")
60
60
  end
61
61
  end
@@ -42,7 +42,7 @@ module Bloomerang
42
42
  # skip integer, default: 0, simple paging system
43
43
  # take integer, default: 50, simple paging system
44
44
  # id array[integer], separated by pipes: "1|2|3"
45
- def fetch_installments(id, params = {})
45
+ def self.fetch_installments(id, params = {})
46
46
  get("pledge/#{id}/installments", params)
47
47
  end
48
48
 
@@ -57,7 +57,7 @@ module Bloomerang
57
57
  # frequency string, Available values : Weekly, EveryOtherWeekly, TwiceMonthly, Monthly, EveryOtherMonthly, Quarterly, Yearly, Custom
58
58
  # day1 integer, Day1 & Day2 are only used with the TwiceMonthly frequency. If specified, day1 must be equal to the day value in firstInstallmentDate. If not specified, day1 will be set to the day value in firstInstallmentDate.
59
59
  # day2 integer, Day1 & Day2 are only used with the TwiceMonthly frequency
60
- def generate_installments(params = {})
60
+ def self.generate_installments(params = {})
61
61
  get("pledge/generateInstallments", params)
62
62
  end
63
63
 
@@ -68,7 +68,7 @@ module Bloomerang
68
68
  # skip integer, default: 0, simple paging system
69
69
  # take integer, default: 50, simple paging system
70
70
  # id array[integer], separated by pipes: "1|2|3"
71
- def fetch_payments(id, params = {})
71
+ def self.fetch_payments(id, params = {})
72
72
  get("pledge/#{id}/payments", params)
73
73
  end
74
74
 
@@ -79,7 +79,7 @@ module Bloomerang
79
79
  # skip integer, default: 0, simple paging system
80
80
  # take integer, default: 50, simple paging system
81
81
  # id array[integer], separated by pipes: "1|2|3"
82
- def fetch_failed_payments(id, params = {})
82
+ def self.fetch_failed_payments(id, params = {})
83
83
  get("pledge/#{id}/paymentFailures", params)
84
84
  end
85
85
 
@@ -88,7 +88,7 @@ module Bloomerang
88
88
  #
89
89
  # Params:
90
90
  # id integer
91
- def write_off(id)
91
+ def self.write_off(id)
92
92
  post("pledge/#{id}/writeOff")
93
93
  end
94
94
  end
@@ -20,7 +20,7 @@ module Bloomerang
20
20
  # id array[integer], separated by pipes: "1|2|3"
21
21
  # orderBy string, Available values : Id (default), CreatedDate, LastModifiedDate
22
22
  # orderDirection string, Available values : Asc, Desc
23
- def fetch(params = {})
23
+ def self.fetch(params = {})
24
24
  get("refunds", params)
25
25
  end
26
26
 
@@ -29,7 +29,7 @@ module Bloomerang
29
29
  #
30
30
  # Params:
31
31
  # body JSON object, see API for fields
32
- def create(body)
32
+ def self.create(body)
33
33
  post("refund", {}, body)
34
34
  end
35
35
 
@@ -38,7 +38,7 @@ module Bloomerang
38
38
  #
39
39
  # Params:
40
40
  # id integer
41
- def get(id)
41
+ def self.show(id)
42
42
  get("refund/#{id}")
43
43
  end
44
44
 
@@ -48,7 +48,7 @@ module Bloomerang
48
48
  # Params:
49
49
  # id integer
50
50
  # body JSON object, see API for fields
51
- def update(id, body)
51
+ def self.update(id, body)
52
52
  put("refund/#{id}", {}, body)
53
53
  end
54
54
 
@@ -57,7 +57,7 @@ module Bloomerang
57
57
  #
58
58
  # Params:
59
59
  # id integer
60
- def delete(id)
60
+ def self.delete(id)
61
61
  delete("refund/#{id}")
62
62
  end
63
63
  end
@@ -22,7 +22,7 @@ module Bloomerang
22
22
  #
23
23
  # Params:
24
24
  # body JSON object, see API for fields
25
- def create(body)
25
+ def self.create(body)
26
26
  post("relationship", {}, body)
27
27
  end
28
28
 
@@ -31,7 +31,7 @@ module Bloomerang
31
31
  #
32
32
  # Params:
33
33
  # id integer
34
- def get(id)
34
+ def self.show(id)
35
35
  get("relationship/#{id}")
36
36
  end
37
37
 
@@ -41,7 +41,7 @@ module Bloomerang
41
41
  # Params:
42
42
  # id integer
43
43
  # body JSON object, see API for fields
44
- def update(id, body)
44
+ def self.update(id, body)
45
45
  put("relationship/#{id}", {}, body)
46
46
  end
47
47
 
@@ -50,7 +50,7 @@ module Bloomerang
50
50
  #
51
51
  # Params:
52
52
  # id integer
53
- def delete(id)
53
+ def self.delete(id)
54
54
  delete("relationship/#{id}")
55
55
  end
56
56
 
@@ -64,7 +64,7 @@ module Bloomerang
64
64
  # id array[integer], separated by pipes: "1|2|3"
65
65
  # name array[string], Filters to relationship roles with the names in the list (pipe-separated)
66
66
  # isActive boolean, Filters to either active or inactive relationship roles
67
- def fetch_roles(params = {})
67
+ def self.fetch_roles(params = {})
68
68
  get("relationshiproles", params)
69
69
  end
70
70
 
@@ -73,7 +73,7 @@ module Bloomerang
73
73
  #
74
74
  # Params:
75
75
  # id integer
76
- def get_role(role_id)
76
+ def self.get_role(role_id)
77
77
  get("relationshiprole/#{role_id}")
78
78
  end
79
79
  end
@@ -20,7 +20,7 @@ module Bloomerang
20
20
  # id array[integer], separated by pipes: "1|2|3"
21
21
  # orderBy string, Available values : Id (default), CreatedDate, LastModifiedDate
22
22
  # orderDirection string, Available values : Asc, Desc
23
- def fetch(params = {})
23
+ def self.fetch(params = {})
24
24
  get("softcredits", params)
25
25
  end
26
26
 
@@ -29,7 +29,7 @@ module Bloomerang
29
29
  #
30
30
  # Params:
31
31
  # body JSON object, see API for fields
32
- def create(body)
32
+ def self.create(body)
33
33
  post("softcredit", {}, body)
34
34
  end
35
35
 
@@ -38,7 +38,7 @@ module Bloomerang
38
38
  #
39
39
  # Params
40
40
  # id integer
41
- def get(id)
41
+ def self.show(id)
42
42
  get("softcredit/#{id}")
43
43
  end
44
44
 
@@ -48,7 +48,7 @@ module Bloomerang
48
48
  # Params:
49
49
  # id integer
50
50
  # body JSON object, see API for fields
51
- def update(id, body)
51
+ def self.update(id, body)
52
52
  put("softcredit/#{id}", {}, body)
53
53
  end
54
54
 
@@ -57,7 +57,7 @@ module Bloomerang
57
57
  #
58
58
  # Params:
59
59
  # id integer
60
- def delete(id)
60
+ def self.delete(id)
61
61
  delete("softcredit/#{id}")
62
62
  end
63
63
  end
@@ -33,7 +33,7 @@ module Bloomerang
33
33
  # id array[integer], separated by pipes: "1|2|3"
34
34
  # orderBy string, Available values : Id (default), CreatedDate, LastModifiedDate
35
35
  # orderDirection string, Available values : Asc, Desc
36
- def fetch(params = {})
36
+ def self.fetch(params = {})
37
37
  get("tasks", params)
38
38
  end
39
39
 
@@ -42,7 +42,7 @@ module Bloomerang
42
42
  #
43
43
  # Params:
44
44
  # body JSON object, see API for fields
45
- def create(body)
45
+ def self.create(body)
46
46
  post("task", {}, body)
47
47
  end
48
48
 
@@ -51,7 +51,7 @@ module Bloomerang
51
51
  #
52
52
  # Params:
53
53
  # id integer
54
- def get(id)
54
+ def self.show(id)
55
55
  get("task/#{id}")
56
56
  end
57
57
 
@@ -61,7 +61,7 @@ module Bloomerang
61
61
  # Params:
62
62
  # id integer
63
63
  # body JSON object, see API for fields
64
- def update(id, body)
64
+ def self.update(id, body)
65
65
  put("task/#{id}", {}, body)
66
66
  end
67
67
 
@@ -70,7 +70,7 @@ module Bloomerang
70
70
  #
71
71
  # Params:
72
72
  # id integer
73
- def delete(id)
73
+ def self.delete(id)
74
74
  delete("task/#{id}")
75
75
  end
76
76
 
@@ -81,7 +81,7 @@ module Bloomerang
81
81
  # id integer
82
82
  # saveAsInteraction boolean, True to create an interaction from the task; must be false if the task does not have a constituent
83
83
  # completedDate string($date), default: Today, iso8601 format
84
- def complete(id, params = {})
84
+ def self.complete(id, params = {})
85
85
  put("task/#{id}/complete", params)
86
86
  end
87
87
  end
@@ -45,7 +45,7 @@ module Bloomerang
45
45
  # maxAmount number, Filters results based on the transaction's amount (inclusive).
46
46
  # orderBy string, Available values : Id (default), CreatedDate, LastModifiedDate
47
47
  # orderDirection string, Available values : Asc, Desc
48
- def fetch(params = {})
48
+ def self.fetch(params = {})
49
49
  get("transactions", params)
50
50
  end
51
51
 
@@ -54,7 +54,7 @@ module Bloomerang
54
54
  #
55
55
  # Params:
56
56
  # body JSON object, see API for fiends
57
- def create(body)
57
+ def self.create(body)
58
58
  post("transaction", {}, body)
59
59
  end
60
60
 
@@ -63,7 +63,7 @@ module Bloomerang
63
63
  #
64
64
  # Params:
65
65
  # id integer
66
- def get(id)
66
+ def self.show(id)
67
67
  get("transaction/#{id}")
68
68
  end
69
69
 
@@ -73,7 +73,7 @@ module Bloomerang
73
73
  # Params:
74
74
  # id integer
75
75
  # body JSON object, see API for fields
76
- def update(id, body)
76
+ def self.update(id, body)
77
77
  put("transaction/#{id}", {}, body)
78
78
  end
79
79
 
@@ -82,7 +82,7 @@ module Bloomerang
82
82
  #
83
83
  # Params:
84
84
  # id integer
85
- def delete(id)
85
+ def self.delete(id)
86
86
  delete("transaction/#{id}")
87
87
  end
88
88
 
@@ -97,7 +97,7 @@ module Bloomerang
97
97
  # id array[integer], separated by pipes: "1|2|3"
98
98
  # orderBy string, Available values : Id (default), CreatedDate, LastModifiedDate
99
99
  # orderDirection string, Available values : Asc, Desc
100
- def fetch_designations(params = {})
100
+ def self.fetch_designations(params = {})
101
101
  get("transactions/designations", params)
102
102
  end
103
103
 
@@ -106,7 +106,7 @@ module Bloomerang
106
106
  #
107
107
  # Params:
108
108
  # id integer
109
- def get_designation(id)
109
+ def self.get_designation(id)
110
110
  get("transactions/designation/#{id}")
111
111
  end
112
112
  end
@@ -22,7 +22,7 @@ module Bloomerang
22
22
  # take integer, default: 50, simple paging system
23
23
  # id array[integer], separated by pipes: "1|2|3", Filters to tributes with the IDs in the list (pipe-separated)
24
24
  # isActive boolean
25
- def fetch(params = {})
25
+ def self.fetch(params = {})
26
26
  get("tributes", params)
27
27
  end
28
28
 
@@ -31,7 +31,7 @@ module Bloomerang
31
31
  #
32
32
  # Params:
33
33
  # body JSON object, see API for fields
34
- def create(body)
34
+ def self.create(body)
35
35
  post("tribute", {}, body)
36
36
  end
37
37
 
@@ -40,7 +40,7 @@ module Bloomerang
40
40
  #
41
41
  # Params:
42
42
  # id integer
43
- def get(id)
43
+ def self.show(id)
44
44
  get("tribute/#{id}")
45
45
  end
46
46
 
@@ -50,7 +50,7 @@ module Bloomerang
50
50
  # Params:
51
51
  # id integer
52
52
  # body JSON object, see API for fields
53
- def update(id, body)
53
+ def self.update(id, body)
54
54
  put("tribute/#{id}", {}, body)
55
55
  end
56
56
 
@@ -59,7 +59,7 @@ module Bloomerang
59
59
  # skip integer, default: 0, simple paging system
60
60
  # take integer, default: 50, simple paging system
61
61
  # search string, The text to search (must be at least 3 characters)
62
- def search_active(params = {})
62
+ def self.search_active(params = {})
63
63
  get("tributes/search", params)
64
64
  end
65
65
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bloomerang
4
- VERSION = "0.2.2"
4
+ VERSION = "1.0.0"
5
5
  end
data/lib/bloomerang.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "bloomerang/version"
4
- require_relative "bloomerang/base"
5
4
  require_relative "bloomerang/configuration"
5
+ require_relative "bloomerang/base"
6
6
 
7
7
  require_relative "bloomerang/address"
8
8
  require_relative "bloomerang/appeal"
@@ -34,7 +34,11 @@ module Bloomerang
34
34
  @configuration ||= Configuration.new
35
35
  end
36
36
 
37
- def self.configure(&block)
37
+ def self.reset
38
+ @configuration = Configuration.new
39
+ end
40
+
41
+ def self.configure(&_block)
38
42
  yield(configuration)
39
43
  end
40
44
  end
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "bloomerang"
4
+
3
5
  Bloomerang.configure do |config|
4
6
  ### Set your Bloomerang API key:
5
7
  # Generate your v2.0 API key from your Bloomerang user settings:
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bloomerang_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chiperific