bloomerang_api 1.0.1 → 1.0.2
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/Gemfile.lock +1 -1
 - data/lib/bloomerang/base.rb +13 -1
 - data/lib/bloomerang/constituent.rb +1 -1
 - data/lib/bloomerang/custom_field.rb +4 -4
 - data/lib/bloomerang/household.rb +0 -1
 - data/lib/bloomerang/version.rb +1 -1
 - data/lib/generators/bloomerang/templates/bloomerang_config.rb +3 -0
 - metadata +1 -1
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 82264c86f55d5d8fafd369616b8c9e931d782f2193a28d2aa2537f7ee4c599ef
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: c01b216904ae2f9d5ffd612a2d32bda05e66da6f0fdfd72207f19eb50f403093
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: a582ee1d67050b0d847520a9078c0ad344834642b1145926a706af7095b31292934243d5296b3fe58aadcf0eab311ead8dff8c1d52d077477704a1d2a00e8070
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 37f8a57528d54e387064b74721cba69671ea46dad363bf148ddc37e4116f8303e13fbc5049cdc109e7a4c6de5a8fd0d787701369d64782787229d360ec592438
         
     | 
    
        data/Gemfile.lock
    CHANGED
    
    
    
        data/lib/bloomerang/base.rb
    CHANGED
    
    | 
         @@ -9,21 +9,33 @@ module Bloomerang 
     | 
|
| 
       9 
9 
     | 
    
         
             
              class Base
         
     | 
| 
       10 
10 
     | 
    
         
             
                def self.get(path, params = {})
         
     | 
| 
       11 
11 
     | 
    
         
             
                  response = connection(params).get(path)
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                  puts response.env.url
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
       12 
15 
     | 
    
         
             
                  JSON.parse response.body
         
     | 
| 
       13 
16 
     | 
    
         
             
                end
         
     | 
| 
       14 
17 
     | 
    
         | 
| 
       15 
18 
     | 
    
         
             
                def self.delete(path, params = {})
         
     | 
| 
       16 
19 
     | 
    
         
             
                  response = connection(params).delete(path)
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                  puts response.env.url
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
       17 
23 
     | 
    
         
             
                  JSON.parse response.body
         
     | 
| 
       18 
24 
     | 
    
         
             
                end
         
     | 
| 
       19 
25 
     | 
    
         | 
| 
       20 
26 
     | 
    
         
             
                def self.post(path, params, body)
         
     | 
| 
       21 
27 
     | 
    
         
             
                  response = connection(params).post(path, body.to_json)
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
                  puts response.env.url
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
       22 
31 
     | 
    
         
             
                  JSON.parse response.body
         
     | 
| 
       23 
32 
     | 
    
         
             
                end
         
     | 
| 
       24 
33 
     | 
    
         | 
| 
       25 
34 
     | 
    
         
             
                def self.put(path, params, body)
         
     | 
| 
       26 
35 
     | 
    
         
             
                  response = connection(params).put(path, body.to_json)
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                  puts response.env.url
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
       27 
39 
     | 
    
         
             
                  JSON.parse response.body
         
     | 
| 
       28 
40 
     | 
    
         
             
                end
         
     | 
| 
       29 
41 
     | 
    
         | 
| 
         @@ -32,7 +44,7 @@ module Bloomerang 
     | 
|
| 
       32 
44 
     | 
    
         | 
| 
       33 
45 
     | 
    
         
             
                  def connection(params)
         
     | 
| 
       34 
