Sha256: 665e367c610e9c0c82fa9b1dc411aef5ab761419d1dbac523795f28436393a46

Contents?: true

Size: 766 Bytes

Versions: 7

Compression:

Stored size: 766 Bytes

Contents

module ChartMogul
  module API
    module Actions
      module All
        def self.included(base)
          base.extend ClassMethods
        end

        module ClassMethods
          def all(options = {})
            resp = handling_errors do
              connection.get(resource_path.apply_with_get_params(options)) do |req|
                req.headers['Content-Type'] = 'application/json'
              end
            end
            json = ChartMogul::Utils::JSONParser.parse(resp.body)

            if resource_root_key && json.key?(resource_root_key)
              json[resource_root_key].map { |attributes| new_from_json(attributes) }
            else
              new_from_json(json)
            end
          end
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
chartmogul-ruby-1.0.2 lib/chartmogul/api/actions/all.rb
chartmogul-ruby-1.0.1 lib/chartmogul/api/actions/all.rb
chartmogul-ruby-1.0.0 lib/chartmogul/api/actions/all.rb
chartmogul-ruby-0.1.4 lib/chartmogul/api/actions/all.rb
chartmogul-ruby-0.1.3 lib/chartmogul/api/actions/all.rb
chartmogul-ruby-0.1.2 lib/chartmogul/api/actions/all.rb
chartmogul-ruby-0.1.1 lib/chartmogul/api/actions/all.rb