plangrade-ruby 0.3.5 → 0.3.6
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
- checksums.yaml.gz.sig +3 -2
- data.tar.gz.sig +0 -0
- data/lib/plangrade/resources/company.rb +22 -11
- data/lib/plangrade/resources/participant.rb +2 -1
- data/lib/plangrade/ruby/version.rb +1 -1
- metadata +1 -1
- metadata.gz.sig +0 -0
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 5790385b5c3f4a15cf42160db4f75ed4ab030f3e
         | 
| 4 | 
            +
              data.tar.gz: 4f8db0f0962bf2211ebaa644f589794abc401f74
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 8fd54b71bbd5dd0cf80bc96ed8e768939a1897491f8ecaa5b8fde465f306535a9bbde0d082b479d15ded3550248af5f36568629aef4c55d87dd1f2c3884c1c05
         | 
| 7 | 
            +
              data.tar.gz: 04e54e3f059074ac266a42b14407888e832f488d3effd99e6613125207c07b60e899b574a07cfc032af5ae54288fa787727e42b3f355cb00e364c5c2e6c2b451
         | 
    
        checksums.yaml.gz.sig
    CHANGED
    
    | @@ -1,2 +1,3 @@ | |
| 1 | 
            -
             | 
| 2 | 
            -
            � | 
| 1 | 
            +
            SA�^�m_����!�GZ��)�T)�xFA�.0�@�6�M��B#h�)8T�T�};+�*�{KA^v�`�U�1���ZKR��BS/�
         | 
| 2 | 
            +
            R�e÷ڜ*��v��l]����
         | 
| 3 | 
            +
            [����������U���{z��d���$09�k�~j~X��y���Ab�5��
         | 
    
        data.tar.gz.sig
    CHANGED
    
    | Binary file | 
| @@ -1,25 +1,36 @@ | |
| 1 1 | 
             
            module Plangrade
         | 
| 2 2 | 
             
              module Resources
         | 
| 3 3 | 
             
                class Company < Plangrade::Resources::Base
         | 
| 4 | 
            +
                  attr_reader :id, :name, :ein, :grade
         | 
| 4 5 |  | 
| 5 | 
            -
                  def  | 
| 6 | 
            -
                     | 
| 6 | 
            +
                  def initialize(attributes)
         | 
| 7 | 
            +
                    @id = attirbutes["id"]
         | 
| 8 | 
            +
                    @name = attributes["name"]
         | 
| 9 | 
            +
                    @ein = attributes["ein"]
         | 
| 10 | 
            +
                    @grade = attributes["grade"]
         | 
| 11 | 
            +
                  end
         | 
| 12 | 
            +
             | 
| 13 | 
            +
                  def self.create(new_ein, new_name)
         | 
| 14 | 
            +
                    result = api_handler.create_company(:ein => new_ein, :name => new_name)
         | 
| 7 15 | 
             
                    return nil unless result.created?
         | 
| 8 16 | 
             
                    id = result.headers[:location].split('/').last.to_i
         | 
| 9 17 | 
             
                    new(:id => id)
         | 
| 10 18 | 
             
                  end
         | 
| 11 19 |  | 
| 12 | 
            -
                   | 
| 13 | 
            -
             | 
| 14 | 
            -
             | 
| 15 | 
            -
                     | 
| 16 | 
            -
                    return nil unless result.success?
         | 
| 17 | 
            -
                    new(result.body[:company])
         | 
| 20 | 
            +
                  def self.get(get_id)
         | 
| 21 | 
            +
                    result = api_handler.get_company(get_id)
         | 
| 22 | 
            +
                    attributes = JSON.parse(result.body[:company])
         | 
| 23 | 
            +
                    new(attributes)
         | 
| 18 24 | 
             
                  end
         | 
| 19 25 |  | 
| 20 | 
            -
                  def self.all( | 
| 21 | 
            -
                     | 
| 22 | 
            -
             | 
| 26 | 
            +
                  def self.all(opts={})
         | 
| 27 | 
            +
                    if opts
         | 
| 28 | 
            +
                      result = api_handler.all_companies(opts)
         | 
| 29 | 
            +
                    else
         | 
| 30 | 
            +
                      result = api_handler.all_companies
         | 
| 31 | 
            +
                    end
         | 
| 32 | 
            +
                    companies = JSON.parse(result.body[:companies])
         | 
| 33 | 
            +
                    companies.map{ |attributes| new(attributes) }
         | 
| 23 34 | 
             
                  end
         | 
| 24 35 |  | 
| 25 36 | 
             
                  def update!(params)
         | 
| @@ -18,10 +18,11 @@ module Plangrade | |
| 18 18 | 
             
                    new(result.body[:participant])
         | 
| 19 19 | 
             
                  end
         | 
| 20 20 |  | 
| 21 | 
            -
                  def self.all(company_id,  | 
| 21 | 
            +
                  def self.all(company_id, opts={})
         | 
| 22 22 | 
             
                    opts ||= {}
         | 
| 23 23 | 
             
                    opts[:company_id] = company_id
         | 
| 24 24 | 
             
                    result = api_handler.all_participants(opts)
         | 
| 25 | 
            +
                    return nil unless result.success?
         | 
| 25 26 | 
             
                    new(result.body[:participants])
         | 
| 26 27 | 
             
                  end
         | 
| 27 28 |  | 
    
        metadata
    CHANGED
    
    
    
        metadata.gz.sig
    CHANGED
    
    | Binary file |