46 
     | 
    
         
             
                    Faraday.new(
         
     | 
| 
       35 
     | 
    
         
            -
                       
     | 
| 
      
 47 
     | 
    
         
            +
                      Bloomerang.configuration.api_url,
         
     | 
| 
       36 
48 
     | 
    
         
             
                      headers: {
         
     | 
| 
       37 
49 
     | 
    
         
             
                        "Content-Type" => "application/json",
         
     | 
| 
       38 
50 
     | 
    
         
             
                        "X-API-Key" => Bloomerang.configuration.api_key
         
     | 
| 
         @@ -112,7 +112,7 @@ module Bloomerang 
     | 
|
| 
       112 
112 
     | 
    
         
             
                # id    integer
         
     | 
| 
       113 
113 
     | 
    
         
             
                # body  see API for fields
         
     | 
| 
       114 
114 
     | 
    
         
             
                def self.update_communication_settings(id, body)
         
     | 
| 
       115 
     | 
    
         
            -
                  put(" 
     | 
| 
      
 115 
     | 
    
         
            +
                  put("constituent/#{id}/updateCommunicationSettings", {}, body)
         
     | 
| 
       116 
116 
     | 
    
         
             
                end
         
     | 
| 
       117 
117 
     | 
    
         | 
| 
       118 
118 
     | 
    
         
             
                ### Search for constituents and households
         
     | 
| 
         @@ -19,7 +19,7 @@ module Bloomerang 
     | 
|
| 
       19 
19 
     | 
    
         
             
                # Params:
         
     | 
| 
       20 
20 
     | 
    
         
             
                # type  string, Available values: Constituent, Transaction, Interaction, Note, Benevon
         
     | 
| 
       21 
21 
     | 
    
         
             
                def self.categories(type)
         
     | 
| 
       22 
     | 
    
         
            -
                  get(" 
     | 
| 
      
 22 
     | 
    
         
            +
                  get("customFieldCategories/#{type}/")
         
     | 
| 
       23 
23 
     | 
    
         
             
                end
         
     | 
| 
       24 
24 
     | 
    
         | 
| 
       25 
25 
     | 
    
         
             
                ### Fetch CustomFields by type
         
     | 
| 
         @@ -29,7 +29,7 @@ module Bloomerang 
     | 
|
| 
       29 
29 
     | 
    
         
             
                # type      string, Available values: Constituent, Transaction, Interaction, Note, Benevon
         
     | 
| 
       30 
30 
     | 
    
         
             
                # isActive  boolean, Default value: true
         
     | 
| 
       31 
31 
     | 
    
         
             
                def self.fields(type, params = {})
         
     | 
| 
       32 
     | 
    
         
            -
                  get(" 
     | 
| 
      
 32 
     | 
    
         
            +
                  get("customFields/#{type}/", params)
         
     | 
| 
       33 
33 
     | 
    
         
             
                end
         
     | 
| 
       34 
34 
     | 
    
         | 
| 
       35 
35 
     | 
    
         
             
                ### Fetch CustomValues by type
         
     | 
| 
         @@ -39,7 +39,7 @@ module Bloomerang 
     | 
|
| 
       39 
39 
     | 
    
         
             
                # type      string, Available values : Constituent, Transaction, Interaction, Note, Benevon
         
     | 
| 
       40 
40 
     | 
    
         
             
                # isActive  boolean, Default value: true
         
     | 
| 
       41 
41 
     | 
    
         
             
                def self.values(type, params = {})
         
     | 
| 
       42 
     | 
    
         
            -
                  get(" 
     | 
| 
      
 42 
     | 
    
         
            +
                  get("customValues/#{type}/", params)
         
     | 
| 
       43 
43 
     | 
    
         
             
                end
         
     | 
| 
       44 
44 
     | 
    
         | 
| 
       45 
45 
     | 
    
         
             
                ### Fetch CustomValues by type for the given field
         
     | 
| 
         @@ -50,7 +50,7 @@ module Bloomerang 
     | 
|
| 
       50 
50 
     | 
    
         
             
                # fieldId   integer
         
     | 
| 
       51 
51 
     | 
    
         
             
                # isActive  boolean, Default value: true
         
     | 
| 
       52 
52 
     | 
    
         
             
                def self.values_by_field(type, field_id, params = {})
         
     | 
| 
       53 
     | 
    
         
            -
                  get(" 
     | 
| 
      
 53 
     | 
    
         
            +
                  get("customValues/#{type}/#{field_id}", params)
         
     | 
| 
       54 
54 
     | 
    
         
             
                end
         
     | 
| 
       55 
55 
     | 
    
         
             
              end
         
     | 
| 
       56 
56 
     | 
    
         
             
            end
         
     | 
    
        data/lib/bloomerang/household.rb
    CHANGED
    
    | 
         @@ -49,7 +49,6 @@ module Bloomerang 
     | 
|
| 
       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 
51 
     | 
    
         
             
                def self.search(params = {})
         
     | 
| 
       52 
     | 
    
         
            -
                  # TODO: BREAKING CHANGE: query changed to params
         
     | 
| 
       53 
52 
     | 
    
         
             
                  Constituent.search(params)
         
     | 
| 
       54 
53 
     | 
    
         
             
                end
         
     | 
| 
       55 
54 
     | 
    
         | 
    
        data/lib/bloomerang/version.rb
    CHANGED
    
    
| 
         @@ -18,4 +18,7 @@ Bloomerang.configure do |config| 
     | 
|
| 
       18 
18 
     | 
    
         
             
              # ENV or dotenv example:
         
     | 
| 
       19 
19 
     | 
    
         
             
              # Learn about dotenv gem: https://github.com/bkeepers/dotenv
         
     | 
| 
       20 
20 
     | 
    
         
             
              # config.api_key = ENV["BLOOMERANG_API_KEY"]
         
     | 
| 
      
 21 
     | 
    
         
            +
              ### Other available settings:
         
     | 
| 
      
 22 
     | 
    
         
            +
              ## api_url: defaults to "https://api.bloomerang.co/v2"
         
     | 
| 
      
 23 
     | 
    
         
            +
              # config.api_url = "https://api.bloomerang.co/v2"
         
     | 
| 
       21 
24 
     | 
    
         
             
            end
         
     |