Sha256: 36171317be799a4496fc23aef4e41b996937427b0db27249f75b97abd6cbeaa2

Contents?: true

Size: 760 Bytes

Versions: 12

Compression:

Stored size: 760 Bytes

Contents

describe Hubspot::File do
  let(:example_file_hash) do
    VCR.use_cassette('file_example') do
      headers = { Authorization: "Bearer #{ENV.fetch('HUBSPOT_ACCESS_TOKEN')}" }
      body = {
        file: File.open(File::NULL, 'r'),
        options: { access: 'PRIVATE', ttl: 'P1M', overwrite: false }.to_json,
        folderPath: '/'
      }
      url = 'https://api.hubapi.com/filemanager/api/v3/files/upload'
      HTTParty.post(url, body: body, headers: headers).parsed_response
    end
  end

  describe ".find_by_id" do
    it "should fetch specific file" do
      VCR.use_cassette("file_find") do
        id = example_file_hash['objects'].first['id']
        file = Hubspot::File.find_by_id(id)
        file.id.should eq(id)
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
hubspot-api-ruby-0.20.0 spec/lib/hubspot/file_spec.rb
hubspot-api-ruby-0.19.0 spec/lib/hubspot/file_spec.rb
hubspot-api-ruby-0.18.0 spec/lib/hubspot/file_spec.rb
hubspot-api-ruby-0.17.1 spec/lib/hubspot/file_spec.rb
hubspot-api-ruby-0.17.0 spec/lib/hubspot/file_spec.rb
hubspot-api-ruby-0.16.0 spec/lib/hubspot/file_spec.rb
hubspot-api-ruby-0.15.0 spec/lib/hubspot/file_spec.rb
hubspot-api-ruby-0.14.0 spec/lib/hubspot/file_spec.rb
hubspot-api-ruby-0.13.0 spec/lib/hubspot/file_spec.rb
hubspot-api-ruby-0.12.0 spec/lib/hubspot/file_spec.rb
hubspot-api-ruby-0.11.0 spec/lib/hubspot/file_spec.rb
hubspot-api-ruby-0.10.0 spec/lib/hubspot/file_spec.rb